| Server IP : 188.151.22.197 / Your IP : 216.73.217.74 Web Server : Apache/2.4.62 (Rocky Linux) OpenSSL/3.5.5 System : Linux wsten.se 5.14.0-687.30.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jul 27 13:09:21 UTC 2026 x86_64 User : apache ( 48) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3.9/site-packages/pycparser/__pycache__/ |
Upload File : |
a
��_^o) � @ s@ d dl Z d dlmZ G dd� de�ZG dd� de�ZdZdZdS ) � N)�Templatec @ s( e Zd Zd dd�Zd
dd�Zdd� ZdS )�ASTCodeGenerator�
_c_ast.cfgc C s || _ dd� | �|�D �| _dS )zN Initialize the code generator from a configuration
file.
c S s g | ]\}}t ||��qS � )�NodeCfg)�.0�name�contentsr r �6/usr/lib/python3.9/site-packages/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 sD t t�j| jd�}|t7 }| jD ]}||�� d 7 }q |�|� dS )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���}|D ]�}|�� }|r|�d�r,q|�d�}|�d�}|�d�}|dk sb||ksb||krrtd||f ��|d|� }||d |� }|r�d d
� |�d�D �ng } || fV qW d � n1 s�0 Y dS )ze Parse the configuration file and yield pairs of
(name, contents) for each node.
�r�#�:�[�]� zInvalid line in %s:
%s
Nc S s g | ]}|� � �qS r )�strip)r �vr r r
r 7 � z2ASTCodeGenerator.parse_cfgfile.<locals>.<listcomp>�,)�openr �
startswith�find�RuntimeError�split)
r �filename�f�lineZcolon_iZ
lbracket_iZ
rbracket_ir �valZvallistr r r
r
&