Repository URL to install this package:
|
Version:
2.18 ▾
|
öXã! ã @ s d d l Z d d l m Z Gd d d e Z Gd d d e Z d Z d Z e d k r d d l Z e d
Z
e
j e d d d S)
é N)ÚTemplatec @ s: e Z d Z d d d Z d d d Z d d Z d S) ÚASTCodeGeneratorz
_c_ast.cfgc C s, | | _ d d | j | D | _ d S)zN Initialize the code generator from a configuration
file.
c S s% g | ] \ } } t | | q S© )ÚNodeCfg)Ú.0ÚnameÚcontentsr r úX/tmp/pip-install-0kh_z7y_/pycparser/build/bdist.linux-x86_64/wheel/pycparser/_ast_gen.pyú
<listcomp> s z-ASTCodeGenerator.__init__.<locals>.<listcomp>N)Úcfg_filenameÚ
parse_cfgfileÚnode_cfg)Úselfr r r r Ú__init__ s zASTCodeGenerator.__init__Nc C s^ t t j d | j } | t 7} x% | j D] } | | j d 7} q/ W| j | d S)z< Generates the code into file, an open file buffer.
r z
N)r Ú_PROLOGUE_COMMENTZ
substituter Ú_PROLOGUE_CODEr
Úgenerate_sourceÚwrite)r ÚfileÚsrcr
r r r Úgenerate s
zASTCodeGenerator.generatec
c s t | d û } xñ | D]é } | j } | s | j d rD q | j d } | j d } | j d } | d k s | | k s | | k r« t d | | f | d |
} | | d |
} | rñ d d
| j d D n g } | | f Vq WWd QRXd S)ze Parse the configuration file and yield pairs of
(name, contents) for each node.
Úrú#ú:ú[ú]é zInvalid line in %s:
%s
Nc S s g | ] } | j q Sr )Ústrip)r Úvr r r r
7 s z2ASTCodeGenerator.parse_cfgfile.<locals>.<listcomp>ú,)Úopenr Ú
startswithÚfindÚRuntimeErrorÚsplit)
r ÚfilenameÚfÚlineZcolon_iZ
lbracket_iZ
rbracket_ir ÚvalZvallistr r r r &