Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

agriconnect / pycparser   python

Repository URL to install this package:

Version: 2.18 

/ __pycache__ / c_lexer.cpython-36.pyc

3

X8@s<ddlZddlZddlmZddlmZGdddeZdS)N)lex)TOKENc>@sTeZdZdZddZddZddZdd	Zd
dZdd
Z	ddZ
ddZdZiZ
x<eD]4Zedkrree
d8<q\edkree
d9<q\ee
ej<q\Wed
ZdwZdxZdyZdzZd{Zd|Zd}ed~edZdeZeeeZeeeZdZdZdZdZdZdedededZ de dZ!de!dZ"de"Z#de!de!dZ$de!dedZ%de dZ&de&dZ'de'Z(de&dee&dZ)dZ*dZ+de+de*de*dZ,dZ-dedededZ.dedede.de-dZ/dZ0ddZ1e2e'ddZ3e2eddZ4ddZ5ddZ6dZ7ddZ8ddZ9ddZ:dZ;ddZ<ddZ=dZ>ddZ?dZ@dZAdZBdZCdZDdZEdZFdZGdZHdZIdZJdZKdZLdZMdZNdZOdZPdZQdZRdZSdZTdZUdZVdZWdZXdZYdZZdZ[dZ\dZ]dZ^dZ_dZ`dZadZbdZcdZddZedZfdZgdZhdZidZjdZke2dddZle2dddZme'Zne2e,ddZoe2e/ddZpe2eddZqe2eddZre2eddZse2eddZte2eddZue2e"ddZve2e#ddZwe2e$ddZxe2e%ddZye2e(ddZze2e)ddZ{e2eddZ|d	d
Z}dS(CLexera A lexer for the C language. After building it, set the
        input text with input(), and call token() to get new
        tokens.

        The public attribute filename can be set to an initial
        filaneme, but the lexer will update it upon #line
        directives.
    cCs@||_||_||_||_d|_d|_tjd|_tjd|_	dS)ab Create a new Lexer.

            error_func:
                An error function. Will be called with an error
                message, line and column as arguments, in case of
                an error during lexing.

            on_lbrace_func, on_rbrace_func:
                Called when an LBRACE or RBRACE is encountered
                (likely to push/pop type_lookup_func's scope)

            type_lookup_func:
                A type lookup function. Given a string, it must
                return True IFF this string is a name of a type
                that was defined with a typedef earlier.
        Nz([ \t]*line\W)|([ \t]*\d+)z[ \t]*pragma\W)

error_funcon_lbrace_funcon_rbrace_functype_lookup_funcfilename
last_tokenrecompileline_patternpragma_pattern)selfrrr	r
r../pycparser/c_lexer.py__init__szCLexer.__init__cKstjfd|i||_dS)z Builds the lexer from the specification. Must be
            called after the lexer object is created.

            This method exists separately, because the PLY
            manual warns against calling lex.lex inside
            __init__
        objectN)rlexer)rkwargsrrrbuild:szCLexer.buildcCsd|j_dS)z? Resets the internal line number counter of the lexer.
        rN)rlineno)rrrrreset_linenoDszCLexer.reset_linenocCs|jj|dS)N)rinput)rtextrrrrIszCLexer.inputcCs|jj|_|jS)N)rtokenr)rrrrrLszCLexer.tokencCs|jjjdd|j}|j|S)z3 Find the column of the token in its line.
        
r)rlexdatarfindlexpos)rrZlast_crrrrfind_tok_columnPszCLexer.find_tok_columncCs0|j|}|j||d|d|jjddS)Nrr)_make_tok_locationrrskip)rmsgrlocationrrr_error[s
z
CLexer._errorcCs|j|j|fS)N)rr")rrrrrr#`szCLexer._make_tok_location_BOOL_COMPLEXAUTOBREAKCASECHARCONSTCONTINUEDEFAULTDODOUBLEELSEENUMEXTERNFLOATFORGOTOIFINLINEINTLONGREGISTEROFFSETOFRESTRICTRETURNSHORTSIGNEDSIZEOFSTATICSTRUCTSWITCHTYPEDEFUNIONUNSIGNEDVOIDVOLATILEWHILE__INT128Z_BoolZ_ComplexIDTYPEID
INT_CONST_DEC
INT_CONST_OCT
INT_CONST_HEX
INT_CONST_BINFLOAT_CONSTHEX_FLOAT_CONST
CHAR_CONSTWCHAR_CONSTSTRING_LITERALWSTRING_LITERALPLUSMINUSTIMESDIVIDEMODORANDNOTXORLSHIFTRSHIFTLORLANDLNOTLTLEGTGEEQNEEQUALS
TIMESEQUALDIVEQUALMODEQUAL	PLUSEQUAL
MINUSEQUALLSHIFTEQUALRSHIFTEQUALANDEQUALXOREQUALOREQUALPLUSPLUS
MINUSMINUSARROWCONDOPLPARENRPARENLBRACKETRBRACKETLBRACERBRACECOMMAPERIODSEMICOLONELLIPSISPPHASHPPPRAGMAPPPRAGMASTRz[a-zA-Z_$][0-9a-zA-Z_$]*z0[xX]z[0-9a-fA-F]+z0[bB]z[01]+zD(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?z(0z)|([1-9][0-9]*)z0[0-7]*z0[0-7]*[89]z([a-zA-Z._~!=&\^\-\\?'"])z(\d+)z(x[0-9a-fA-F]+)z#([\\][^a-zA-Z._~^!=&\^\-\\?'"x0-7])z(\\(|z))z
([^'\\\n]|'Lz('z*\n)|('z*$)z[^'
]+')|('')|('z	[^'\n]*')z
([^"\\\n]|"z*"z*?z([eE][-+]?[0-9]+)z([0-9]*\.[0-9]+)|([0-9]+\.)z((((z
?)|([0-9]+z
))[FfLl]?)z([pP][+-]?[0-9]+)z(((z)?\.z)|(z\.))(z[FfLl]?)ppline	exclusivepppragmacCsf|jj|jj|jjdr2|jjdd|_|_n0|jj|jj|jjdrX|jjdn
d|_	|SdS)z[ \t]*\#)posrNrr)
rmatchrrr!beginpp_linepp_filenamertype)rtrrrt_PPHASHszCLexer.t_PPHASHcCs0|jdkr|jd|n|jjdjd|_dS)Nz$filename before line number in #liner)rr'valuelstriprstripr)rrrrrt_ppline_FILENAMEs
zCLexer.t_ppline_FILENAMEcCs|jdkr|j|_ndS)N)rr)rrrrrt_ppline_LINE_NUMBERs

zCLexer.t_ppline_LINE_NUMBERcCsH|jdkr|jd|n t|j|j_|jdk	r8|j|_|jjddS)z\nNzline number missing in #lineINITIAL)rr'intrrrrr)rrrrrt_ppline_NEWLINEs

zCLexer.t_ppline_NEWLINEcCsdS)lineNr)rrrrrt_ppline_PPLINE!szCLexer.t_ppline_PPLINEz 	cCs|jd|dS)Nzinvalid #line directive)r')rrrrrt_ppline_error'szCLexer.t_ppline_errorcCs |jjd7_|jjddS)z\nrrN)rrr)rrrrrt_pppragma_NEWLINE-szCLexer.t_pppragma_NEWLINEcCs|S)Zpragmar)rrrrrt_pppragma_PPPRAGMA2szCLexer.t_pppragma_PPPRAGMAcCs
d|_|S)z.+r)r)rrrrrt_pppragma_STR8szCLexer.t_pppragma_STRcCs|jd|dS)Nzinvalid #pragma directive)r')rrrrrt_pppragma_error=szCLexer.t_pppragma_errorcCs|jj|jjd7_dS)z\n+rN)rrrcount)rrrrr	t_NEWLINEFszCLexer.t_NEWLINEz\+-z\*/%z\|&~z\^z<<z>>z\|\|z&&!<>z<=z>=z==z!==z\*=z/=z%=z\+=z-=z<<=z>>=z&=z\|=z\^=z\+\+z--z->z\?z\(z\)z\[z\],z\.;:z\.\.\.z\{cCs|j|S)N)r)rrrrrt_LBRACEszCLexer.t_LBRACEz\}cCs|j|S)N)r	)rrrrrt_RBRACEszCLexer.t_RBRACEcCs|S)Nr)rrrrr
t_FLOAT_CONSTszCLexer.t_FLOAT_CONSTcCs|S)Nr)rrrrrt_HEX_FLOAT_CONSTszCLexer.t_HEX_FLOAT_CONSTcCs|S)Nr)rrrrrt_INT_CONST_HEXszCLexer.t_INT_CONST_HEXcCs|S)Nr)rrrrrt_INT_CONST_BINszCLexer.t_INT_CONST_BINcCsd}|j||dS)NzInvalid octal constant)r')rrr%rrrt_BAD_CONST_OCTszCLexer.t_BAD_CONST_OCTcCs|S)Nr)rrrrrt_INT_CONST_OCTszCLexer.t_INT_CONST_OCTcCs|S)Nr)rrrrrt_INT_CONST_DECszCLexer.t_INT_CONST_DECcCs|S)Nr)rrrrrt_CHAR_CONSTszCLexer.t_CHAR_CONSTcCs|S)Nr)rrrrr
t_WCHAR_CONSTszCLexer.t_WCHAR_CONSTcCsd}|j||dS)NzUnmatched ')r')rrr%rrrt_UNMATCHED_QUOTEszCLexer.t_UNMATCHED_QUOTEcCsd|j}|j||dS)NzInvalid char constant %s)rr')rrr%rrrt_BAD_CHAR_CONSTs
zCLexer.t_BAD_CHAR_CONSTcCs|S)Nr)rrrrrt_WSTRING_LITERALszCLexer.t_WSTRING_LITERALcCsd}|j||dS)Nz#String contains invalid escape code)r')rrr%rrrt_BAD_STRING_LITERALszCLexer.t_BAD_STRING_LITERALcCs2|jj|jd|_|jdkr.|j|jr.d|_|S)NrNrO)keyword_mapgetrrr
)rrrrrt_IDszCLexer.t_IDcCs"dt|jd}|j||dS)NzIllegal character %sr)reprrr')rrr%rrrt_errorszCLexer.t_errorN)&r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrM)=rNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrr)rr)~__name__
__module____qualname____doc__rrrrrr"r'r#keywordsrkeywordlowertokensZ
identifierZ
hex_prefixZ
hex_digitsZ
bin_prefixZ
bin_digitsZinteger_suffix_optZdecimal_constantZoctal_constantZhex_constantZbin_constantZbad_octal_constantZ
simple_escapeZdecimal_escapeZ
hex_escapeZ
bad_escapeZescape_sequenceZcconst_charZ
char_constZwchar_constZunmatched_quoteZbad_char_constZstring_charZstring_literalZwstring_literalZbad_string_literalZ
exponent_partZfractional_constantZfloating_constantZbinary_exponent_partZhex_fractional_constantZhex_floating_constantZstatesrrrrrrZt_ppline_ignorerrrZt_pppragma_ignorerrZt_ignorerZt_PLUSZt_MINUSZt_TIMESZt_DIVIDEZt_MODZt_ORZt_ANDZt_NOTZt_XORZt_LSHIFTZt_RSHIFTZt_LORZt_LANDZt_LNOTZt_LTZt_GTZt_LEZt_GEZt_EQZt_NEZt_EQUALSZt_TIMESEQUALZ
t_DIVEQUALZ
t_MODEQUALZt_PLUSEQUALZt_MINUSEQUALZ
t_LSHIFTEQUALZ
t_RSHIFTEQUALZ
t_ANDEQUALZ	t_OREQUALZ
t_XOREQUALZ
t_PLUSPLUSZt_MINUSMINUSZt_ARROWZt_CONDOPZt_LPARENZt_RPARENZ
t_LBRACKETZ
t_RBRACKETZt_COMMAZt_PERIODZt_SEMIZt_COLONZ
t_ELLIPSISrrZt_STRING_LITERALrrrrrrrrrrrrrrrrrrrrsB!



		$	r)r
sysplyrZply.lexrrrrrrr<module>	s