| Server IP : 185.143.234.130 / Your IP : 185.215.232.195 Web Server : LiteSpeed System : Linux jambul.7ho.st 5.14.0-503.40.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 5 06:06:04 EDT 2025 x86_64 User : renecafe ( 1327) PHP Version : 8.1.33 Disable Function : show_source, system, shell_exec, passthru, exec, popen, proc_open MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /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
&