zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
U
L±dCã@s4ddlZddlmZddlmZGdd„deƒZdS)éNé)Úlex)ÚTOKENc@sôeZdZdZdd„Zdd„Zdd„Zdd    „Zd
d „Zd d „Z    dd„Z
dd„Z dZ dZ iZe D]Zeee ¡<q\e D](Zeeedd… ¡edd… ¡<qre e dZdZdZdZdZdZdZdededZd eZeeeZeeeZd!Zd"Zd#Zd$Z d%Z!d&ed'ed'e d(Z"d)Z#d*e"dZ$d+e$d+Z%d,e%Z&d-e%Z'd.e%Z(d/e%Z)d+e$d0Z*d1e$d2e$d3Z+d1e$d4e!d5Z,d6e#dZ-d7e-d8Z.d,e.Z/d-e.Z0d.e.Z1d/e.Z2d7e-d9e!e-d8Z3d:Z4d;Z5d<e5de4d=e4d>Z6d?Z7d@edAedBedCZ8dDedDed'e8de7dEZ9dFZ:dGdH„Z;e<e.ƒdIdJ„ƒZ=e<eƒdKdL„ƒZ>dMdN„Z?dOdP„Z@dQZAdRdS„ZBdTdU„ZCdVdW„ZDdQZEdXdY„ZFdZd[„ZGdQZHd\d]„ZId^ZJd_ZKd`ZLdaZMdbZNdcZOddZPdeZQdfZRdgZSdhZTdiZUdjZVdkZWdlZXdmZYdnZZdoZ[dpZ\dqZ]drZ^dsZ_dtZ`duZadvZbdwZcdxZddyZedzZfd{Zgd|Zhd}Zid~ZjdZkd€ZldZmd‚ZndƒZod„Zpd…Zqd†Zrd‡ZsdˆZtd‰Zue<dŠƒd‹dŒ„ƒZve<dƒdŽd„ƒZwe.Zxe<e6ƒdd‘„ƒZye<e9ƒd’d“„ƒZze<eƒd”d•„ƒZ{e<eƒd–d—„ƒZ|e<eƒd˜d™„ƒZ}e<eƒdšd›„ƒZ~e<eƒdœd„ƒZe<e*ƒdždŸ„ƒZ€e<e%ƒd d¡„ƒZe<e&ƒd¢d£„ƒZ‚e<e'ƒd¤d¥„ƒZƒe<e(ƒd¦d§„ƒZ„e<e)ƒd¨d©„ƒZ…e<e+ƒdªd«„ƒZ†e<e,ƒd¬d­„ƒZ‡e<e/ƒd®d¯„ƒZˆe<e0ƒd°d±„ƒZ‰e<e1ƒd²d³„ƒZŠe<e2ƒd´dµ„ƒZ‹e<e3ƒd¶d·„ƒZŒe<eƒd¸d¹„ƒZ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
        filename, but the lexer will update it upon #line
        directives.
    cCs@||_||_||_||_d|_d|_t d¡|_t d¡|_    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_funcÚon_lbrace_funcÚon_rbrace_funcÚtype_lookup_funcÚfilenameÚ
last_tokenÚreÚcompileÚ line_patternÚpragma_pattern)Úselfrrr    r
©rúHd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\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)rÚlexer)rÚkwargsrrrÚbuild9sz CLexer.buildcCs d|j_dS)z? Resets the internal line number counter of the lexer.
        rN)rÚlineno©rrrrÚ reset_linenoCszCLexer.reset_linenocCs|j |¡dS©N)rÚinput)rÚtextrrrrHsz CLexer.inputcCs|j ¡|_|jSr)rÚtokenr rrrrrKs z CLexer.tokencCs|jj dd|j¡}|j|S)z3 Find the column of the token in its line.
        Ú
r)rÚlexdataÚrfindÚlexpos)rrZlast_crrrrÚfind_tok_columnOszCLexer.find_tok_columncCs0| |¡}| ||d|d¡|j d¡dS)Nrr)Ú_make_tok_locationrrÚskip)rÚmsgrÚlocationrrrÚ_errorZs
z CLexer._errorcCs|j| |¡fSr)rr$)rrrrrr%_szCLexer._make_tok_location)$ZAUTOZBREAKZCASEÚCHARZCONSTÚCONTINUEÚDEFAULTZDOÚDOUBLEÚELSEZENUMZEXTERNÚFLOATZFORZGOTOZIFZINLINEÚINTÚLONGZREGISTERZOFFSETOFZRESTRICTZRETURNÚSHORTZSIGNEDZSIZEOFZSTATICZSTRUCTZSWITCHZTYPEDEFZUNIONZUNSIGNEDZVOIDZVOLATILEZWHILEZ__INT128)Z_BOOLZ_COMPLEXZ    _NORETURNZ _THREAD_LOCALZ_STATIC_ASSERTZ_ATOMICZ_ALIGNOFZ_ALIGNASNé)DÚIDÚTYPEIDZ INT_CONST_DECZ INT_CONST_OCTZ INT_CONST_HEXZ INT_CONST_BINZINT_CONST_CHARZ FLOAT_CONSTZHEX_FLOAT_CONSTZ
CHAR_CONSTZ WCHAR_CONSTZ U8CHAR_CONSTZ U16CHAR_CONSTZ U32CHAR_CONSTZSTRING_LITERALZWSTRING_LITERALZU8STRING_LITERALZU16STRING_LITERALZU32STRING_LITERALÚPLUSÚMINUSZTIMESZDIVIDEZMODÚORÚANDZNOTZXORZLSHIFTZRSHIFTZLORZLANDZLNOTÚLTZLEÚGTZGEZEQZNEZEQUALSZ
TIMESEQUALZDIVEQUALZMODEQUALÚ    PLUSEQUALZ
MINUSEQUALZ LSHIFTEQUALZ RSHIFTEQUALZANDEQUALZXOREQUALZOREQUALZPLUSPLUSZ
MINUSMINUSZARROWZCONDOPÚLPARENÚRPARENÚLBRACKETÚRBRACKETÚLBRACEÚRBRACEÚCOMMAZPERIODÚSEMIÚCOLONÚELLIPSISÚPPHASHZPPPRAGMAÚ PPPRAGMASTRz[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]*z 0[0-7]*[89]z,([a-wyzA-Z._~!=&\^\-\\?'"]|x(?![0-9a-fA-F]))z (\d+)(?!\d)z(x[0-9a-fA-F]+)(?![0-9a-fA-F])z#([\\][^a-zA-Z._~^!=&\^\-\\?'"x0-9])z(\\(ú|z))z(\\[0-9a-zA-Z._~!=&\^\-\\?'"])z
([^'\\\n]|ú'ÚLÚu8ÚuÚUz{2,4}'z('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)ÚpppragmarTcCsf|jj|jj|jjdr2|j d¡d|_|_n0|jj|jj|jjdrX|j d¡n
d|_    |SdS)z[ \t]*\#)ÚposrSNrUrG)
rÚmatchrr!r#ÚbeginÚpp_lineÚ pp_filenamerÚtype©rÚtrrrÚt_PPHASH!s zCLexer.t_PPHASHcCs0|jdkr| d|¡n|j d¡ d¡|_dS)Nz$filename before line number in #linerP)rYr)ÚvalueÚlstripÚrstriprZr\rrrÚt_ppline_FILENAME/s
zCLexer.t_ppline_FILENAMEcCs|jdkr|j|_ndSr)rYr_r\rrrÚt_ppline_LINE_NUMBER6s
 
zCLexer.t_ppline_LINE_NUMBERcCsH|jdkr| d|¡n t|jƒ|j_|jdk    r8|j|_|j d¡dS)ú\nNzline number missing in #lineÚINITIAL)rYr)ÚintrrrZr rXr\rrrÚt_ppline_NEWLINE?s 
 
zCLexer.t_ppline_NEWLINEcCsdS)ÚlineNrr\rrrÚt_ppline_PPLINEKszCLexer.t_ppline_PPLINEz     cCs| d|¡dS)Nzinvalid #line directive©r)r\rrrÚt_ppline_errorQszCLexer.t_ppline_errorcCs |jjd7_|j d¡dS)rdrreN)rrrXr\rrrÚt_pppragma_NEWLINEWszCLexer.t_pppragma_NEWLINEcCs|S)Zpragmarr\rrrÚt_pppragma_PPPRAGMA\szCLexer.t_pppragma_PPPRAGMAcCs
d|_|S)z.+rH)r[r\rrrÚt_pppragma_STRbszCLexer.t_pppragma_STRcCs| d|¡dS)Nzinvalid #pragma directiverjr\rrrÚt_pppragma_errorgszCLexer.t_pppragma_errorcCs|jj|j d¡7_dS)z\n+r N)rrr_Úcountr\rrrÚ    t_NEWLINEpszCLexer.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)rr\rrrÚt_LBRACE¸szCLexer.t_LBRACEz\}cCs | ¡|Sr)r    r\rrrÚt_RBRACE¼szCLexer.t_RBRACEcCs|Srrr\rrrÚ t_FLOAT_CONSTÈszCLexer.t_FLOAT_CONSTcCs|Srrr\rrrÚt_HEX_FLOAT_CONSTÌszCLexer.t_HEX_FLOAT_CONSTcCs|Srrr\rrrÚt_INT_CONST_HEXÐszCLexer.t_INT_CONST_HEXcCs|Srrr\rrrÚt_INT_CONST_BINÔszCLexer.t_INT_CONST_BINcCsd}| ||¡dS)NzInvalid octal constantrj©rr]r'rrrÚt_BAD_CONST_OCTØszCLexer.t_BAD_CONST_OCTcCs|Srrr\rrrÚt_INT_CONST_OCTÝszCLexer.t_INT_CONST_OCTcCs|Srrr\rrrÚt_INT_CONST_DECászCLexer.t_INT_CONST_DECcCs|Srrr\rrrÚt_INT_CONST_CHARèszCLexer.t_INT_CONST_CHARcCs|Srrr\rrrÚ t_CHAR_CONSTìszCLexer.t_CHAR_CONSTcCs|Srrr\rrrÚ t_WCHAR_CONSTðszCLexer.t_WCHAR_CONSTcCs|Srrr\rrrÚt_U8CHAR_CONSTôszCLexer.t_U8CHAR_CONSTcCs|Srrr\rrrÚt_U16CHAR_CONSTøszCLexer.t_U16CHAR_CONSTcCs|Srrr\rrrÚt_U32CHAR_CONSTüszCLexer.t_U32CHAR_CONSTcCsd}| ||¡dS)Nz Unmatched 'rjr„rrrÚt_UNMATCHED_QUOTEszCLexer.t_UNMATCHED_QUOTEcCsd|j}| ||¡dS)NzInvalid char constant %s)r_r)r„rrrÚt_BAD_CHAR_CONSTs
zCLexer.t_BAD_CHAR_CONSTcCs|Srrr\rrrÚt_WSTRING_LITERAL
szCLexer.t_WSTRING_LITERALcCs|Srrr\rrrÚt_U8STRING_LITERALszCLexer.t_U8STRING_LITERALcCs|Srrr\rrrÚt_U16STRING_LITERALszCLexer.t_U16STRING_LITERALcCs|Srrr\rrrÚt_U32STRING_LITERALszCLexer.t_U32STRING_LITERALcCsd}| ||¡dS)Nz#String contains invalid escape coderjr„rrrÚt_BAD_STRING_LITERALszCLexer.t_BAD_STRING_LITERALcCs2|j |jd¡|_|jdkr.| |j¡r.d|_|S)Nr4r5)Ú keyword_mapÚgetr_r[r
r\rrrÚt_ID!sz CLexer.t_IDcCs"dt|jdƒ}| ||¡dS)NzIllegal character %sr)Úreprr_r)r„rrrÚt_error(szCLexer.t_error)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrrrrr$r)r%ÚkeywordsZ keywords_newr•ÚkeywordÚlowerÚupperÚtokensÚ
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_sequenceZescape_sequence_start_in_stringZ cconst_charZ
char_constZ wchar_constZ u8char_constZ u16char_constZ u32char_constZmulticharacter_constantZunmatched_quoteZbad_char_constZ string_charZstring_literalZwstring_literalZu8string_literalZu16string_literalZu32string_literalZbad_string_literalZ exponent_partZfractional_constantZfloating_constantZbinary_exponent_partZhex_fractional_constantZhex_floating_constantZstatesr^rrbrcrgriZt_ppline_ignorerkrlrmZt_pppragma_ignorernroZt_ignorerqZt_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_MODEQUALZ t_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_ELLIPSISr~rZt_STRING_LITERALr€rr‚rƒr…r†r‡rˆr‰rŠr‹rŒrrŽrrr‘r’r“r”r—r™rrrrrsJ!
 
& C       $
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
r)r ZplyrZply.lexrrrrrrrÚ<module>    s