
    Xhn                        d dl mZmZ d dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ erddlmZ ddlmZ ddlmZ d dl
m Z  dd	l!m"Z" dd
l#m$Z$m%Z%m&Z& ddl'm(Z(m)Z)m*Z*m+Z+ ddl,m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1 ddlm2Z2 ddl3m4Z4m5Z5m6Z6m7Z7 ddl8m9Z9m:Z:m;Z;m<Z<m=Z= ddl>m?Z? ddl!m@Z@mAZAmBZBmCZC ddlDmEZE 	 d dlFZFdZG G d de      ZI G d de(      ZJh dZKdZLdZM edd      ZN G d de(      ZOy# eH$ r dZGY =w xY w)     )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                   H    e Zd ZU edee   dee   fd       ZdZee	   e
d<   y)PostLexstreamreturnc                     |S N )selfr9   s     =/var/www/html/myenv/lib/python3.12/site-packages/lark/lark.pyprocesszPostLex.process)   s        r=   always_acceptN)__name__
__module____qualname__r   r	   r0   r@   rB   r   str__annotations__r=   rA   r?   r8   r8   (   s:    huo (5/   $&M8C=%rA   r8   c            	          e Zd ZU dZee   ed<   eed<   eed<   ded<   eeef   ed<   eed<   eeef   ed	<   eed
<   e	ed<   eed<   e
eeegef      ed<   eed<   eed<   ded<   e
e   ed<   ded<   eeeegef   f   ed<   eed<   eed<   e
eegef      ed<   ded<   e
e   ed<   dZereez  Zi ddddddddd	ddddddd dddddd dd d
ddddi dd!ddd"dd!g di d#Zeeef   ed$<   d%eeef   d&dfd'Zd(ed&efd)Zd(ed*ed&dfd+Zd0d&eeef   fd,Zed-eeef   d.ee	eeef   f   d&d fd/       Zy)1LarkOptionsz$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   )rR   r[   r\   r^   r_   _plugins	_defaultsoptions_dictr:   c                    t        |      }i }| j                  j                         D ]A  \  }}||v r1|j                  |      }t	        |t
              r|dvrt        |      }n|}|||<   C t	        |d   t              r	|d   g|d<   || j                  d<   t        | j                  d       | j                  dk(  r| j                  rt        d      |rt        d|j                         z        y )N)rP   r[   rN   rJ   options)r`   lalrcykNr`   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)dictrc   itemspop
isinstanceboolrF   __dict__r   rU   rM   r   keys)r>   rd   orf   namedefaultvalues          r?   __init__zLarkOptions.__init__   s    !^^113 	"MD'qydgt,=j1j KE!GDM	" gg&, ' 01GG#*i  	dkk#BC;;("t'7'7$ &A B B $%:QVVX%EFF rA   rq   c                 `    	 | j                   d   |   S # t        $ r}t        |      d }~ww xY w)Nrf   )rn   KeyErrorAttributeError)r>   rq   es      r?   __getattr__zLarkOptions.__getattr__   s6    	$==+D11 	$ ##	$s    	-(-rs   c                 l    t        || j                  j                         d       || j                  |<   y )Nz,%r isn't a valid option. Expected one of: %s)r   rf   ro   )r>   rq   rs   s      r?   __setattr__zLarkOptions.__setattr__   s*    dDLL--/1_`"TrA   c                     | j                   S r<   rf   )r>   memos     r?   	serializezLarkOptions.serialize   s    ||rA   datar~   c                      | |      S r<   r=   )clsr   r~   s      r?   deserializezLarkOptions.deserialize   s    4yrA   r<   )rC   rD   rE   __doc__r   rF   rG   rm   r   intr   r
   r   r*   r+   r8   r   r0   r.   OPTIONS_DOCrc   rt   ry   r{   r   classmethodr6   r   r=   rA   r?   rI   rI   /   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  rA   rI   >
   rK   rQ   rX   rb   r[   rT   rM   rR   rZ   rN   )ra   normalinvertN)ra   resolveexplicitforest_TLark)boundc                      e Zd ZU dZeed<   eed<   ded<   eed<   eed<   ded	<   ee	   ed
<   d4dZ
eredej                  z   z  ZdZd5dedefdZd6dZd7dZd8dee   ddfdZedee   defd       Zdeeef   deeee	ef   f   dedefdZdededefdZed        Zed9dee   ded e e   defd!       Z!ed"gfdee   d#ed$ed%d&def
d'       Z"d( Z#d5d)edede$e%   fd*Z&d+ede	fd,Z'd:d)e e   d-e e   dd.fd/Z(d:d)ed-e e   d0d1dd2fd3Z)y);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(...)
    r_   source_grammarr#   grammarrf   rV   r   rU   	terminalsr:   Nc           
         t        |      | _        | j                  j                  }|rt        rt        }nt	        d      t
        }| j                  j                  	 |j                  | _        n| j                  j                  | _        	 |j                  } |       }d }d }t        |t              r|| _        | j                  j                  r|j                         st        d      | j                  j                   r| j                  j"                  dk7  rt        d      ddj%                  fd|j'                         D              }d	d
lm}	 ||z   |	z   t        t,        j.                  d d       z   }
t1        |
      }t        | j                  j                   t              r| j                  j                   }nh| j                  j                   durt        d      	 t3        j4                         }t9        j:                         d||gt,        j.                  d d z  z   }| j                  }	 t=        j>                  |d      5 }tA        jB                  d|       tE        |      tF        z
  D ]  }||=  |jI                         jK                  d      }tM        jN                  |      }||jQ                  d      k(  r=tS        |      r2tM        jN                  |      } | jT                  |fi | 	 d d d        y d d d        t[        || j                  | j                  j\                  | j                  j^                        \  | _0        }nt        |tb              sJ || _0        | j                  jd                  dk(  r| j                  j"                  dk(  rd| j                  _2        n| j                  j"                  dk(  rO| j                  jf                  'tA        jh                  d       d| j                  _2        nXd| j                  _2        nF| j                  j"                  dk(  rd| j                  _2        nJ | j                  j"                         | j                  jd                  }t        |tj              rtm        |tn              s3J tq        |d       | j                  jf                  d|v rt        d      | j                  jr                  dk(  r+| j                  j"                  dk(  r3d| j                  _9        n!tq        | j                  j"                  dd        | j                  jt                  dk(  rd!| j                  _:        | j                  jt                  tv        vr)t        d"| j                  jt                  d#tv              | j                  jr                  tx        vr)t        d$| j                  jr                  d#tx              | j                  j"                  d%}nJ| j                  jf                  *tE        | j                  jf                  jz                        }n
tE               }| j`                  j}                  | j                  j~                  |      \  | _@        | _A        | _B        | j                  j                  r,| j                  D ]  }| j                  j                  |        | j                  D ci c]  }|j                  | c}| _D        | j                  jt                  d&k(  rr| j                  D ]?  }|j                  jt                  |j                  jt                   |j                  _:        A | j                  D ]  }|jt                   |_:         ng| j                  jt                  Q| j                  D ]*  }|j                  jt                  d |j                  _:        , | j                  D ]	  }d'|_:         t        | j                  || j                  | j                  jf                  | j                  j                  | j                  j                  | j                  j                  | j                  j                  (      | _I        | j                  j"                  r| j                         | _        n|r| j                         | _2        |rtA        jB                  d)|       	 t=        j>                  |d*      5 }|J |j                  |jQ                  d      dz          tM        j                  |       | j                  |tF               d d d        y y # t        $ r d| _        Y w xY w# t        $ r Y w xY w# t6        $ r d}Y w xY w# 1 sw Y   }xY w# tV        $ r Y t6        $ r! tA        jX                  d|       || _        Y w xY wc c}w # 1 sw Y   y xY w# t        $ r!}tA        jX                  d+||       Y d }~y d }~ww xY w),Nz?`regex` module must be installed if calling `Lark(regex=True)`.z<string>z/Grammar must be ascii only, when use_bytes=Truerg   z+cache only works with parser='lalr' for now)rM   rX   rZ   r]   rb    c              3   J   K   | ]  \  }}|vs|t        |      z     y wr<   )rF   ).0kv
unhashables      r?   	<genexpr>z Lark.__init__.<locals>.<genexpr>7  s%     %b41aaWaNaaAh%bs   ##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.ra   
contextualr`   z~postlex can't be used with the dynamic lexer, so we use 'basic' instead. Consider using lalr with contextual instead of earleybasicdynamicrh   )r   r   r   dynamic_completezGCan't use postlex with a dynamic lexer. Use basic or contextual insteadr   )r`   rh   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[   rL   zSaving grammar to cache: %swbz!Failed to save Lark to cache: %r.)PrI   rf   rQ   
_has_regexImportErrorrer_   rq   rw   readrl   rF   r   r[   isasciir   rP   rU   joinrj   r   r   sysversion_infor&   getpassgetuser	Exceptiontempfile
gettempdirr   openr    rK   set_LOAD_ALLOWED_OPTIONSreadlinerstrippickleloadencoder$   _loadFileNotFoundError	exceptionr!   r^   rS   r   r#   rV   rX   infotype
issubclassr,   r   rW   rY   _VALID_PRIORITY_OPTIONS_VALID_AMBIGUITY_OPTIONSrB   compilerJ   r   rulesignore_tokensr]   _terminals_dictr(   rZ   rR   rL   
lexer_conf_build_parser_build_lexerwritedumpsaveIOError)r>   r   rf   	use_regex	re_moduler   cache_fncache_sha256options_strr   susernameold_optionsfrq   file_sha256cached_used_filescached_parser_data
used_filesrV   terminals_to_keeptruletermrx   r   s                            @r?   rt   zLark.__init__  s}   "7+ LL&&	!	!"cddI <<##+.#*<<   $||77D	<<D fGgs#")D||%%(,-^__||!!<<&&&0,-Z[[h
 gg%b7==?%bb)k)K7#c>N>NrPQ>R:SS,Q/dll00#6#||11H||))501UVV-#*??#4  (2247UYaco  YHru  sC  sC  DF  EF  sG  YH  8H   HH"ll/40 
#A%ExP%(\4I%I .D '.&'jjl&9&9%&@,2KKN)&,*=*=f*EEJ[\mJn17Q.&DJJ'9EWE"
# 
# 
#. (4GT=M=Mt||OhOhjnjvjv  kG  kG  (H$DL*gw///"DL <<'||""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>>Ba	B <<  H,

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

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

)rU   r   rf   dont_ignorec                 ^    | j                   }|rddlm}  ||      }d|_        t        |      S )Nr   )copyr=   )r   r   ignorer-   )r>   r   r   r   s       r?   r   zLark._build_lexer  s.    __
!j)J "J*%%rA   c                 Z   i | _         | j                  j                  dk7  rt        | j                  | j                  j
                  xs t        | j                  j                  | j                  j                  dk7  xr | j                  j                  dk(  | j                  j                        | _
        | j                  j                  | j                  j                        | _         | j                   j                  t        | j                  j                  | j                               y )Nr   rg   r   )
_callbacksrf   rW   r1   r   rT   r'   rN   rU   rO   _parse_tree_buildercreate_callbackrM   updater3   r   r>   s    r?   _prepare_callbacksz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]^rA   c                    | j                          t        | j                  j                  | j                  j                         t        | j                  | j                  | j                  j                        }t        | j                  j                  | j                  j                  | j                  || j                        S )Nr}   )r   r2   rf   rU   rV   r)   r   r   rJ   r5   r   )r>   parser_confs     r?   r   zLark._build_parser  s    ! 3 3T\\5G5GH T__dll>P>PQ*LLLLOOLL
 	
rA   exclude_optionsc                 H   | j                   j                  dk7  rt        d      | j                  t        t
        g      \  }}|r/|d   j                         D ci c]  \  }}||vs|| c}}|d<   t        j                  ||d|t        j                         yc c}}w )zgSaves the instance into the given file object

        Useful for caching and multiprocessing.
        rg   z7Lark.save() is only implemented for the LALR(1) parser.rf   r   r~   )protocolN)
rf   rU   NotImplementedErrormemo_serializer.   r6   rj   r   r   HIGHEST_PROTOCOL)r>   r   r   r   mnr   s          r?   r   z	Lark.save  s    
 <<&(%&_``%%{D&9:a04Y0E0E0Gd11TcKcq!tdDOT1-q6;R;RS es   B(Br   c                 F    | j                  |       }|j                  |      S )zfLoads an instance from the given file object

        Useful for caching and multiprocessing.
        __new__r   )r   r   insts      r?   r   z	Lark.load  s      {{3zz!}rA   r   r~   c                    t        j                  |d   |      }|j                  xs i |_        |j                  rt        nt
        |_        |j                  |_        |j                  |_        d|_	        |j                  |_
        |S )Nr   T)r(   r   rZ   	callbacksrQ   r   r   r[   rR   skip_validationrX   )r>   r   r~   rf   r   s        r?   _deserialize_lexer_confzLark._deserialize_lexer_conf  sr    **4+=tD
&66<"
(/u2
&00
#*#8#8
 %)
"$__
rA   r>   r   c                    t        |t              r|}nt        j                  |      }|d   }|d   }|sJ t	        j
                  |t        t        di       }t        |d         }t        |      t        z
  t        t        j                        z  r*t        dj                  t        |      t        z
              |j                  |       t        j                  ||      | _        |d   D cg c]  }t        j
                  ||       c}| _        d| _        t%        | j                  j&                  | j                  j(                         | j+                  |d   || j                        | _        | j,                  j.                  | _        | j1                          | j.                  D 	ci c]  }	|	j2                  |	 c}	| _        t7        |d   || j,                  | j8                  | j                        | _        | S c c}w c c}	w )	Nr~   r   )r6   r.   rf   z6Some options are not allowed when loading a Parser: {}r   z<deserialized>rU   )rl   ri   r   r   r   r   r6   r.   r   r   rI   rc   r   formatr   rf   r   r_   r2   rU   rV   r   r   r   r   rq   r   r4   r   )
r>   r   kwargsd	memo_jsonr   r~   rf   rr   s
             r?   r   z
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GAd&&q$/G
+ 3 3T\\5G5GH66tH~tT\\Z22!37>>Ba	B3NOOOOLL
  H  Cs   0H.Hc                 P    | j                  |       } |j                  ||dfi |S )Nr   r   )r   r   r~   r  r   s        r?   _load_from_dictzLark._load_from_dict,  s+    {{3tzz46A&AArA   grammar_filenamerel_toc                     |r?t         j                  j                  |      }t         j                  j                  ||      }t	        |d      5 } | |fi |cddd       S # 1 sw Y   yxY w)a&  Create 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  rf   basepathr   s         r?   r   z	Lark.open1  s^     wwv.H!ww||H6FG"V4 	%q$G$	% 	% 	%s   	A""A+r   packagegrammar_pathsearch_pathszSequence[str]c                     t        ||      } |d|      \  }}|j                  d|       |j                  dg        |d   j                  |        | |fi |S )ak  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=...)
        Nr_   r^   )r"   
setdefaultappend)r   r  r  r  rf   package_loader	full_pathtexts           r?   open_from_packagezLark.open_from_packageC  sc     +7LA(|<	4=)4>2.&&~64#7##rA   c                 ~    d| j                   d| j                  j                  d| j                  j                  dS )Nz
Lark(open(z
), parser=z, lexer=z, ...))r_   rf   rU   rV   r   s    r?   __repr__zLark.__repr__U  s,    =A=M=Mt||ObObdhdpdpdvdvwwrA   r  c                 "   t        | d      r|r| j                  |      }n| j                  }t        j                  ||      }|j                  d      }| j                  j                  r%| j                  j                  j                  |      S |S )a  Only 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.
        rV   N)	hasattrr   rV   r/   	from_textlexrf   rX   r@   )r>   r  r   rV   lexer_threadr9   s         r?   r  zLark.lexY  sx     tW%%%k2EJJE",,UD9!!$'<<<<''//77rA   rq   c                      | j                   |   S )z Get information about a terminal)r   )r>   rq   s     r?   get_terminalzLark.get_terminalk  s    ##D))rA   rJ   r   c                 <    | j                   j                  ||      S )a-  Start 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()``
        )rJ   )rU   parse_interactive)r>   r  rJ   s      r?   r#  zLark.parse_interactiveo  s     {{,,T,??rA   on_errorz+Optional[Callable[[UnexpectedInput], bool]]r   c                 >    | j                   j                  |||      S )a  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``.

        )rJ   r$  )rU   parse)r>   r  rJ   r$  s       r?   r&  z
Lark.parse}  s     $ {{  UX FFrA   )r   zUnion[Grammar, str, IO[str]]r:   N)F)r:   N)r:   r   )r=   r<   )NN)*rC   rD   rE   r   rF   rG   rI   r,   r   r.   rt   r   __serialize_fields__rm   r-   r   r   r   r   r   r   r   r   r   r   r   r   r6   r(   r   r   r  r   r   r  r  r	   r0   r  r!  r#  r&  r=   rA   r?   r   r      s=    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rA   )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+   rV   r,   r-   r.   r/   r0   parse_tree_builderr1   r2   r3   r4   r5   r   r6   rQ   r   r   r8   rI   r   r   r   r   r   r=   rA   r?   <module>r3     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
