
    [l                     R   S SK JrJr  S SKrS SKrS SKrS SKrS SKrS SKrS SK	r	S SK
JrJrJrJrJrJrJrJrJrJrJrJrJrJrJr  \(       a5  SSKJr  SSKJr  SSKJr  \R@                  S:  a  S S	K
J!r!  OS S	K"J!r!  SS
K#J$r$  SSK%J&r&J'r'J(r(  SSK)J*r*J+r+J,r,J-r-J.r.  SSK/J/r/J0r0J1r1J2r2J3r3J4r4  SSKJ5r5  SSK6J7r7J8r8J9r9J:r:  SSK;J<r<J=r=J>r>J?r?J@r@  SSKAJBrB  SSK#JCrCJDrDJErEJFrF  SSKGJHrH   S SKIrISrJ " S S\5      rL " S S\*5      rM1 SkrNSrOSrP\" SSS9rQ " S  S\*5      rRg! \K a    SrJ N;f = f)!    )ABCabstractmethodN)TypeVarTypeListDictIteratorCallableUnionOptionalSequenceTupleIterableIOAnyTYPE_CHECKING
Collection   )InteractiveParser)	ParseTree)Transformer)      )Literal)ParsingFrontend)ConfigurationErrorassert_configUnexpectedInput)	SerializeSerializeMemoizerFSisasciilogger)load_grammarFromPackageLoaderGrammarverify_used_filesPackageResourcesha256_digest)Tree)	LexerConf
ParserConf_ParserArgType_LexerArgType)Lexer
BasicLexerTerminalDefLexerThreadToken)ParseTreeBuilder)_validate_frontend_args_get_lexer_callbacks_deserialize_parsing_frontend_construct_parsing_frontend)RuleTFc                   R    \ rS rSr% \S\\   S\\   4S j5       rSr\	\
   \S'   Srg)PostLex+   streamreturnc                     U$ N )selfr=   s     lib/third_party/lark/lark.pyprocessPostLex.process,   s        rA   always_acceptN)__name__
__module____qualname____firstlineno__r   r	   r3   rD   rG   r   str__annotations____static_attributes__rA   rF   rC   r;   r;   +   s:    huo (5/   $&M8C=%rF   r;   c            	          \ rS rSr% Sr\\   \S'   \\S'   \\S'   S\S'   \	\\4   \S'   \\S	'   \	\\4   \S
'   \\S'   \
\S'   \\S'   \\S'   \\S'   \\S'   S\S'   \\   \S'   S\S'   \\\\/\4   4   \S'   \\S'   \\\/\4      \S'   S\S'   \\   \S'   Sr\(       a  \\-  r0 SS_SS_SS_SS_S
S_SS_SS_SS _SS_SS_SS _SS _SS_SS_S0 _S	S!_SS_S"S/ S0 S#.Er\\\4   \S$'   S%\\\4   S&S4S' jrS(\S&\4S) jrS(\S*\S&S4S+ jrS1S&\\\4   4S, jjr\S-\\\4   S.\\
\	\\4   4   S&S 4S/ j5       rS0rg)2LarkOptions2   z$Specifies the options for Lark

    startdebugstrictzOptional[Transformer]transformerpropagate_positionsmaybe_placeholderscacheregexg_regex_flagskeep_all_tokens
tree_classparserlexerz0Literal["auto", "resolve", "explicit", "forest"]	ambiguitypostlexz-Optional[Literal["auto", "normal", "invert"]]prioritylexer_callbacks	use_bytesedit_terminalszUList[Union[str, Callable[[Union[None, str, PackageResource], str], Tuple[str, str]]]]import_pathssource_patha  
    **===  General Options  ===**

    start
            The start symbol. Either a string, or a list of strings for multiple possible starts (Default: "start")
    debug
            Display debug information and extra warnings. Use only when debugging (Default: ``False``)
            When used with Earley, it generates a forest graph as "sppf.png", if 'dot' is installed.
    strict
            Throw an exception on any potential ambiguity, including shift/reduce conflicts, and regex collisions.
    transformer
            Applies the transformer to every parse tree (equivalent to applying it after the parse, but faster)
    propagate_positions
            Propagates (line, column, end_line, end_column) attributes into all tree branches.
            Accepts ``False``, ``True``, or a callable, which will filter which nodes to ignore when propagating.
    maybe_placeholders
            When ``True``, the ``[]`` operator returns ``None`` when not matched.
            When ``False``,  ``[]`` behaves like the ``?`` operator, and returns no value at all.
            (default= ``True``)
    cache
            Cache the results of the Lark grammar analysis, for x2 to x3 faster loading. LALR only for now.

            - When ``False``, does nothing (default)
            - When ``True``, caches to a temporary file in the local directory
            - When given a string, caches to the path pointed by the string
    regex
            When True, uses the ``regex`` module instead of the stdlib ``re``.
    g_regex_flags
            Flags that are applied to all terminals (both regex and strings)
    keep_all_tokens
            Prevent the tree builder from automagically removing "punctuation" tokens (Default: ``False``)
    tree_class
            Lark will produce trees comprised of instances of this class instead of the default ``lark.Tree``.

    **=== Algorithm Options ===**

    parser
            Decides which parser engine to use. Accepts "earley" or "lalr". (Default: "earley").
            (there is also a "cyk" option for legacy)
    lexer
            Decides whether or not to use a lexer stage

            - "auto" (default): Choose for me based on the parser
            - "basic": Use a basic lexer
            - "contextual": Stronger lexer (only works with parser="lalr")
            - "dynamic": Flexible and powerful (only with parser="earley")
            - "dynamic_complete": Same as dynamic, but tries *every* variation of tokenizing possible.
    ambiguity
            Decides how to handle ambiguity in the parse. Only relevant if parser="earley"

            - "resolve": The parser will automatically choose the simplest derivation
              (it chooses consistently: greedy for tokens, non-greedy for rules)
            - "explicit": The parser will return all derivations wrapped in "_ambig" tree nodes (i.e. a forest).
            - "forest": The parser will return the root of the shared packed parse forest.

    **=== Misc. / Domain Specific Options ===**

    postlex
            Lexer post-processing (Default: ``None``) Only works with the basic and contextual lexers.
    priority
            How priorities should be evaluated - "auto", ``None``, "normal", "invert" (Default: "auto")
    lexer_callbacks
            Dictionary of callbacks for the lexer. May alter tokens during lexing. Use with caution.
    use_bytes
            Accept an input of type ``bytes`` instead of ``str``.
    edit_terminals
            A callback for editing the terminals before parse.
    import_paths
            A List of either paths or loader functions to specify from where grammars are imported
    source_path
            Override the source of from where the grammar was loaded. Useful for relative imports and unconventional grammar loading
    **=== End of Options ===**
    FNearleyautoTr   )rZ   rc   re   rf   _plugins	_defaultsoptions_dictr>   c                    [        U5      n0 nU R                  R                  5        HH  u  pEXB;   a8  UR                  U5      n[	        U[
        5      (       a  US;  a  [        U5      nOUnXcU'   MJ     [	        US   [        5      (       a	  US   /US'   X0R                  S'   [        U R                  S5        U R                  S:X  a  U R                  (       a  [        S5      eU(       a  [        SUR                  5       -  5      eg )N)rX   rc   rV   rR   options)rg   lalrcykNrg   zCannot specify an embedded transformer when using the Earley algorithm. Please use your transformer on the resulting parse tree, or use a different algorithm (i.e. LALR)zUnknown options: %s)dictrj   itemspop
isinstanceboolrL   __dict__r   r]   rU   r   keys)rB   rk   orm   namedefaultvalues          rC   __init__LarkOptions.__init__   s    !^^113MDydgt,,=j1j KE!DM 4 gg&,, ' 01GG#*i  	dkk#BC;;("t'7'7$ &A B B $%:QVVX%EFF rF   rx   c                 b     U R                   S   U   $ ! [         a  n[        U5      eS nAff = f)Nrm   )ru   KeyErrorAttributeError)rB   rx   es      rC   __getattr__LarkOptions.__getattr__   s6    	$==+D11 	$ ##	$s    
.).rz   c                 h    [        XR                  R                  5       S5        X R                  U'   g )Nz,%r isn't a valid option. Expected one of: %s)r   rm   rv   )rB   rx   rz   s      rC   __setattr__LarkOptions.__setattr__   s&    dLL--/1_`"TrF   c                     U R                   $ r@   rm   )rB   memos     rC   	serializeLarkOptions.serialize   s    ||rF   datar   c                     U " U5      $ r@   rA   )clsr   r   s      rC   deserializeLarkOptions.deserialize   s    4yrF   rA   r@   )rH   rI   rJ   rK   __doc__r   rL   rM   rt   r   intr   r-   r.   r   r;   r   r
   r3   r1   OPTIONS_DOCrj   r{   r   r   r   classmethodr9   r   rN   rA   rF   rC   rP   rP   2   sy    9KL((tSy))sKOAAg==#x7788OX{m[&@ABBii#HKR ;!!%! 	5! 	d	!
 	! 	4! 	(! 	! 	t! 	! 	F! 	V! 	! 	u! 	2!  	d!!" 	$#!$ -!ItCH~ 2GT#s(^ G G:$ $ $# #C #D #S#X  tCH~ T#u[RVEV?W:W5X ]j  rF   rP   >
   rS   rY   r`   ri   rc   r\   rU   rZ   rb   rV   )rh   normalinvertN)rh   resolveexplicitforest_TLark)boundc                   X   \ rS rSr% Sr\\S'   \\S'   S\S'   \\S'   \\S'   S	\S
'   \	\
   \S'   S6S jr\(       a  \S\R                  -   -  rSrS7S\S\4S jjrS8S jrS9S jrS:S\	\   SS4S jjr\S\\   S\4S j5       rS\\\4   S\\\\
\4   4   S\S\4S jrS\S\S\4S jr\S 5       r \S;S\\   S \S!\!\   S\4S" jj5       r"\S#/4S\\   S$\S%\S&S'S\4
S( jj5       r#S) r$S7S*\S\S\%\&   4S+ jjr'S,\S\
4S- jr(S<S*\!\   S.\!\   SS/4S0 jjr)S<S*\S.\!\   S1S2SS34S4 jjr*S5r+g)=r      a]  Main interface for the library.

It's mostly a thin wrapper for the many different parsers, and for the tree constructor.

Parameters:
    grammar: a string or file-object containing the grammar spec (using Lark's ebnf syntax)
    options: a dictionary controlling various aspects of Lark.

Example:
    >>> Lark(r'''start: "foo" ''')
    Lark(...)
rf   source_grammarr&   grammarrm   r^   r   r]   	terminalsr>   Nc                   ^ [        U5      U l        U R                  R                  nU(       a  [        (       a  [        nO[	        S5      e[
        nU R                  R                  c   UR                  U l        OU R                  R                  U l         UR                  nU" 5       nS nS n[        U[        5      (       Ga  Xl        U R                  R                  (       a  [        U5      (       d  [        S5      eU R                  R                   (       Ga  U R                  R"                  S:w  a  [        S5      eSmSR%                  U4S jUR'                  5        5       5      nS	S
KJn	  X-   U	-   [        [,        R.                  S S 5      -   n
[1        U
5      n[        U R                  R                   [        5      (       a  U R                  R                   nOjU R                  R                   SLa  [        S5      e [2        R4                  " 5       n[8        R:                  " 5       SX/[,        R.                  S S Q7-  -   nU R                  n [<        R>                  " US5       n[@        RB                  " SU5        [E        U5      [F        -
   H  nX.	 M     URI                  5       RK                  S5      n[L        RN                  " U5      nXRQ                  S5      :X  aC  [S        U5      (       a3  [L        RN                  " U5      nU RT                  " U40 UD6   S S S 5        g S S S 5        [[        XR                  U R                  R\                  U R                  R^                  5      u  U l0        nO[        U[b        5      (       d   eXl0        U R                  Rd                  S:X  a  U R                  R"                  S:X  a  SU R                  l2        OU R                  R"                  S:X  aQ  U R                  Rf                  b(  [@        Rh                  " S5        SU R                  l2        OYSU R                  l2        OGU R                  R"                  S:X  a  SU R                  l2        O U R                  R"                  5       eU R                  Rd                  n[        U[j        5      (       a  [m        U[n        5      (       d   eO4[q        US5        U R                  Rf                  b  SU;   a  [        S5      eU R                  Rr                  S:X  a,  U R                  R"                  S:X  a  SU R                  l9        O![q        U R                  R"                  SS 5        U R                  Rt                  S:X  a  S!U R                  l:        U R                  Rt                  [v        ;  a+  [        S"U R                  Rt                  < S#[v        < 35      eU R                  Rr                  [x        ;  a+  [        S$U R                  Rr                  < S#[x        < 35      eU R                  R"                  c  S%nOKU R                  Rf                  b*  [E        U R                  Rf                  Rz                  5      nO
[E        5       nU R`                  R}                  U R                  R~                  U5      u  U l@        U lA        U lB        U R                  R                  (       a.  U R                   H  nU R                  R                  U5        M      U R                   Vs0 s H  nUR                  U_M     snU lD        U R                  Rt                  S&:X  ax  U R                   HB  nUR                  Rt                  c  M  UR                  Rt                  * UR                  l:        MD     U R                   H  nURt                  * Ul:        M     OnU R                  Rt                  cW  U R                   H-  nUR                  Rt                  c  M  S UR                  l:        M/     U R                   H
  nS'Ul:        M     [        U R                  X@R                  U R                  Rf                  U R                  R                  U R                  R                  U R                  R                  U R                  R                  S(9U lI        U R                  R"                  (       a  U R                  5       U l        OU(       a  U R                  5       U l2        U(       a  [@        RB                  " S)U5         [<        R>                  " US*5       nUc   eUR                  URQ                  S5      S-   5        [L        R                  " WU5        U R                  U[F        5        S S S 5        g g ! [         a    SU l         G	N9f = f! [         a     G	N6f = f! [6         a    Sn GNf = f! , (       d  f       GN= f! [V         a     GN[6         a!    [@        RX                  " SU5        Xl         GN	f = fs  snf ! , (       d  f       g = f! [         a"  n[@        RX                  " S+UU5         S nAg S nAff = f),Nz?`regex` module must be installed if calling `Lark(regex=True)`.z<string>z/Grammar must be ascii only, when use_bytes=Truern   z+cache only works with parser='lalr' for now)rU   r`   rb   rd   ri    c              3   T   >#    U  H  u  pUT;  d  M  U[        U5      -   v   M     g 7fr@   )rL   ).0kv
unhashables      rC   	<genexpr> Lark.__init__.<locals>.<genexpr>4  s%     %b?41aWaNahaAh?s   ((r   )__version__   Tz"cache argument must be bool or strunknownz/.lark_cache_%s_%s_%s_%s.tmprbzLoading grammar from cache: %s   
utf8z<Failed to load Lark from cache: %r. We will try to carry on.rh   
contextualrg   z~postlex can't be used with the dynamic lexer, so we use 'basic' instead. Consider using lalr with contextual instead of earleybasicdynamicro   )r   r   r   dynamic_completezGCan't use postlex with a dynamic lexer. Use basic or contextual insteadr   )rg   ro   zG%r doesn't support disambiguation. Use one of these parsers instead: %sr   zinvalid priority option: z. Must be one of zinvalid ambiguity option: *r   r   )rc   rT   zSaving grammar to cache: %swbz!Failed to save Lark to cache: %r.)PrP   rm   rY   
_has_regexImportErrorrerf   rx   r   readrs   rL   r   rc   r"   r   rX   r]   joinrq   r   r   sysversion_infor)   getpassgetuser	Exceptiontempfile
gettempdirr!   openr#   rS   set_LOAD_ALLOWED_OPTIONSreadlinerstrippickleloadencoder'   _loadFileNotFoundError	exceptionr$   re   r[   r   r&   r^   r`   infotype
issubclassr/   r   r_   ra   _VALID_PRIORITY_OPTIONS_VALID_AMBIGUITY_OPTIONSrG   compilerR   r   rulesignore_tokensrd   _terminals_dictr+   rb   rZ   rT   
lexer_conf_build_parser_build_lexerwritedumpsaveIOError)rB   r   rm   	use_regex	re_moduler   cache_fncache_sha256options_strr   susernameold_optionsfrx   file_sha256cached_used_filescached_parser_data
used_filesr^   terminals_to_keeptruletermr   r   s                            @rC   r{   Lark.__init__  sR   "7+ LL&&	z!	!"cddI <<##+.#*<<   $||77D	<<D fGgs##")||%%w'',-^__||!!!<<&&&0,-Z[[h
 gg%b7==?%bb))K7#c>N>NrPQ>R:SS,Q/dll00#66#||11H||))501UVV-#*??#4  (2247UYa  YHru  sC  sC  DF  EF  sG  YH  8H   HH"ll/40A%ExP%(\4I%ID ' &J&'jjl&9&9%&@,2KKN)&*=*=f*EEJ[\mJnJn17Q. JJ'9EWE" 100. (4G=M=Mt||OhOhjnjvjv  kG  kG  (H$DL*gw////"L <<'||""f,%1"$$0<<''3KK !X Y)0DLL&)2DLL&$$-%,"1dll111u""eT""eU++++%!WX||##/I4F()rss<<!!V+||""h.)2&$,,--/@  CL  M<<  F*$,DLL!<<  (??$Y]YeYeYnYn  qH  &I  J  J<<!!)AA$Z^ZfZfZpZp  sK  &L  M  M<<& #\\!!- #DLL$8$8$F$F G # :>9M9MdllN`N`bs9t6
D$6<<&&^^++A. $ 48>>B>a	>B <<  H,

<<((4-1\\-B-B,BDLL) # !% '
 \\""*

<<((4,0DLL) #  ! ' $	+=+=t||?S?S,,dll.H.HTXT`T`TjTjswss  tG  tG
 <<,,.DK**,DJLL6ASWWXt,'333GGL//7%?@KK
A.IIa!67	 -, } " .#- .  		> % - $-	- 10 )   /$$%cemn $/L/B  CB -,
  S  !DhPQRRSs   *f< g g% h
 0B6g8&h
 /h
 .ii Ai	2i <gg
g"!g"%g54g58
hh
 h
 

i&i i	
ii i 
j$jjz

)r]   r   rm   dont_ignorec                 h    U R                   nU(       a  SSKJn  U" U5      nSUl        [        U5      $ )Nr   )copyrA   )r   r   ignorer0   )rB   r   r   r   s       rC   r   Lark._build_lexer  s.    __
!j)J "J*%%rF   c                 p   0 U l         U R                  R                  S:w  a  [        U R                  U R                  R
                  =(       d    [        U R                  R                  U R                  R                  S:g  =(       a    U R                  R                  S:H  U R                  R                  5      U l
        U R                  R                  U R                  R                  5      U l         U R                   R                  [        U R                  R                  U R                  5      5        g )Nr   rn   r   )
_callbacksrm   r_   r4   r   r\   r*   rV   r]   rW   _parse_tree_buildercreate_callbackrU   updater6   r   rB   s    rC   _prepare_callbacksLark._prepare_callbacks  s    <<!!X-'7JJLL++3tLL44LL''61Zdll6L6LPZ6ZLL33(D$ #66FFt||G_G_`DO3DLL4L4Ldnn]^rF   c                    U R                  5         [        U R                  R                  U R                  R                  5        [        U R                  U R                  U R                  R                  5      n[        U R                  R                  U R                  R                  U R                  UU R                  S9$ )Nr   )r   r5   rm   r]   r^   r,   r   r   rR   r8   r   )rB   parser_confs     rC   r   Lark._build_parser  s    ! 3 3T\\5G5GH T__dll>P>PQ*LLLLOOLL
 	
rF   exclude_optionsc                    U R                  [        [        /5      u  p4U(       a2  US   R                  5        VVs0 s H  u  pVXR;  d  M  XV_M     snnUS'   [        R
                  " X4S.U[        R                  S9  gs  snnf )zWSaves the instance into the given file object

Useful for caching and multiprocessing.
rm   r   r   )protocolN)memo_serializer1   r9   rq   r   r   HIGHEST_PROTOCOL)rB   r   r   r   mnr   s          rC   r   	Lark.save  so    
 %%{D&9:04Y0E0E0Gd0G1Kctqt0GdDOT-q6;R;RS es   A>
A>r   c                 F    U R                  U 5      nUR                  U5      $ )zVLoads an instance from the given file object

Useful for caching and multiprocessing.
__new__r   )r   r   insts      rC   r   	Lark.load  s      {{3zz!}rF   r   r   c                 &   [         R                  " US   U5      nUR                  =(       d    0 Ul        UR                  (       a  [        O[
        Ul        UR                  Ul        UR                  Ul        SUl	        UR                  Ul
        U$ )Nr   T)r+   r   rb   	callbacksrY   r   r   rc   rZ   skip_validationr`   )rB   r   r   rm   r   s        rC   _deserialize_lexer_confLark._deserialize_lexer_conf  sr    **4+=tD
&66<"
(/u2
&00
#*#8#8
 %)
"$__
rF   rB   r   c                 >   [        U[        5      (       a  UnO[        R                  " U5      nUS   nUS   nU(       d   e[        R
                  " U[        [        S.0 5      n[        US   5      n[        U5      [        -
  [        [        R                  5      -  (       a*  [        SR                  [        U5      [        -
  5      5      eUR                  U5        [        R                  Xv5      U l        US    Vs/ s H  n[        R
                  " X5      PM     snU l        SU l        [%        U R                  R&                  U R                  R(                  5        U R+                  US   X`R                  5      U l        U R,                  R.                  U l        U R1                  5         U R.                   V	s0 s H  oR2                  U	_M     sn	U l        [7        US   UU R,                  U R8                  U R                  5      U l        U $ s  snf s  sn	f )	Nr   r   )r9   r1   rm   z6Some options are not allowed when loading a Parser: {}r   z<deserialized>r]   )rs   rp   r   r   r    r   r9   r1   r   r   rP   rj   r   formatr   rm   r   rf   r5   r]   r^   r  r   r   r   rx   r   r7   r   )
rB   r   kwargsd	memo_jsonr   r   rm   rr   s
             rC   r   
Lark._load  s   aAAAfI	yy ,,YVa8bdfgtI'K//3{7L7L3MM$%]$fS[3H%HIK Kv"..w=9=gGAd&&q/G
+ 3 3T\\5G5GH66tH~t\\Z22!37>>B>a	>B3NOOOOLL
  H  Cs     H Hc                 N    U R                  U 5      nUR                  " XS.40 UD6$ )Nr  r	  )r   r   r   r  r  s        rC   _load_from_dictLark._load_from_dict'  s'    {{3zz46A&AArF   grammar_filenamerel_toc                     U(       a>  [         R                  R                  U5      n[         R                  R                  XA5      n[	        USS9 nU " U40 UD6sSSS5        $ ! , (       d  f       g= f)zCreate an instance of Lark with the grammar given by its filename

If ``rel_to`` is provided, the function will find the grammar filename in relation to it.

Example:

    >>> Lark.open("grammar_file.lark", rel_to=__file__, parser="lalr")
    Lark(...)

r   )encodingN)ospathdirnamer   r   )r   r  r  rm   basepathr   s         rC   r   	Lark.open,  sR     wwv.H!ww||HG"V4q$G$ 544s   	A##
A1r   packagegrammar_pathsearch_pathszSequence[str]c                     [        X5      nU" SU5      u  pgUR                  SU5        UR                  S/ 5        US   R                  U5        U " U40 UD6$ )aC  Create an instance of Lark with the grammar loaded from within the package `package`.
This allows grammar loading from zipapps.

Imports in the grammar will use the `package` and `search_paths` provided, through `FromPackageLoader`

Example:

    Lark.open_from_package(__name__, "example.lark", ("grammars",), parser=...)
Nrf   re   )r%   
setdefaultappend)r   r%  r&  r'  rm   package_loader	full_pathtexts           rC   open_from_packageLark.open_from_package>  s_     +7A(|<	=)4>2.&&~64#7##rF   c                     SU R                   < SU R                  R                  < SU R                  R                  < S3$ )Nz
Lark(open(z
), parser=z, lexer=z, ...))rf   rm   r]   r^   r   s    rC   __repr__Lark.__repr__P  s,    =A=M=Mt||ObObdhdpdpdvdvwwrF   r-  c                 @   [        U S5      (       a  U(       a  U R                  U5      nOU R                  n[        R                  " X15      nUR                  S5      nU R                  R                  (       a%  U R                  R                  R                  U5      $ U$ )zOnly lex (and postlex) the text, without parsing it. Only relevant when lexer='basic'

When dont_ignore=True, the lexer will return all tokens, even those marked for %ignore.

:raises UnexpectedCharacters: In case the lexer cannot find a suitable match.
r^   N)	hasattrr   r^   r2   	from_textlexrm   r`   rD   )rB   r-  r   r^   lexer_threadr=   s         rC   r6  Lark.lexT  sy     tW%%%%k2EJJE",,U9!!$'<<<<''//77rF   rx   c                      U R                   U   $ )z Get information about a terminal)r   )rB   rx   s     rC   get_terminalLark.get_terminalf  s    ##D))rF   rR   r   c                 4    U R                   R                  XS9$ )zStart an interactive parsing session.

Parameters:
    text (str, optional): Text to be parsed. Required for ``resume_parse()``.
    start (str, optional): Start symbol

Returns:
    A new InteractiveParser instance.

See Also: ``Lark.parse()``
)rR   )r]   parse_interactive)rB   r-  rR   s      rC   r=  Lark.parse_interactivej  s     {{,,T,??rF   on_errorz+Optional[Callable[[UnexpectedInput], bool]]r   c                 6    U R                   R                  XUS9$ )aR  Parse the given text, according to the options provided.

Parameters:
    text (str): Text to be parsed.
    start (str, optional): Required if Lark was given multiple possible start symbols (using the start option).
    on_error (function, optional): if provided, will be called on UnexpectedToken error. Return true to resume parsing.
        LALR only. See examples/advanced/error_handling.py for an example of how to use on_error.

Returns:
    If a transformer is supplied to ``__init__``, returns whatever is the
    result of the transformation. Otherwise, returns a Tree instance.

:raises UnexpectedInput: On a parse error, one of these sub-exceptions will rise:
        ``UnexpectedCharacters``, ``UnexpectedToken``, or ``UnexpectedEOF``.
        For convenience, these sub-exceptions also inherit from ``ParserError`` and ``LexerError``.

)rR   r?  )r]   parse)rB   r-  rR   r?  s       rC   rA  
Lark.parsex  s    $ {{  X FFrF   )r   r   r   r   r   r^   r   rm   r]   r   r   rf   r   )r   zUnion[Grammar, str, IO[str]]r>   N)F)r>   N)r>   r   )rA   r@   )NN),rH   rI   rJ   rK   r   rL   rM   rP   r/   r   r1   r{   r   __serialize_fields__rt   r0   r   r   r   r   r   r   r   r   r   r   r   r   r9   r+   r  r   r  r   r   r.  r1  r	   r3   r6  r:  r=  rA  rN   rA   rF   rC   r   r      sC    L+&&ySv 6K33337& &z &_

Tz# T T $r( "  DcN $sER]_cRcLdGdBe p{   AJ B 3 R @ B B %$r( %c %8C= %]_ % %" ikhl $tBx $# $S $Xg $|~ $ $"x $ % $* * *@hsm @# @Xk @G# Ghsm GDq G  |G G GrF   )Sabcr   r   r   r   r   r   r   typesr   typingr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   parsers.lalr_interactive_parserr   treer   visitorsr   r   r   typing_extensionsparser_frontendsr   
exceptionsr   r   r   utilsr   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   commonr+   r,   r-   r.   r^   r/   r0   r1   r2   r3   parse_tree_builderr4   r5   r6   r7   r8   r   r9   rY   r   r   r;   rP   r   r   r   r   r   rA   rF   rC   <module>rP     s    #      	     B%
6!"-1 J J D D u u  H H E E 0 H  H J&c &s) sp g < D  T XG9 XG]  Js   $D D&%D&