bBFjpddlmZddlmZddlmZejZejZejZGddeZ dS))tree)PythonTokenTypes) BaseParserceZdZdZidejdejdejdejdej dej dej d ej d ej d ej d ej d ej dej dejdej dej dejejejejejejejejejejejd ZejZejejejej ej!ej"ej#ej$ej%ej&ej'ej(ej)ej*iZ+dfd Z,fdZ-dZ.dZ/fdZ0dZ1dZ2xZ3S)Parserz This class is used to parse a Python file, it then divides them into a class structure of different scopes. :param pgen_grammar: The grammar object of pgen2. Loaded by load_grammar. expr_stmtclassdeffuncdef file_input import_name import_from break_stmt continue_stmt return_stmt raise_stmt yield_exprdel_stmt pass_stmt global_stmt nonlocal_stmt print_stmt assert_stmt) if_stmt with_stmtfor_stmt while_stmttry_stmt sync_comp_for decoratorlambdeflambdef_nocondnamedexpr_testTczt|||g|_g|_d|_dS)N)error_recoveryr)super__init__ syntax_errors_omit_dedent_list_indent_counter)self pgen_grammarr$start_nonterminal __class__s AC:\PYTHON\_runtimes\venv\Lib\site-packages\parso/python/parser.pyr&zParser.__init__@sL '8(6  8 8 8 !# c|jr'|jdkrt||}t |S)Nr )_error_recovery_start_nonterminalNotImplementedError_recovery_tokenizer%parse)r*tokensr-s r.r5z Parser.parseHsK   5&,66)),,V44Fww}}V$$$r/c |j||}n@#t$r3|dkr|dg|ddz}|||}YnwxYw|S)a  Convert raw node information to a PythonBaseNode instance. This is passed to the parser driver which calls it whenever a reduction of a grammar rule produces a new complete node, so that the tree is build strictly bottom-up. suiter)node_mapKeyError default_node)r* nonterminalchildrennodes r. convert_nodezParser.convert_nodeQs <-4=-h77DD < < <g%% %QK=8AbD>9$$[(;;DDD < s:AAc|tkr:||jjvrtj|||Stj|||S|j|tj|||S)N) NAME _pgen_grammarreserved_syntax_stringsrKeywordName _leaf_mapgetOperator)r*typevalueprefix start_poss r. convert_leafzParser.convert_leafesl 4<<*BBB|E9f===y 6:::6t~!!$ 66uiPPPr/c|jdj}|r|d}nd}|jdkr|jt jksD|jtkr|j ds|j ds|jdj j dkrz |jdj j t j }|jjr5|js.|j|jd_ ||dSn#t$$rYnwxYw|js!t)|Sd}||j}||dzr||nr|\}}} } |t.kr|j|jt7j|j|| | } |jdj| |jd} | jdkr+ | j jd | _ dS#t$$rYdSwxYwdS) Nr:r   simple_stmtcttt|D]7\}}|jdkrn&|jdkrt |jdkrn8|S)Nr r8)reversedlist enumerater>lennodes)stack until_index stack_nodes r. current_suitez,Parser.error_recovery..current_suitesu,4D59I9I4J4J+K+K  ' Z)\99E+w66:+,,11 r/rUr8stmt) r[rZ get_last_leafr2rKr ENDMARKERDEDENTrLendswithdfa from_rule transitionsNEWLINEnext_dfais_final dfa_pushes _add_tokenr<r1r%r$_stack_removalINDENTr(appendr)rPythonErrorLeafnamer>arcs)r*token tos_nodes last_leafplanr^r\typrLrNrM error_leaftosr-s r.r$zParser.error_recoveryoscJrN(  !" 3355III  "l 2 2/999J&((1I1I$1O1O("11$77) z"~!+}<< :b>-9:J:RSD}-do.2] 2*... D# 177))%00 0   $mDJ//   {Q / / 4 OOE " " " ",1 )C 6f}}&--d.BCCC-chy&QQJ JrN ' ' 3 3 3jn ?g % % ',v.     & %s$3'D D)(D) H99 IIcd|j|dD}|rz)Parser._stack_removal..s)bbbjQ[QabbTbbbbr/rU)r[rPythonErrorNoderZrnbool)r* start_index all_nodesr@s r.rlzParser._stack_removalsvbbDJ{||,Dbbb  ;' 22D J{Q ' - 4 4T : : :#% ;<< Ir/c#K|D]}|d}|tkrP|j}|r6|d|jkr%||xjdzc_T|xjdzc_n|tkr|xjdz c_|VdS)Nrr:rU)rbr(r)poprm)r*r6rrrvos r.r4zParser._recovery_tokenizes  E(Cf}}*2$"666EEGGG((A-(($$)$$$$$)$$KKKK  r/)Tr )4__name__ __module__ __qualname____doc__rExprStmtClassFunctionModule ImportName ImportFromKeywordStatement ReturnStmt YieldExpr GlobalStmt AssertStmtIfStmtWithStmtForStmt WhileStmtTryStmt SyncCompFor DecoratorLambda NamedExprr; PythonNoder=rSTRINGStringNUMBERNumberrgNewlinera EndMarkerFSTRING_STRING FStringString FSTRING_START FStringStart FSTRING_END FStringEndrHr&r5rArOr$rlr4 __classcell__)r-s@r.rr sWT]DJ 4= dk  t  t  d+ . t d+ dn D) T* t . d+!" t#$;]LnL)^;+.=H@?L  $,"DN');&(9$doI!!!!!!%%%%%(QQQDDDDDLr/rN) parso.pythonrparso.python.tokenr parso.parserrrCrmrbrr{r/r.rs//////######    CCCCCZCCCCCr/