
    hn                         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  \(       a  SSKJr  SSKJr  SSKJr  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+  SSK,J,r,J-r-J.r.J/r/J0r0J1r1  SSKJ2r2  SSK3J4r4J5r5J6r6J7r7  SSK8J9r9J:r:J;r;J<r<J=r=  SSK>J?r?  SSK!J@r@JArAJBrBJCrC  SSKDJErE   S SKFrFSrG " S S\5      rI " S S\(5      rJ1 SkrKSrLSrM\" SSS9rN " S S\(5      rOg! \H a    SrG 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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     \C:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\lark/lark.pyprocessPostLex.process)   s        r>   always_acceptN)__name__
__module____qualname____firstlineno__r   r	   r0   rA   rD   r   str__annotations____static_attributes__r>   rC   r@   r8   r8   (   s:    huo (5/   $&M8C=%rC   r8   c            	          \ rS rSr% Sr\\   \S'   \\S'   \\S'   S\S'   \	\\4   \S'   \\S	'   \	\\4   \S
'   \\S'   \
\S'   \\S'   \\\\/\4      \S'   \\S'   \\S'   S\S'   \\   \S'   S\S'   \\\\/\4   4   \S'   \\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"/ 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S2S'\\\4   4S- jjr\S.\\\4   S/\\
\	\\4   4   S'S 4S0 j5       rS1rg)3LarkOptions/   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ordered_setsedit_terminalszUList[Union[str, Callable[[Union[None, str, PackageResource], str], Tuple[str, str]]]]import_pathssource_patha7  
    **===  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 positional attributes into the 'meta' attribute of all tree branches.
            Sets attributes: (line, column, end_line, end_column, start_pos, end_pos,
                              container_line, container_column, container_end_line, container_end_column)
            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``.
    ordered_sets
            Should Earley use ordered-sets to achieve stable output (~10% slower than regular sets. Default: True)
    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   )rW   r`   ra   rc   rd   _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)rU   r`   rS   rO   options)re   lalrcykNre   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)dictrh   itemspop
isinstanceboolrI   __dict__r   rZ   rR   r   keys)r?   ri   ork   namedefaultvalues          r@   __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 rC   rv   c                 b     U R                   S   U   $ ! [         a  n[        U5      eS nAff = f)Nrk   )rs   KeyErrorAttributeError)r?   rv   es      r@   __getattr__LarkOptions.__getattr__   s6    	$==+D11 	$ ##	$s    
.).rx   c                 h    [        XR                  R                  5       S5        X R                  U'   g )Nz,%r isn't a valid option. Expected one of: %s)r   rk   rt   )r?   rv   rx   s      r@   __setattr__LarkOptions.__setattr__   s&    dLL--/1_`"TrC   c                     U R                   $ r=   rk   )r?   memos     r@   	serializeLarkOptions.serialize   s    ||rC   datar   c                     U " U5      $ r=   r>   )clsr   r   s      r@   deserializeLarkOptions.deserialize   s    4yrC   r>   r=   )rE   rF   rG   rH   __doc__r   rI   rJ   rr   r   intr   r
   r   r*   r+   r8   r   r0   r.   OPTIONS_DOCrh   ry   r   r   r   classmethodr6   r   rK   r>   rC   r@   rM   rM   /   s    9KL((tSy))sK3+s"2344AAg==#x7788OX{m[&@ABBii#LKZ ;!!%! 	5! 	d	!
 	! 	4! 	(! 	! 	t! 	! 	F! 	V! 	! 	u! 	2!  	d!!" 	$#!$ /!ItCH~ 4GT#s(^ G G:$ $ $# #C #D #S#X  tCH~ T#u[RVEV?W:W5X ]j  rC   rM   >
   rP   rV   r]   rg   r`   rY   rR   rW   r_   rS   )rf   normalinvertN)rf   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(...)
rd   source_grammarr#   grammarrk   r[   r   rZ   	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R                  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	N>f = f! [         a     G	N;f = 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=Truerl   z+cache only works with parser='lalr' for now)rR   r]   r_   rb   rg    c              3   T   >#    U  H  u  pUT;  d  M  U[        U5      -   v   M     g 7fr=   )rI   ).0kv
unhashables      r@   	<genexpr> Lark.__init__.<locals>.<genexpr>7  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.rf   
contextualre   z~postlex can't be used with the dynamic lexer, so we use 'basic' instead. Consider using lalr with contextual instead of earleybasicdynamicrm   )r   r   r   dynamic_completezGCan't use postlex with a dynamic lexer. Use basic or contextual insteadr   )re   rm   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   )r`   rQ   zSaving grammar to cache: %swbz!Failed to save Lark to cache: %r.)PrM   rk   rV   
_has_regexImportErrorrerd   rv   r}   readrq   rI   r   r`   isasciir   rU   rZ   joinro   r   r   sysversion_infor&   getpassgetuser	Exceptiontempfile
gettempdirr   openr    rP   set_LOAD_ALLOWED_OPTIONSreadlinerstrippickleloadencoder$   _loadFileNotFoundError	exceptionr!   rc   rX   r   r#   r[   r]   infotype
issubclassr,   r   r\   r^   _VALID_PRIORITY_OPTIONS_VALID_AMBIGUITY_OPTIONSrD   compilerO   r   rulesignore_tokensrb   _terminals_dictr(   r_   rW   rQ   
lexer_conf_build_parser_build_lexerwritedumpsaveIOError)r?   r   rk   	use_regex	re_moduler   cache_fncache_sha256options_strr   susernameold_optionsfrv   file_sha256cached_used_filescached_parser_data
used_filesr[   terminals_to_keeptruletermr~   r   s                            @r@   ry   Lark.__init__  sT   "7+ LL&&	z!	!"cddI <<##+.#*<<   $||77D	<<D fGgs##")||%%((,-^__||!!!<<&&&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   *g g g* h 5B6g=+h 4h 3i	
i !Ai7i gg
g'&g'*g:9g:=
hh h 
i&ii
ii i 
j)jjz

)rZ   r   rk   dont_ignorec                 h    U R                   nU(       a  SSKJn  U" U5      nSUl        [        U5      $ )Nr   )copyr>   )r   r   ignorer-   )r?   r   r   r   s       r@   r   Lark._build_lexer  s.    __
!j)J "J*%%rC   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   rl   r   )
_callbacksrk   r\   r1   r   rY   r'   rS   rZ   rT   _parse_tree_buildercreate_callbackrR   updater3   r   r?   s    r@   _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]^rC   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   r2   rk   rZ   r[   r)   r   r   rO   r5   r   )r?   parser_confs     r@   r   Lark._build_parser  s    ! 3 3T\\5G5GH T__dll>P>PQ*LLLLOOLL
 	
rC   exclude_optionsc                 R   U R                   R                  S:w  a  [        S5      e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.
rl   z7Lark.save() is only implemented for the LALR(1) parser.rk   r   r   )protocolN)
rk   rZ   NotImplementedErrormemo_serializer.   r6   ro   r   r   HIGHEST_PROTOCOL)r?   r   r   r   mnr   s          r@   r   	Lark.save  s    
 <<&(%&_``%%{D&9:04Y0E0E0Gd0G1Kctqt0GdDOT-q6;R;RS es    B#/B#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      r@   r   	Lark.load  s      {{3zz!}rC   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   r_   	callbacksrV   r   r   r`   rW   skip_validationr]   )r?   r   r   rk   r   s        r@   _deserialize_lexer_confLark._deserialize_lexer_conf  sr    **4+=tD
&66<"
(/u2
&00
#*#8#8
 %)
"$__
rC   r?   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   )r6   r.   rk   z6Some options are not allowed when loading a Parser: {}r   z<deserialized>rZ   )rq   rn   r   r   r   r   r6   r.   r   r   rM   rh   r   formatr   rk   r   rd   r2   rZ   r[   r  r   r   r   rv   r   r4   r   )
r?   r   kwargsd	memo_jsonr   r   rk   rr   s
             r@   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        r@   _load_from_dictLark._load_from_dict,  s'    {{3zz46A&AArC   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  rk   basepathr   s         r@   r   	Lark.open1  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=...)
Nrd   rc   )r"   
setdefaultappend)r   r%  r&  r'  rk   package_loader	full_pathtexts           r@   open_from_packageLark.open_from_packageC  s_     +7A(|<	=)4>2.&&~64#7##rC   c                     SU R                   < SU R                  R                  < SU R                  R                  < S3$ )Nz
Lark(open(z
), parser=z, lexer=z, ...))rd   rk   rZ   r[   r   s    r@   __repr__Lark.__repr__U  s,    =A=M=Mt||ObObdhdpdpdvdvwwrC   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[   r/   	from_textlexrk   r]   rA   )r?   r-  r   r[   lexer_threadr:   s         r@   r6  Lark.lexY  sy     tW%%%%k2EJJE",,U9!!$'<<<<''//77rC   rv   c                      U R                   U   $ )z Get information about a terminal)r   )r?   rv   s     r@   get_terminalLark.get_terminalk  s    ##D))rC   rO   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()``
)rO   )rZ   parse_interactive)r?   r-  rO   s      r@   r=  Lark.parse_interactiveo  s     {{,,T,??rC   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``.

)rO   r?  )rZ   parse)r?   r-  rO   r?  s       r@   rA  
Lark.parse}  s    $ {{  X FFrC   )r   r   r   r   r   r[   r   rk   rZ   r   r   rd   r   )r   zUnion[Grammar, str, IO[str]]r;   N)F)r;   N)r;   r   )r>   r=   )NN),rE   rF   rG   rH   r   rI   rJ   rM   r,   r   r.   ry   r   __serialize_fields__rr   r-   r   r   r   r   r   r   r   r   r   r   r   r   r6   r(   r  r   r  r   r   r.  r1  r	   r0   r6  r:  r=  rA  rK   r>   rC   r@   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rC   )P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   parser_frontendsr   
exceptionsr   r   r   utilsr   r   r   r    r!   r"   r#   r$   r%   r&   r'   commonr(   r)   r*   r+   r[   r,   r-   r.   r/   r0   parse_tree_builderr1   r2   r3   r4   r5   r   r6   rV   r   r   r8   rM   r   r   r   r   r   r>   rC   r@   <module>rO     s    #      	     B%1 J J ; ; u u  H H E E 0 H  H J&c &y) y| g < D  T ZG9 ZGi  Js   D DD