�
__NVc@s�ddlZddlmZddlmZddlmZddlmZm Z m
Z
ddlmZdefd ��YZ
ed
kr�ddlZddlZddlZndS(i����N(tyacci(tc_ast(tCLexer(t PLYParsertCoordt
ParseError(tfix_switch_casestCParserc
Bs{eZedededd�Zddd�Zd�Zd�Zd�Zd �Z d
�Z
d�Zd�Zd
�Z
d�Zd�Zd�Zd�Zd�Zed�Zd�Zd�Zd�d�d�d�d�d�d�d�d�d�f
Zd)�Zd*�Zd+�Zd,�Zd-�Zd.�Zd/�Zd0�Zd1�Zd2�Z d3�Z!d4�Z"d5�Z#d6�Z$d7�Z%d8�Z&d9�Z'd:�Z(d;�Z)d<��Z*d=�Z+d>�Z,d?�Z-d@�Z.dA�Z/dB�Z0dC�Z1dD�Z2dE�Z3dF�Z4dG�Z5dH�Z6dI�Z7dJ�Z8dK�Z9dL�Z:dM�Z;dN�Z<�dO�Z=dP�Z>dQ�Z?dR�Z@dS�ZAdT�ZBdU�ZCdV�ZDdW�ZEdX�ZFdY�ZGdZ�ZHd[�ZId\�ZJd]�ZKd^�ZLd_�ZMd`�ZNda�ZOdb�ZPdc�ZQdd�ZRde�ZSdf�ZTdg�ZUdh�ZVdi�ZWdj�ZXdk�ZYdl�ZZdm�Z[dn�Z\do�Z]dp�Z^dq�Z_dr�Z`ds�Zadt�Zbdu�Zcdv�Zddw�Zedx�Zfdy�Zgdz�Zhd{�Zid|�Zjd}�Zkd~�Zld�Zmd��Znd��Zod��Zpd��Zqd��Zrd��Zsd��Ztd��Zud��Zvd��Zwd��Zxd��Zyd��Zzd��Z{d��Z|d��Z}d��Z~d��Zd��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�RS(�spycparser.lextabspycparser.yacctabtc Cs�td|jd|jd|jd|j�|_|jjd|d|d|�|jj|_dd d
ddd
ddddddddg}x|D]}|j|�q�Wt j d|ddd|d|d|d|�|_
t�g|_d|_dS(s� 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.
t
error_functon_lbrace_functon_rbrace_functtype_lookup_functoptimizetlextabt outputdirtabstract_declaratortassignment_expressiontdeclaration_listtdeclaration_specifierstdesignationt
expressiontidentifier_listtinit_declarator_listtinitializer_listtparameter_type_listtspecifier_qualifier_listtblock_item_listttype_qualifier_listtstruct_declarator_listtmoduletstartttranslation_unit_or_emptytdebugt tabmoduleN(Rt_lex_error_funct_lex_on_lbrace_funct_lex_on_rbrace_funct_lex_type_lookup_functclextbuildttokenst_create_opt_ruleRtcparsertdictt_scope_stacktNonet_last_yielded_token( tselftlex_optimizeRt
yacc_optimizetyacctabt
yacc_debugttaboutputdirtrules_with_opttrule((s6/usr/lib/python2.7/site-packages/pycparser/c_parser.pyt__init__sF5
icCsS||j_|jj�t�g|_d|_|jjd|d|jd|�S(s& 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
tinputtlexerR!N( R'tfilenametreset_linenoR,R-R.R/R+tparse(R0ttextR;t
debuglevel((s6/usr/lib/python2.7/site-packages/pycparser/c_parser.pyR=~s
cCs|jjt��dS(N(R-tappendR,(R0((s6/usr/lib/python2.7/site-packages/pycparser/c_parser.pyt_push_scope�scCs,t|j�dkst�|jj�dS(Ni(tlenR-tAssertionErrortpop(R0((s6/usr/lib/python2.7/site-packages/pycparser/c_parser.pyt
_pop_scope�scCsE|jdj|t�s0|jd||�nt|jd|s
cCs|d|ds$
c Cs:|jd|ddtd|ddd�g�|d abstract_declarator : direct_abstract_declarator
iiN((R0R�((s6/usr/lib/python2.7/site-packages/pycparser/c_parser.pytp_abstract_declarator_3�scCs|d|d labeled_statement : CASE constant_expression COLON statement iiiiN(RtCaseRRR�(R0R�((s6/usr/lib/python2.7/site-packages/pycparser/c_parser.pytp_labeled_statement_2CscCs3tj|dg|j|jd���|dtj|d|d|d|j|jd���|dR@RBRCRERFRHRIRJRKRMRORRRSRURVRWRXRYRZR[R\R^R`RbReRgRhRiRjRl(((s6/usr/lib/python2.7/site-packages/pycparser/c_parser.pyRsFc
) 7 - Y
;
&
t__main__(tretplyRRRtc_lexerRt plyparserRRRtast_transformsRRRmtpprintttimetsys(((s6/usr/lib/python2.7/site-packages/pycparser/c_parser.pyt s�������