관리-도구
편집 파일: c_generator.cpython-36.pyc
3 g�wU5 � @ s d dl mZ G dd� de�ZdS )� )�c_astc @ s� e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zdldd �Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)d*� Zd+d,� Zd-d.� Zd/d0� Zd1d2� Zd3d4� Zd5d6� Zd7d8� Zd9d:� Zd;d<� Z d=d>� Z!d?d@� Z"dAdB� Z#dCdD� Z$dEdF� Z%dGdH� Z&dIdJ� Z'dKdL� Z(dMdN� Z)dOdP� Z*dQdR� Z+dSdT� Z,dUdV� Z-dWdX� Z.dYdZ� Z/d[d\� Z0d]d^� Z1dmd_d`�Z2dadb� Z3g fdcdd�Z4dedf� Z5dgdh� Z6didj� Z7dkS )n� CGeneratorz� Uses the same visitor pattern as c_ast.NodeVisitor, but modified to return a value from each visit method, using string accumulation in generic_visit. c C s d| _ d S )N� )�indent_level)�self� r �!/usr/lib/python3.6/c_generator.py�__init__ s zCGenerator.__init__c C s d| j S )N� )r )r r r r �_make_indent s zCGenerator._make_indentc C s d|j j }t| || j�|�S )NZvisit_)� __class__�__name__�getattr� generic_visit)r �node�methodr r r �visit s zCGenerator.visitc s, |d krdS dj � fdd�|j� D ��S d S )N� c 3 s | ]\}}� j |�V qd S )N)r )�.0Zc_name�c)r r r � <genexpr># s z+CGenerator.generic_visit.<locals>.<genexpr>)�joinZchildren)r r r )r r r s zCGenerator.generic_visitc C s |j S )N)�value)r �nr r r �visit_Constant% s zCGenerator.visit_Constantc C s |j S )N)�name)r r r r r �visit_ID( s zCGenerator.visit_IDc C s$ | j |j�}|d | j|j� d S )N�[�])�_parenthesize_unless_simpler r Z subscript)r r Zarrrefr r r �visit_ArrayRef+ s zCGenerator.visit_ArrayRefc C s"