tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
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
Y\¬Qc@sædZdZddgZddlZddlZddlZddlZddlZddlm    Z    m
Z
m Z m Z m Z defd„ƒYZd    deedd
„Zd „Zd „Zed krâejeeƒ ƒƒndS(sZParser driver.
 
This provides a high-level interface to parse a file into a syntax tree.
 
s#Guido van Rossum <guido@python.org>tDrivert load_grammariÿÿÿÿNi(tgrammartparsettokenttokenizetpgencBsVeZddd„Zed„Zed„Zed„Zded„Zed„Z    RS(cCs:||_|dkr$tjƒ}n||_||_dS(N(RtNonetloggingt    getLoggertloggertconvert(tselfRR R
((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/pgen2/driver.pyt__init__s
         cCs=tj|j|jƒ}|jƒd}d}d    }}}}    }
d} xé|D]Ã} | \}}}}    }
|||fkr
||f|ks¨t||f|fƒ‚|\} }|| krá| d| |7} | }d}n||kr
| |
||!7} |}q
n|tjtj    fkr`| |7} |    \}}|j
dƒrQ|d7}d}qQqQn|t j krtj |}n|r¨|jjdt j||| ƒn|j||| |fƒrà|rÜ|jjdƒnPnd} |    \}}|j
dƒrQ|d7}d}qQqQWtjd||| |fƒ‚|jS(
s4Parse a series of tokens and return the syntax tree.iius
s%s %r (prefix=%r)sStop.tsincomplete inputN(RtParserRR tsetupRtAssertionErrorRtCOMMENTtNLtendswithRtOPtopmapR
tdebugttok_nametaddtokent
ParseErrortrootnode(R ttokensRtptlinenotcolumnttypetvaluetstarttendt    line_texttprefixt    quintuplets_linenots_column((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/pgen2/driver.pyt parse_tokens&sT
 *        
 
      
     cCs"tj|jƒ}|j||ƒS(s*Parse a stream and return the syntax tree.(Rtgenerate_tokenstreadlineR)(R tstreamRR((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/pgen2/driver.pytparse_stream_rawVscCs|j||ƒS(s*Parse a stream and return the syntax tree.(R-(R R,R((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/pgen2/driver.pyt parse_stream[scCs;tj|d|ƒ}z|j||ƒSWd|jƒXdS(s(Parse a file and return the syntax tree.trN(tcodecstopenR.tclose(R tfilenametencodingRR,((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/pgen2/driver.pyt
parse_file_scCs+tjtj|ƒjƒ}|j||ƒS(s*Parse a string and return the syntax tree.(RR*tStringIOR+R)(R ttextRR((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/pgen2/driver.pyt parse_stringgsN(
t__name__t
__module__RR tFalseR)R-R.R5R8(((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/pgen2/driver.pyRs  0  s Grammar.txtc    Cs*|dkrtjƒ}n|dkr~tjj|ƒ\}}|dkrTd}n||djttt    j
ƒƒd}n|s”t ||ƒ r |j d|ƒt j|ƒ}|r&|j d|ƒy|j|ƒWq
tk
r}|j dt|ƒƒq
Xq&ntjƒ}|j|ƒ|S(    s'Load the grammar (maybe from a pickle).s.txtRt.s.pickles!Generating grammar tables from %ssWriting grammar tables to %ssWriting failed:N(RRR    tostpathtsplitexttjointmaptstrtsyst version_infot_newertinfoRtgenerate_grammartdumptIOErrorRtGrammartload(    tgttgptsavetforceR
theadttailtgte((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/pgen2/driver.pyRms&       *!  cCsNtjj|ƒstStjj|ƒs,tStjj|ƒtjj|ƒkS(s0Inquire whether file a was written since file b.(R=R>texistsR;tTruetgetmtime(tatb((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/pgen2/driver.pyRE†s
cGsc|stjd}ntjdtjdtjddƒx$|D]}t|dtdtƒq?WtS(sMain program, when run as a script: produce grammar pickle files.
 
    Calls load_grammar for each argument, a path to a grammar text file.
    itlevelR,tformats %(message)sRNRO(RCtargvRt basicConfigtINFOtstdoutRRU(targsRL((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/pgen2/driver.pytmains t__main__(t__doc__t
__author__t__all__R0R=RR6RCRRRRRRtobjectRRRUR;RRER`R9texittint(((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/pgen2/driver.pyt<module> s      (P