Viewing File: /opt/alt/python38/lib/python3.8/site-packages/pycparser/__pycache__/c_lexer.cpython-38.pyc

U

_m8@s<ddlZddlZddlmZddlmZGdddeZdS)N)lex)TOKENc@sJeZdZdZddZddZddZdd	Zd
dZdd
Z	ddZ
ddZdZiZ
eD]4Zedkrnee
d<qXedkree
d<qXee
e<qXedZdZdZdZdZdZdZdeded Zd!eZeeeZeeeZd"Zd#Zd$Zd%Zd&Zd'ed(ed(ed)Z d*e d Z!d+e!d+Z"d,e"Z#d-e!d.e!d/Z$d-e!d0ed1Z%d2e d Z&d3e&d4Z'd,e'Z(d3e&d5ee&d4Z)d6Z*d7Z+d8e+d e*d9e*d:Z,d;Z-d<ed=ed>ed?Z.d@ed@ed(e.d e-dAZ/dBZ0dCdDZ1e2e'dEdFZ3e2edGdHZ4dIdJZ5dKdLZ6dMZ7dNdOZ8dPdQZ9dRdSZ:dTZ;e2e'dUdVZ<e2edWdXZ=dYdZZ>dMZ?d[d\Z@d]ZAd^ZBd_ZCd`ZDdaZEdbZFdcZGddZHdeZIdfZJdgZKdhZLdiZMdjZNdkZOdlZPdmZQdnZRdoZSdpZTdqZUdrZVdsZWdtZXduZYdvZZdwZ[dxZ\dyZ]dzZ^d{Z_d|Z`d}Zad~ZbdZcdZddZedZfdZgdZhdZidZjdZkdZle2dddZme2dddZne'Zoe2e,ddZpe2e/ddZqe2eddZre2eddZse2eddZte2eddZue2eddZve2e"ddZwe2e#ddZxe2e$ddZye2e%ddZze2e(ddZ{e2e)ddZ|e2eddZ}ddZ~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|_td|_td|_	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([ 	]*line\W)|([ 	]*\d+)z
[ 	]*pragma\W)

error_funcon_lbrace_funcon_rbrace_functype_lookup_funcfilename
last_tokenrecompileline_patternpragma_pattern)selfrrrr	r/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.
        N)rlinenorrrrreset_linenoDszCLexer.reset_linenocCs|j|dSN)rinput)rtextrrrrIszCLexer.inputcCs|j|_|jSr)rtokenrrrrrrLszCLexer.tokencCs|jjdd|j}|j|S)z3 Find the column of the token in its line.
        
r)rlexdatarfindlexpos)rrZlast_crrrrfind_tok_columnPszCLexer.find_tok_columncCs0||}|||d|d|jddS)Nrr)_make_tok_locationrrskip)rmsgrlocationrrr_error[s
z
CLexer._errorcCs|j||fSr)rr$)rrrrrr%`szCLexer._make_tok_location)%_BOOL_COMPLEXZAUTOZBREAKZCASEZCHARZCONSTZCONTINUEZDEFAULTZDOZDOUBLEELSEZENUMZEXTERNZFLOATZFORZGOTOZIFZINLINEZINTZLONGZREGISTERZOFFSETOFZRESTRICTZRETURNZSHORTZSIGNEDZSIZEOFZSTATICZSTRUCTZSWITCHZTYPEDEFZUNIONZUNSIGNEDZVOIDZVOLATILEZWHILEr*Z_Boolr+Z_Complex);IDTYPEIDZ
INT_CONST_DECZ
INT_CONST_OCTZ
INT_CONST_HEXZ
INT_CONST_BINZFLOAT_CONSTZHEX_FLOAT_CONSTZ
CHAR_CONSTZWCHAR_CONSTZSTRING_LITERALZWSTRING_LITERALPLUSMINUSZTIMESZDIVIDEZMODORZANDZNOTZXORZLSHIFTZRSHIFTZLORZLANDZLNOTZLTZLEZGTZGEZEQZNEZEQUALSZ
TIMESEQUALZDIVEQUALZMODEQUAL	PLUSEQUALZ
MINUSEQUALZLSHIFTEQUALZRSHIFTEQUALZANDEQUALZXOREQUALZOREQUALZPLUSPLUSZ
MINUSMINUSZARROWZCONDOPZLPARENZRPARENZLBRACKETZRBRACKETLBRACERBRACECOMMAZPERIODSEMICOLONELLIPSISPPHASHz[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([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	exclusive)pppragmarBcCsf|jj|jj|jjdr2|jdd|_|_n0|jj|jj|jjdrX|jdn
d|_	|SdS)z[ \t]*\#)posrANrCr9)
rmatchrr!r#beginpp_linepp_filenamertypertrrrt_PPHASHszCLexer.t_PPHASHcCs0|jdkr|d|n|jdd|_dS)Nz$filename before line number in #liner>)rGr)valuelstriprstriprHrJrrrt_ppline_FILENAMEs
zCLexer.t_ppline_FILENAMEcCs|jdkr|j|_ndSr)rGrMrJrrrt_ppline_LINE_NUMBER
s

zCLexer.t_ppline_LINE_NUMBERcCsH|jdkr|d|n t|j|j_|jdk	r8|j|_|jddS)\nNzline number missing in #lineINITIAL)rGr)intrrrHr
rFrJrrrt_ppline_NEWLINEs

zCLexer.t_ppline_NEWLINEcCsdS)lineNrrJrrrt_ppline_PPLINE szCLexer.t_ppline_PPLINEz 	cCs|d|dS)Nzinvalid #line directiver)rJrrrt_ppline_error&szCLexer.t_ppline_errorcCs |jjd7_|jddS)rRrrSN)rrrFrJrrrt_pppragma_NEWLINE,szCLexer.t_pppragma_NEWLINEcCsdS)ZpragmaNrrJrrrt_pppragma_PPPRAGMA1szCLexer.t_pppragma_PPPRAGMAz$ 	<>.-{}();=+-*/$%@&^~!?:,0123456789cCsdSrrrJrrrt_pppragma_STR7szCLexer.t_pppragma_STRcCsdSrrrJrrr
t_pppragma_ID:szCLexer.t_pppragma_IDcCs|d|dS)Nzinvalid #pragma directiverXrJrrrt_pppragma_error=szCLexer.t_pppragma_errorcCs|jj|jd7_dS)z\n+r N)rrrMcountrJrrr	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||Sr)rrJrrrt_LBRACEszCLexer.t_LBRACEz\}cCs||Sr)rrJrrrt_RBRACEszCLexer.t_RBRACEcCs|SrrrJrrr
t_FLOAT_CONSTszCLexer.t_FLOAT_CONSTcCs|SrrrJrrrt_HEX_FLOAT_CONSTszCLexer.t_HEX_FLOAT_CONSTcCs|SrrrJrrrt_INT_CONST_HEXszCLexer.t_INT_CONST_HEXcCs|SrrrJrrrt_INT_CONST_BINszCLexer.t_INT_CONST_BINcCsd}|||dS)NzInvalid octal constantrXrrKr'rrrt_BAD_CONST_OCTszCLexer.t_BAD_CONST_OCTcCs|SrrrJrrrt_INT_CONST_OCTszCLexer.t_INT_CONST_OCTcCs|SrrrJrrrt_INT_CONST_DECszCLexer.t_INT_CONST_DECcCs|SrrrJrrrt_CHAR_CONSTszCLexer.t_CHAR_CONSTcCs|SrrrJrrr
t_WCHAR_CONSTszCLexer.t_WCHAR_CONSTcCsd}|||dS)NzUnmatched 'rXrsrrrt_UNMATCHED_QUOTEszCLexer.t_UNMATCHED_QUOTEcCsd|j}|||dS)NzInvalid char constant %s)rMr)rsrrrt_BAD_CHAR_CONSTs
zCLexer.t_BAD_CHAR_CONSTcCs|SrrrJrrrt_WSTRING_LITERALszCLexer.t_WSTRING_LITERALcCsd}|||dS)Nz#String contains invalid escape coderXrsrrrt_BAD_STRING_LITERALszCLexer.t_BAD_STRING_LITERALcCs2|j|jd|_|jdkr.||jr.d|_|S)Nr-r.)keyword_mapgetrMrIr	rJrrrt_IDszCLexer.t_IDcCs"dt|jd}|||dS)NzIllegal character %sr)reprrMr)rsrrrt_errorszCLexer.t_errorN)__name__
__module____qualname____doc__rrrrrr$r)r%keywordsr}keywordlowertokensZ
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_constantZstatesrLrrPrQrUrWZt_ppline_ignorerYrZr[Zt_pppragma_ignorer\r]r^Zt_ignorer`Zt_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_ELLIPSISrmrnZt_STRING_LITERALrorprqrrrtrurvrwrxryrzr{r|rrrrrrrs&!



;	$





















r)rsysZplyrZply.lexrrrrrrr<module>	s
Back to Directory File Manager