
    Mis                     (   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+J,r,J-r-  SSK.J.r.J/r/J0r0J1r1J2r2J3r3  SSKJ4r4  SSK5J6r6J7r7J8r8J9r9  SSK:J;r;J<r<J=r=J>r>J?r?  SSK@JArA  SSK!JBrBJCrCJDrDJErE  SSKFJGrG   S SKHrHSrI " S S\5      rK " S S\(5      rL1 SkrMSrNSrO\" SSS9rP " S S\(5      rQg! \J a    SrI 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TextOrSlice	LarkInput)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/var/www/eduai.edurigo.com/storigo/production/storigo_env/lib/python3.13/site-packages/lark/lark.pyprocessPostLex.process)   s        r@   always_acceptN)__name__
__module____qualname____firstlineno__r   r	   r2   rC   rF   r   str__annotations____static_attributes__r@   rE   rB   r:   r:   (   s:    huo (5/   $&M8C=%rE   r:   c            	          \ rS rSr% Sr\\   \S'   \\S'   \\S'   S\S'   \	\\4   \S'   \\S	'   \	\\4   \S
'   \\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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S3S(\\\4   4S. jjr\S/\\\4   S0\\
\	\\4   4   S(S 4S1 j5       rS2rg )4LarkOptions/   z$Specifies the options for Lark

    startdebugstrictzOptional[Transformer]transformerpropagate_positionsmaybe_placeholderscachecache_grammar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_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 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
    cache_grammar
            For use with ``cache`` option. When ``True``, the unanalyzed grammar is also included in the cache.
            Useful for classes that require the ``Lark.grammar`` to be present (e.g. Reconstructor).
            (default= ``False``)
    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   )re   rZ   rc   rd   rf   rg   _plugins	_defaultsoptions_dictr=   c                 l   [        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 R                  (       a  U R                  (       d  [        S5      eU(       a  [        SUR                  5       -  5      eg )	N)rW   rc   rU   rQ   options)rh   lalrcykNrh   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)z2cache_grammar cannot be set when cache is disabledzUnknown options: %s)dictrk   itemspop
isinstanceboolrK   __dict__r   r]   rT   r   rX   rW   keys)rA   rl   orn   namedefaultvalues          rB   __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 djj$%YZZ$%:QVVX%EFF rE   ry   c                 b     U R                   S   U   $ ! [         a  n[        U5      eS nAff = f)Nrn   )rv   KeyErrorAttributeError)rA   ry   es      rB   __getattr__LarkOptions.__getattr__   s6    	$==+D11 	$ ##	$s    
.).r{   c                 h    [        XR                  R                  5       S5        X R                  U'   g )Nz,%r isn't a valid option. Expected one of: %s)r   rn   rw   )rA   ry   r{   s      rB   __setattr__LarkOptions.__setattr__   s&    dLL--/1_`"TrE   c                     U R                   $ r?   rn   )rA   memos     rB   	serializeLarkOptions.serialize   s    ||rE   datar   c                     U " U5      $ r?   r@   )clsr   r   s      rB   deserializeLarkOptions.deserialize   s    4yrE   r@   r?   )rG   rH   rI   rJ   __doc__r   rK   rL   ru   r   intr   r
   r   r,   r-   r:   r   r2   r0   OPTIONS_DOCrk   r|   r   r   r   classmethodr8   r   rM   r@   rE   rB   rO   rO   /   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#PKb ;!!%! 	5! 	d	!
 	! 	! 	4! 	(! 	! 	t! 	! 	F! 	V! 	! 	u!  	2!!" 	d#!$ 1!ItCH~ 6GT#s(^ G G@$ $ $# #C #D #S#X  tCH~ T#u[RVEV?W:W5X ]j  rE   rO   >
   rR   rY   r`   rj   rc   r\   rT   rZ   rb   rU   )ri   normalinvertN)ri   resolveexplicitforest_TLark)boundc                   \   \ rS rSr% Sr\\S'   \\S'   S\S'   \\S'   \\S'   S	\S
'   \	\
   \S'   / SQrS6S jr\(       a  \S\R                  -   -  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(...)
rg   source_grammarr%   grammarrn   r^   r   r]   	terminals)r]   rulesrn   r=   Nc                   ^ [        U5      U l        U R                  R                  (       a  U R                  S/-   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a8  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	-   [        [0        R2                  S S 5      -   n
[5        U
5      n[        U R                  R$                  [        5      (       a  U R                  R$                  nOU R                  R$                  SLa  [#        S5      e [6        R8                  " 5       n[<        R>                  " 5       SU R                  R                  (       a  SOSX/[0        R2                  S S Q7-  -   nU R                  n [@        RB                  " US5       n[D        RF                  " SU5        [I        U5      [J        -
   H  nX.	 M     URM                  5       RO                  S5      n[P        RR                  " U5      nXRU                  S5      :X  aC  [W        U5      (       a3  [P        RR                  " U5      nU RX                  " U40 UD6   S S S 5        g S S S 5        [_        XR                  U R                  R`                  U R                  Rb                  5      u  U l2        nO[        U[f        5      (       d   eXl2        U R                  Rh                  S:X  a  U R                  R&                  S:X  a  SU R                  l4        OU R                  R&                  S:X  aQ  U R                  Rj                  b(  [D        Rl                  " S5        SU R                  l4        OYSU R                  l4        OGU R                  R&                  S:X  a  SU R                  l4        O U R                  R&                  5       eU R                  Rh                  n[        U[n        5      (       a  [q        U[r        5      (       d   eO4[u        US5        U R                  Rj                  b  SU;   a  [#        S 5      eU R                  Rv                  S:X  a,  U R                  R&                  S:X  a  S!U R                  l;        O![u        U R                  R&                  S"S#5        U R                  Rx                  S:X  a  S$U R                  l<        U R                  Rx                  [z        ;  a+  [#        S%U R                  Rx                  < S&[z        < 35      eU R                  Rv                  [|        ;  a+  [#        S'U R                  Rv                  < S&[|        < 35      eU R                  R&                  c  S(nOKU R                  Rj                  b*  [I        U R                  Rj                  R~                  5      nO
[I        5       nU Rd                  R                  U R                  R                  U5      u  U lB        U lC        U lD        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 lF        U R                  Rx                  S):X  ax  U R                   HB  nUR                  Rx                  c  M  UR                  Rx                  * UR                  l<        MD     U R                   H  nURx                  * Ul<        M     OnU R                  Rx                  cW  U R                   H-  nUR                  Rx                  c  M  S UR                  l<        M/     U R                   H
  nS*Ul<        M     [        U R                  X@R                  U R                  Rj                  U R                  R                  U R                  R                  U R                  R                  U R                  R                  S+9U lK        U R                  R&                  (       a  U R                  5       U l        OU(       a  U R                  5       U l4        U(       a  [D        RF                  " S,U5         [@        RB                  " US-5       nUc   eUR                  URU                  S5      S-   5        [P        R                  " WU5        U R                  U[J        5        S S S 5        g g ! [         a    SU l         G	N\f = f! [         a     G	NYf = f! [:         a    Sn GNf = f! , (       d  f       GN= f! [Z         a     GN[:         a!    [D        R\                  " SU5        Xl         GN	f = fs  snf ! , (       d  f       g = f! [         a"  n[D        R\                  " S.UU5         S nAg S nAff = f)/Nr   z?`regex` module must be installed if calling `Lark(regex=True)`.z<string>z/Grammar must be ascii only, when use_bytes=Truero   z+cache only works with parser='lalr' for now)rT   r`   rb   re   rj    c              3   T   >#    U  H  u  pUT;  d  M  U[        U5      -   v   M     g 7fr?   )rK   ).0kv
unhashables      rB   	<genexpr> Lark.__init__.<locals>.<genexpr>F  s%     %b?41aWaNahaAh?s   ((r   )__version__   Tz"cache argument must be bool or strunknownz/.lark_%s_%s_%s_%s_%s.tmprX   rW   rbzLoading grammar from cache: %s   
utf8z<Failed to load Lark from cache: %r. We will try to carry on.ri   
contextualrh   z~postlex can't be used with the dynamic lexer, so we use 'basic' instead. Consider using lalr with contextual instead of earleybasicdynamicrp   )r   r   r   dynamic_completezGCan't use postlex with a dynamic lexer. Use basic or contextual insteadr   )rh   rp   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   rS   zSaving grammar to cache: %swbz!Failed to save Lark to cache: %r.)RrO   rn   rX   __serialize_fields__rY   
_has_regexImportErrorrerg   ry   r   readrt   rK   r   rc   isasciir   rW   r]   joinrr   r   r   sysversion_infor(   getpassgetuser	Exceptiontempfile
gettempdirr   openr    rR   set_LOAD_ALLOWED_OPTIONSreadlinerstrippickleloadencoder&   _loadFileNotFoundError	exceptionr#   rf   r[   r   r%   r^   r`   infotype
issubclassr.   r   r_   ra   _VALID_PRIORITY_OPTIONS_VALID_AMBIGUITY_OPTIONSrF   compilerQ   r   r   ignore_tokensre   _terminals_dictr*   rb   rZ   rS   
lexer_conf_build_parser_build_lexerwritedumpsaveIOError)rA   r   rn   	use_regex	re_moduler   cache_fncache_sha256options_strr   susernameold_optionsfry   file_sha256cached_used_filescached_parser_data
used_filesr^   terminals_to_keeptruletermr   r   s                            @rB   r|   Lark.__init__  s   "7+ <<%%(,(A(AYK(OD% 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47R+/<<+E+E7T\VCmpm}m}  A  @A  nBVC 8C  C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	 -, A " .#- .  		> % - $-	- 10 )   /$$%cemn $/L/B  CB -,
  S  !DhPQRRSs   h h' <h8 ,i B6i9i i jj- /Ajj- h$#h$'
h54h58ii
ii i 
j*&jj
j*&j- *j- -
k7kkz

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/   )rA   r   r   r   s       rB   r   Lark._build_lexer  s.    __
!j)J "J*%%rE   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   ro   r   )
_callbacksrn   r_   r3   r   r\   r)   rU   r]   rV   _parse_tree_buildercreate_callbackrT   updater5   r   rA   s    rB   _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]^rE   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   r4   rn   r]   r^   r+   r   r   rQ   r7   r   )rA   parser_confs     rB   r   Lark._build_parser  s    ! 3 3T\\5G5GH T__dll>P>PQ*LLLLOOLL
 	
rE   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.
ro   z7Lark.save() is only implemented for the LALR(1) parser.rn   r   r   )protocolN)
rn   r]   NotImplementedErrormemo_serializer0   r8   rr   r   r   HIGHEST_PROTOCOL)rA   r   r  r   mnr   s          rB   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      rB   r   	Lark.load  s      {{3zz!}rE   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`   )rA   r   r   rn   r   s        rB   _deserialize_lexer_confLark._deserialize_lexer_conf  sr    **4+=tD
&66<"
(/u2
&00
#*#8#8
 %)
"$__
rE   rA   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SU;   a  [        R
                  " US   U5      U l	        [        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 R0                  R2                  U l        U R5                  5         U R2                   V	s0 s H  oR6                  U	_M     sn	U l        [;        US	   UU R0                  U R<                  U R"                  5      U l        U $ s  snf s  sn	f )
Nr   r   )r8   r0   r   rn   z6Some options are not allowed when loading a Parser: {}r   z<deserialized>r]   )rt   rq   r   r   r   r   r8   r0   r%   r   r   r   rO   rk   r   formatr   rn   r   rg   r4   r]   r^   r  r   r   r   ry   r   r6   r   )
rA   r   kwargsd	memo_jsonr   r   rn   rr   s
             rB   r   
Lark._load  s   aAAAfI	yy ,,YVa8bdfg"..tIEDL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        rB   _load_from_dictLark._load_from_dict=  s'    {{3zz46A&AArE   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!  rn   basepathr   s         rB   r   	Lark.openB  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=...)
Nrg   rf   )r$   
setdefaultappend)r   r)  r*  r+  rn   package_loader	full_pathtexts           rB   open_from_packageLark.open_from_packageT  s_     +7A(|<	=)4>2.&&~64#7##rE   c                     SU R                   < SU R                  R                  < SU R                  R                  < S3$ )Nz
Lark(open(z
), parser=z, lexer=z, ...))rg   rn   r]   r^   r   s    rB   __repr__Lark.__repr__f  s,    =A=M=Mt||ObObdhdpdpdvdvwwrE   r1  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^   r1   	from_textlexrn   r`   rC   )rA   r1  r   r^   lexer_threadr<   s         rB   r:  Lark.lexj  sy     tW%%%%k2EJJE",,U9!!$'<<<<''//77rE   ry   c                      U R                   U   $ )z Get information about a terminal)r   )rA   ry   s     rB   get_terminalLark.get_terminal|  s    ##D))rE   rQ   r   c                 4    U R                   R                  XS9$ )a  Start an interactive parsing session. Only works when parser='lalr'.

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

Returns:
    A new InteractiveParser instance.

See Also: ``Lark.parse()``
)rQ   )r]   parse_interactive)rA   r1  rQ   s      rB   rA  Lark.parse_interactive  s     {{,,T,??rE   on_errorz+Optional[Callable[[UnexpectedInput], bool]]r   c                     Ub%  U R                   R                  S:w  a  [        S5      eU R                  R                  XUS9$ )a_  Parse the given text, according to the options provided.

Parameters:
    text (LarkInput): Text to be parsed, as `str` or `bytes`.
        TextSlice may also be used, but only when lexer='basic' or 'contextual'.
        If Lark was created with a custom lexer, this may be an object of any type.
    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 UnexpectedInput error,
        with the exception as its argument. Return true to resume parsing, or false to raise the exception.
        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   z?The on_error option is only implemented for the LALR(1) parser.)rQ   rC  )rn   r]   r  parse)rA   r1  rQ   rC  s       rB   rE  
Lark.parse  sA    * DLL$7$76$A%&ghh{{  X FFrE   )r   r   r   r   r   r   r^   r   rn   r]   r   r   rg   r   )r   zUnion[Grammar, str, IO[str]]r=   N)F)r=   N)r=   r   )r@   r?   )NN).rG   rH   rI   rJ   r   rK   rL   rO   r.   r   r0   r   r|   r   ru   r/   r   r   r   r   r   r   r   r   r   r   r   r   r8   r*   r  r   r  r   r   r2  r5  r!   r	   r2   r:  r>  r"   rA  rE  rM   r@   rE   rB   r   r      sE    L+&&9SB 6K3333& &z &_


Tz# 
T 
T $r( "  DcN $sER]_cRcLdGdBe p{   AJ  B  3  R  D B B %$r( %c %8C= %]_ % %" ikhl $tBx $# $S $Xg $|~ $ $"x $ % $* * *@hy&9 @xPS} @^q @G) GHSM GJw G  BM G GrE   )R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'   r(   r)   commonr*   r+   r,   r-   r^   r.   r/   r0   r1   r2   parse_tree_builderr3   r4   r5   r6   r7   r   r8   rY   r   r   r:   rO   r   r   r   r   r   r@   rE   rB   <module>rR     s    #      	     B%1 J J S S u u  H H E E 0 H  H J&c &B) BN g < D  T gG9 gG{  Js   D DD