File: //opt/alt/python37/lib/python3.7/site-packages/pycparser/__pycache__/c_parser.cpython-37.opt-1.pyc
B
�>�`� � @ s� d dl Z d dlmZ ddlmZ ddlmZ ddlmZm Z m
Z
ddlmZ G dd � d e�Z
ed
kr|d dlZd dlZd dlZdS )� N)�yacc� )�c_ast)�CLexer)� PLYParser�Coord�
ParseError)�fix_switch_casesc @ s e Zd Z�d1dd�Z�d2d d
�Zdd� Zd
d� Zdd� Zdd� Zdd� Z dd� Z
dd� Zdd� Zdd� Z
dd� Zdd � Zd!d"� Zd#d$� Z�d3d%d&�Zd'd(� Zd)d*� Zd+Zd,d-� Zd.d/� Zd0d1� Zd2d3� Zd4d5� Zd6d7� Zd8d9� Zd:d;� Zd<d=� Zd>d?� Zd@dA� Z dBdC� Z!dDdE� Z"dFdG� Z#dHdI� Z$dJdK� Z%dLdM� Z&dNdO� Z'dPdQ� Z(dRdS� Z)dTdU� Z*dVdW� Z+dXdY� Z,dZd[� Z-d\d]� Z.d^d_� Z/d`da� Z0dbdc� Z1ddde� Z2dfdg� Z3dhdi� Z4djdk� Z5dldm� Z6dndo� Z7dpdq� Z8drds� Z9dtdu� Z:dvdw� Z;dxdy� Z<dzd{� Z=d|d}� Z>d~d� Z?d�d�� Z@d�d�� ZAd�d�� ZBd�d�� ZCd�d�� ZDd�d�� ZEd�d�� ZFd�d�� ZGd�d�� ZHd�d�� ZId�d�� ZJd�d�� ZKd�d�� ZLd�d�� ZMd�d�� ZNd�d�� ZOd�d�� ZPd�d�� ZQd�d�� ZRd�d�� ZSd�d�� ZTd�d�� ZUd�d�� ZVd�d�� ZWd�d�� ZXd�d�� ZYd�d�� ZZd�d�� Z[d�d�� Z\d�d�� Z]d�d�� Z^d�d�� Z_d�d�� Z`d�dÄ Zad�dń Zbd�dDŽ Zcd�dɄ Zdd�d˄ Zed�d̈́ Zfd�dτ Zgd�dф Zhd�dӄ Zid�dՄ Zjd�dׄ Zkd�dل Zld�dۄ Zmd�d݄ Znd�d߄ Zod�d� Zpd�d� Zqd�d� Zrd�d� Zsd�d� Ztd�d� Zud�d� Zvd�d� Zwd�d� Zxd�d� Zyd�d�� Zzd�d�� Z{d�d�� Z|d�d�� Z}d�d�� Z~d�d�� Z�d �d� Z��d�d� Z��d�d� Z��d�d� Z��d�d � Z��d
�d� Z��d�d
� Z��d�d� Z��d�d� Z��d�d� Z��d�d� Z��d�d� Z��d�d� Z��d�d� Z��d�d� Z��d�d� Z��d �d!� Z��d"�d#� Z��d$�d%� Z��d&�d'� Z��d(�d)� Z��d*�d+� Z��d,�d-� Z��d.�d/� Z��d0S (4 �CParserT�pycparser.lextab�pycparser.yacctabF� c C s� t | j| j| j| jd�| _| jj|||d� | jj| _ddddddd d
ddd
dddg}x|D ]}| �|� q\W t j | d||||d�| _
t� g| _d| _
dS )a� Create a new CParser.
Some arguments for controlling the debug/optimization
level of the parser are provided. The defaults are
tuned for release/performance mode.
The simple rules for using them are:
*) When tweaking CParser/CLexer, set these to False
*) When releasing a stable parser, set to True
lex_optimize:
Set to False when you're modifying the lexer.
Otherwise, changes in the lexer won't be used, if
some lextab.py file exists.
When releasing with a stable lexer, set to True
to save the re-generation of the lexer table on
each run.
lextab:
Points to the lex table that's used for optimized
mode. Only if you're modifying the lexer and want
some tests to avoid re-generating the table, make
this point to a local lex table file (that's been
earlier generated with lex_optimize=True)
yacc_optimize:
Set to False when you're modifying the parser.
Otherwise, changes in the parser won't be used, if
some parsetab.py file exists.
When releasing with a stable parser, set to True
to save the re-generation of the parser table on
each run.
yacctab:
Points to the yacc table that's used for optimized
mode. Only if you're modifying the parser, make
this point to a local yacc table file
yacc_debug:
Generate a parser.out file that explains how yacc
built the parsing table from the grammar.
taboutputdir:
Set this parameter to control the location of generated
lextab and yacctab files.
)Z
error_funcZon_lbrace_funcZon_rbrace_funcZtype_lookup_func)�optimize�lextab� outputdirZabstract_declaratorZassignment_expressionZdeclaration_listZdeclaration_specifiersZdesignationZ
expressionZidentifier_listZinit_declarator_listZinitializer_listZparameter_type_listZspecifier_qualifier_listZblock_item_listZtype_qualifier_listZstruct_declarator_listZtranslation_unit_or_empty)�module�start�debugr Z tabmoduler N)r �_lex_error_func�_lex_on_lbrace_func�_lex_on_rbrace_func�_lex_type_lookup_func�clexZbuild�tokensZ_create_opt_ruler �cparser�dict�_scope_stack�_last_yielded_token) �selfZlex_optimizer Z
yacc_optimizeZyacctabZ
yacc_debugZtaboutputdirZrules_with_optZrule� r �C/opt/alt/python37/lib/python3.7/site-packages/pycparser/c_parser.py�__init__ sF 5
zCParser.__init__r c C s6 || j _| j �� t� g| _d| _| jj|| j |d�S )a& Parses C code and returns an AST.
text:
A string containing the C source code
filename:
Name of the file being parsed (for meaningful
error messages)
debuglevel:
Debug level to yacc
N)�inputZlexerr )r �filenameZreset_linenor r r r �parse)r �textr# Z
debuglevelr r r r$ ~ s
z
CParser.parsec C s | j �t� � d S )N)r �appendr )r r r r �_push_scope� s zCParser._push_scopec C s | j �� d S )N)r �pop)r r r r �
_pop_scope� s zCParser._pop_scopec C s4 | j d �|d�s"| �d| |� d| j d |<