Ë
    ðeœi”s  ã                   ó"  — 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+m,Z,m-Z- ddl.m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3 ddlm4Z4 ddl5m6Z6m7Z7m8Z8m9Z9 ddl:m;Z;m<Z<m=Z=m>Z>m?Z? ddl@mAZA ddl!mBZBmCZCmDZDmEZE ddlFmGZG 	 d dlHZHdZI G d„ de«      ZK G d„ de(«      ZLh d£ZMdZNdZO edd¬«      ZP G d„ de(«      ZQy# eJ$ r dZIY Œ=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Ú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                   ó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© )Úselfr;   s     ú^/var/www/html/Whatsapp_Customer_Support_Chatbot/venv/lib/python3.12/site-packages/lark/lark.pyÚprocesszPostLex.process)   s   € àˆó    r?   Úalways_acceptN)Ú__name__Ú
__module__Ú__qualname__r   r	   r2   rB   rD   r   ÚstrÚ__annotations__r?   rC   rA   r:   r:   (   s:   … Øð˜h u™oð °(¸5±/ò ó ðð $&€M�8˜C‘=Ô%rC   r:   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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d“di “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d1d'eeef   fd-„Zed.eeef   d/ee	eeef   f   d'd fd0„«       Zy)2ÚLarkOptionsz$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   )r`   rU   r^   r_   ra   rb   Ú_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«      ‚| j                  r| j                  st        d«      ‚|rt        d|j                  «       z  «      ‚y )	N)rR   r^   rP   rL   Úoptions)rc   ÚlalrÚcykNrc   z©Cannot 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)Údictrf   ÚitemsÚpopÚ
isinstanceÚboolrH   Ú__dict__r   rX   rO   r   rS   rR   Úkeys)r@   rg   Úori   ÚnameÚdefaultÚvalues          rA   Ú__init__zLarkOptions.__init__Â   s  € Ü�ÓˆàˆØ!Ÿ^™^×1Ñ1Ó3ò 	"‰MˆD�'Ø�q‰yØŸ™˜d›�Ü˜g¤tÔ,°Ð=jÑ1jÜ  ›K‘Eà�à!ˆG�DŠMð	"ô �g˜gÑ&¬Ô,Ø '¨Ñ 0Ð1ˆG�GÑà#*ˆ�‰�iÑ ô 	�d—k‘kÐ#BÔCà�;‰;˜(Ò" t×'7Ò'7Ü$ð &Aó Bð Bð ×Ò d§j¢jÜ$Ð%YÓZÐZáÜ$Ð%:¸Q¿V¹V»XÑ%EÓFÐFð rC   rt   c                 ó`   — 	 | j                   d   |   S # t        $ r}t        |«      ‚d }~ww xY w)Nri   )rq   ÚKeyErrorÚAttributeError)r@   rt   Úes      rA   Ú__getattr__zLarkOptions.__getattr__â   s6   € ð	$Ø—=‘= Ñ+¨DÑ1Ð1øÜò 	$Ü  Ó#Ð#ûð	$ús   ‚ ”	-�(¨-rv   c                 ól   — t        || j                  j                  «       d«       || j                  |<   y )Nz,%r isn't a valid option. Expected one of: %s)r   ri   rr   )r@   rt   rv   s      rA   Ú__setattr__zLarkOptions.__setattr__è   s*   € Ü�d˜DŸL™L×-Ñ-Ó/Ð1_Ô`Ø"ˆ�‰�TÒrC   c                 ó   — | j                   S r>   ©ri   )r@   Úmemos     rA   Ú	serializezLarkOptions.serializeì   s   € Ø�|‰|ÐrC   Údatar�   c                 ó   —  | |«      S r>   r?   )Úclsrƒ   r�   s      rA   ÚdeserializezLarkOptions.deserializeï   s   € á�4‹yÐrC   r>   )rE   rF   rG   Ú__doc__r   rH   rI   rp   r   Úintr   r
   r   r,   r-   r:   r   r2   r0   ÚOPTIONS_DOCrf   rw   r|   r~   r‚   Úclassmethodr8   r†   r?   rC   rA   rK   rK   /   s   … ñð �‰9ÓØƒKØƒLØ(Ó(Ø˜t S˜yÑ)Ó)ØÓØ��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€Kñb Ø�;Ñˆð!Ø�ð!à�%ð!ð 	˜5ð!ð 	�dð	!ð
 	�ð!ð 	˜ð!ð 	�4ð!ð 	�(ð!ð 	�ð!ð 	�tð!ð 	�ð!ð 	�Fð!ð 	�Vð!ð 	�ð!ð 	˜uð!ð  	˜2ð!!ð" 	˜dð#!ð$ ØØØØØØò1!€Iˆt�C˜�H‰~ó ð6G T¨#¨s¨(¡^ð G¸ó Gð@$ ð $¨ó $ð# ð #¨Cð #°Dó #ñ¨¨S°#¨X©ó ð ð˜t C¨ H™~ð °T¸#¸uÀ[ÐRVÐEVÑ?WÐ:WÑ5Xð Ð]jò ó ñrC   rK   >
   rM   rT   r[   re   r^   rW   rO   rU   r]   rP   )rd   ÚnormalÚinvertN)rd   Ú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
<   g d¢Z
d4d„Zeredej                  z   z  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(...)
    rb   Úsource_grammarr%   Úgrammarri   rY   r   rX   Ú	terminals)rX   Úrulesri   r<   Nc           
      óŒ  ‡— t        |«      | _        | j                  j                  r| j                  dgz   | _        | 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        t0        j2                  d d «      z   }
t5        |
«      }t        | j                  j$                  t        «      r| j                  j$                  }n�| j                  j$                  durt#        d«      ‚	 t7        j8                  «       }t=        j>                  «       d| j                  j                  rdnd||gt0        j2                  d d ¢­z  z   }| j                  }	 tA        jB                  |d«      5 }tE        jF                  d|«       tI        |«      tJ        z
  D ]  }||= Œ |jM                  «       jO                  d«      }tQ        jR                  |«      }||jU                  d«      k(  r=tW        |«      r2tQ        jR                  |«      } | jX                  |fi |¤Ž 	 d d d «       y d d d «       t_        || j                  | j                  j`                  | j                  jb                  «      \  | _2        }nt        |tf        «      sJ ‚|| _2        | j                  jh                  dk(  rÙ| j                  j&                  dk(  rd| j                  _4        n®| j                  j&                  dk(  rO| j                  jj                  �'tE        jl                  d«       d| j                  _4        nXd| j                  _4        nF| j                  j&                  dk(  rd| j                  _4        nJ | j                  j&                  «       ‚| j                  jh                  }t        |tn        «      rtq        |tr        «      s3J ‚tu        |d«       | j                  jj                  �d|v rt#        d «      ‚| j                  jv                  dk(  r+| j                  j&                  dk(  r3d!| j                  _;        n!tu        | j                  j&                  d"d#«       | j                  jx                  dk(  rd$| j                  _<        | j                  jx                  tz        vr)t#        d%| j                  jx                  ›d&tz        ›�«      ‚| j                  jv                  t|        vr)t#        d'| j                  jv                  ›d&t|        ›�«      ‚| j                  j&                  €d(}nJ| j                  jj                  �*tI        | j                  jj                  j~                  «      }n
tI        «       }| jd                  j�                  | j                  j‚                  |«      \  | _B        | _C        | _D        | j                  jŠ                  r,| j„                  D ]  }| j                  j‹                  |«       Œ | j„                  D �ci c]  }|j                  |“Œ c}| _F        | j                  jx                  d)k(  rr| j†                  D ]?  }|j                  jx                  €Œ|j                  jx                   |j                  _<        ŒA | j„                  D ]  }|jx                   |_<        Œ ng| j                  jx                  €Q| j†                  D ]*  }|j                  jx                  €Œd |j                  _<        Œ, | j„                  D ]	  }d*|_<        Œ t�        | j„                  || jˆ                  | j                  jj                  | j                  j�                  | j                  j’                  | j                  j                  | j                  j”                  ¬+«      | _K        | j                  j&                  r| j™                  «       | _        n|r| j›                  «       | _4        |rŠtE        jF                  d,|«       	 tA        jB                  |d-«      5 }|€J ‚|j�                  |jU                  d«      dz   «       tQ        jž                  |«       | j¡                  |tJ        «       d d d «       y y # t        $ r d| _        Y �Œæw xY w# t        $ r Y �Œâw xY w# t:        $ r d}Y �Œ™w xY w# 1 sw Y   �Œ}xY w# tZ        $ r Y �ŒŒt:        $ r! tE        j\                  d|«       || _        Y �Œ´w xY wc c}w # 1 sw Y   y xY w# t¢        $ r!}tE        j\                  d.||«       Y d }~y d }~ww xY w)/Nr•   z?`regex` module must be installed if calling `Lark(regex=True)`.z<string>z/Grammar must be ascii only, when use_bytes=Truerj   z+cache only works with parser='lalr' for now)rO   r[   r]   r`   re   Ú c              3   óJ   •K  — | ]  \  }}|‰vsŒ|t        |«      z   –— Œ y ­wr>   )rH   )Ú.0ÚkÚvÚ
unhashables      €rA   ú	<genexpr>z Lark.__init__.<locals>.<genexpr>F  s%   øè ø€ Ò%b±4°1°aÈaÐWaÒNa a¬¨A«¥hÑ%bùs   ƒ#�#r   )Ú__version__é   Tz"cache argument must be bool or strÚunknownz/.lark_%s_%s_%s_%s_%s.tmprS   rR   ÚrbzLoading grammar from cache: %só   
Úutf8z<Failed to load Lark from cache: %r. We will try to carry on.rd   Ú
contextualrc   z~postlex can't be used with the dynamic lexer, so we use 'basic' instead. Consider using lalr with contextual instead of earleyÚbasicÚdynamicrk   )r§   r¦   r¨   Údynamic_completezGCan't use postlex with a dynamic lexer. Use basic or contextual insteadr�   )rc   rk   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^   rN   zSaving grammar to cache: %sÚwbz!Failed to save Lark to cache: %r.)RrK   ri   rS   Ú__serialize_fields__rT   Ú
_has_regexÚImportErrorÚrerb   rt   rz   Úreadro   rH   r”   r^   Úisasciir   rR   rX   Újoinrm   r™   r    ÚsysÚversion_infor(   ÚgetpassÚgetuserÚ	ExceptionÚtempfileÚ
gettempdirr   Úopenr    rM   ÚsetÚ_LOAD_ALLOWED_OPTIONSÚreadlineÚrstripÚpickleÚloadÚencoder&   Ú_loadÚFileNotFoundErrorÚ	exceptionr#   ra   rV   r•   r%   rY   r[   ÚinfoÚtypeÚ
issubclassr.   r   rZ   r\   Ú_VALID_PRIORITY_OPTIONSÚ_VALID_AMBIGUITY_OPTIONSrD   ÚcompilerL   r–   r—   Úignore_tokensr`   Ú_terminals_dictr*   r]   rU   rN   Ú
lexer_confÚ_build_parserÚ_build_lexerÚwriteÚdumpÚsaveÚIOError)r@   r•   ri   Ú	use_regexÚ	re_moduler°   Úcache_fnÚcache_sha256Úoptions_strr    ÚsÚusernameÚold_optionsÚfrt   Úfile_sha256Úcached_used_filesÚcached_parser_dataÚ
used_filesrY   Úterminals_to_keepÚtÚruleÚtermr{   rž   s                            @rA   rw   zLark.__init__  s¬  ø€ Ü" 7Ó+ˆŒð �<‰<×%Ò%Ø(,×(AÑ(AÀYÀKÑ(OˆDÔ%ð —L‘L×&Ñ&ˆ	ÙÝÜ!‘	ä!Ð"cÓdÐdäˆIð �<‰<×#Ñ#Ð+ð.Ø#*§<¡<�Õ ð  $Ÿ|™|×7Ñ7ˆDÔð	Ø—<‘<ˆDñ “fˆGàˆØˆÜ�gœsÕ#Ø")ˆDÔØ�|‰|×%Ò%Ø—‘Ô(Ü,Ð-^Ó_Ð_à�|‰|×!Ó!Ø—<‘<×&Ñ&¨&Ò0Ü,Ð-ZÓ[Ð[àh�
Ø Ÿg™gÓ%b¸7¿=¹=»?Ô%bÓb�Ý)Ø˜kÑ)¨KÑ7¼#¼c×>NÑ>NÈrÐPQÐ>RÓ:SÑS�Ü,¨QÓ/�ä˜dŸl™l×0Ñ0´#Ô6Ø#Ÿ|™|×1Ñ1‘Hà—|‘|×)Ñ)°Ñ5Ü0Ð1UÓVÐVð-Ü#*§?¡?Ó#4˜ô  (×2Ñ2Ó4Ð7RØ+/¯<©<×+EÒ+E™È7ÐT\Ð^jðVCÜmp×m}Ñm}ð  Að  @Að  nBñVCñ 8Cñ  C�Hð #Ÿl™l�ð/ÜŸ™ ¨4Ó0ð 
#°AÜŸ™Ð%EÀxÔPä%(¨£\Ô4IÑ%Iò .˜DØ '¨¡ð.à&'§j¡j£l×&9Ñ&9¸%Ó&@˜Ü,2¯K©K¸«NÐ)Ø&¨,×*=Ñ*=¸fÓ*EÒEÔJ[Ð\mÔJnÜ17·±¸Q³Ð.Ø&˜DŸJ™JÐ'9ÑE¸WÒEØ"÷
#÷ 
#ð 
#ô. (4°G¸T×=MÑ=MÈtÏ|É|×OhÑOhÐjn×jvÑjv÷  kGñ  kGó  (HÑ$ˆDŒL™*ä˜g¤wÔ/Ð/Ð/Ø"ˆDŒLð �<‰<×Ñ Ò'Ø�|‰|×"Ñ" fÒ,Ø%1�—‘Õ"Ø—‘×$Ñ$¨Ò0Ø—<‘<×'Ñ'Ð3Ü—K‘Kð !Xô Yà)0�D—L‘LÕ&à)2�D—L‘LÕ&Ø—‘×$Ñ$¨Ò-Ø%,�—‘Õ"à1˜dŸl™l×1Ñ1Ó1�uØ—‘×"Ñ"ˆÜ�eœTÔ"Ü˜e¤UÔ+Ð+Ð+ä˜%Ð!WÔXØ�|‰|×#Ñ#Ð/°IÀÑ4FÜ(Ð)rÓsÐsà�<‰<×!Ñ! VÒ+Ø�|‰|×"Ñ" hÒ.Ø)2�—‘Õ&ä˜$Ÿ,™,×-Ñ-Ð/@ð  CLô  Mà�<‰<× Ñ  FÒ*Ø$,ˆD�L‰LÔ!à�<‰<× Ñ Ô(?Ñ?Ý$ÐY]×YeÑYe×YnÓYnõ  qHð  &Ió  Jð  JØ�<‰<×!Ñ!Ô)AÑAÝ$ÐZ^×ZfÑZf×ZpÓZpõ  sKð  &Ló  Mð  Mà�<‰<×ÑÐ&Ø #ÑØ�\‰\×!Ñ!Ð-Ü # D§L¡L×$8Ñ$8×$FÑ$FÓ GÑä #£Ðð :>¿¹×9MÑ9MÈdÏlÉl×N`ÑN`ÐbsÓ9tÑ6ˆŒ˜œ
 DÔ$6à�<‰<×&Ò&Ø—^‘^ò /�Ø—‘×+Ñ+¨AÕ.ð/ð 48·>±>ÖB¨a §¡¨¡	ÒBˆÔð �<‰<× Ñ  HÒ,ØŸ
™
ò C�Ø—<‘<×(Ñ(Ñ4Ø-1¯\©\×-BÑ-BÐ,B�D—L‘LÕ)ðCð Ÿ™ò /�Ø!%§¡ �•ñ/ð
 �\‰\×"Ñ"Ð*ØŸ
™
ò 1�Ø—<‘<×(Ñ(Ñ4Ø,0�D—L‘LÕ)ð1ð Ÿ™ò "�Ø !�•ð"ô $Ø—‘ 	¨4×+=Ñ+=¸t¿|¹|×?SÑ?SØ—‘×,Ñ,¨d¯l©l×.HÑ.HÐTX×T`ÑT`×TjÑTjÐsw×sÑs÷  tGñ  tGôˆŒð
 �<‰<×ÒØ×,Ñ,Ó.ˆD�KÙØ×*Ñ*Ó,ˆDŒJáÜ�L‰LÐ6¸ÔAðSÜ—W‘W˜X tÓ,ð 8°Ø'Ð3Ð3Ð3Ø—G‘G˜L×/Ñ/°Ó7¸%Ñ?Ô@Ü—K‘K 
¨AÔ.Ø—I‘I˜aÔ!6Ô7÷	8ð 8ð øôA "ò .Ø#-�× ð.ûô ò 	Úð	ûô> %ò -ð $-›ð	-ú÷
#ñ 
#ûô )ò âÜ ò /Ü×$Ñ$Ð%cÐemÔnð $/�D—Lð/üòB  C÷B8ð 8ûô
 ò SÜ× Ñ Ð!DÀhÐPQ×RÑRûðSúsª   Â
f
 Â8f! Èf1 É<g ÊB-gÌ?g Íg Ühäh ä,Ahæ h æ
fæfæ!	f.æ-f.æ1g æ?g çgçg ç	hç%hèhèhèh èh è	iè"h>è>iz

Údont_ignorec                 ó^   — | j                   }|rddlm}  ||«      }d|_        t        |«      S )Nr   )Úcopyr?   )rÍ   rç   Úignorer/   )r@   rå   rÍ   rç   s       rA   rÏ   zLark._build_lexerÚ  s.   € Ø—_‘_ˆ
ÙÝ!Ù˜jÓ)ˆJØ "ˆJÔÜ˜*Ó%Ð%rC   c                 óZ  — i | _         | j                  j                  dk7  rÈt        | 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�   rj   rŽ   )Ú
_callbacksri   rZ   r3   r—   rW   r)   rP   rX   rQ   Ú_parse_tree_builderÚcreate_callbackrO   Úupdater5   r–   ©r@   s    rA   Ú_prepare_callbackszLark._prepare_callbacksâ  sÎ   € ØˆŒà�<‰<×!Ñ! XÒ-Ü'7Ø—J‘JØ—L‘L×+Ñ+Ò3¬tØ—L‘L×4Ñ4Ø—L‘L×'Ñ'¨6Ñ1ÒZ°d·l±l×6LÑ6LÐPZÑ6ZØ—L‘L×3Ñ3ó(ˆDÔ$ð #×6Ñ6×FÑFÀtÇ|Á|×G_ÑG_Ó`ˆDŒOØ�‰×ÑÔ3°D·L±L×4LÑ4LÈdÏnÉnÓ]Õ^rC   c                 óŒ  — | j                  «        t        | j                  j                  | j                  j                  «       t        | j                  | j                  | j                  j                  «      }t        | j                  j                  | j                  j                  | j                  || j                  ¬«      S )Nr€   )rï   r4   ri   rX   rY   r+   r—   rê   rL   r7   rÍ   )r@   Úparser_confs     rA   rÎ   zLark._build_parserð  s„   € Ø×ÑÔ!Ü §¡× 3Ñ 3°T·\±\×5GÑ5GÔHÜ  §¡¨T¯_©_¸d¿l¹l×>PÑ>PÓQˆÜ*Ø�L‰L×ÑØ�L‰L×ÑØ�O‰OØØ—L‘Lô
ð 	
rC   Ú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.
        rj   z7Lark.save() is only implemented for the LALR(1) parser.ri   ©rƒ   r�   )ÚprotocolN)
ri   rX   ÚNotImplementedErrorÚmemo_serializer0   r8   rm   r¿   rÑ   ÚHIGHEST_PROTOCOL)r@   rÜ   rò   rƒ   ÚmÚnr�   s          rA   rÒ   z	Lark.saveü  s�   € ð
 �<‰<×Ñ &Ò(Ü%Ð&_Ó`Ð`Ø×%Ñ%¤{´DÐ&9Ó:‰ˆˆaÙØ04°Y±×0EÑ0EÓ0G×d©¨¨1È1ÐTcÒKc˜q !™tÓdˆD�‰OÜ�‰˜T¨1Ñ-¨q¼6×;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      rA   rÀ   z	Lark.load  s    € ð �{‰{˜3ÓˆØ�z‰z˜!‹}ÐrC   rƒ   r�   c                 ó  — t        j                  |d   |«      }|j                  xs i |_        |j                  rt        nt
        |_        |j                  |_        |j                  |_        d|_	        |j                  |_
        |S )NrÍ   T)r*   r†   r]   Ú	callbacksrT   r¯   rÕ   r^   rU   Úskip_validationr[   )r@   rƒ   r�   ri   rÍ   s        rA   Ú_deserialize_lexer_confzLark._deserialize_lexer_conf  sr   € Ü×*Ñ*¨4°Ñ+=¸tÓDˆ
Ø&×6Ñ6Ò<¸"ˆ
ÔØ(/¯ª�u¼2ˆ
ÔØ&×0Ñ0ˆ
ÔØ#*×#8Ñ#8ˆ
Ô Ø%)ˆ
Ô"Ø$Ÿ_™_ˆ
ÔØÐrC   r@   rÜ   c                 óZ  — t        |t        «      r|}nt        j                  |«      }|d   }|d   }|sJ ‚t	        j
                  |t        t        dœi «      }d|v rt        j
                  |d   |«      | _	        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"                  «      | _        | j0                  j2                  | _        | j5                  «        | j2                  D �	ci c]  }	|	j6                  |	“Œ c}	| _        t;        |d	   || j0                  | j<                  | j"                  «      | _        | S c c}w c c}	w )
Nr�   rƒ   )r8   r0   r•   ri   z6Some options are not allowed when loading a Parser: {}r—   z<deserialized>rX   )ro   rl   r¿   rÀ   r   r†   r8   r0   r%   r•   r»   r¼   rK   rf   r   Úformatrí   ri   r—   rb   r4   rX   rY   r  rÍ   r–   rï   rt   rÌ   r6   rê   )
r@   rÜ   ÚkwargsÚdÚ	memo_jsonrƒ   r�   ri   Úrrâ   s
             rA   rÂ   z
Lark._load  sÅ  € Ü�aœÔØ‰Aä—‘˜A“ˆAØ�f‘Iˆ	Ø�‰yˆáÐˆyÜ ×,Ñ,¨YÄÔVaÑ8bÐdfÓgˆØ˜ÑÜ"×.Ñ.¨t°I©ÀÓEˆDŒLÜ�t˜I‘Ó'ˆÜ�‹KÔ/Ñ/´3´{×7LÑ7LÓ3MÒMÜ$Ð%]ß$™f¤S¨£[Ô3HÑ%HÓIóKð Kà�‰�vÔÜ"×.Ñ.¨w¸Ó=ˆŒØ9=¸g¹ÖG°A”d×&Ñ& q¨$Õ/ÒGˆŒ
Ø+ˆÔÜ §¡× 3Ñ 3°T·\±\×5GÑ5GÔHØ×6Ñ6°t¸H±~ÀtÈTÏ\É\ÓZˆŒØŸ™×2Ñ2ˆŒØ×ÑÔ!Ø37·>±>ÖB¨a §¡¨¡	ÒBˆÔÜ3Ø�‰NØØ�O‰OØ�O‰OØ�L‰Ló
ˆŒð ˆùò Hùò  Cs   ÄH#ÇH(c                 óP   — | j                  | «      } |j                  ||dœfi |¤ŽS )Nrô   rü   )r…   rƒ   r�   r  rþ   s        rA   Ú_load_from_dictzLark._load_from_dict=  s+   € à�{‰{˜3ÓˆØˆt�z‰z 4°Ñ6ÑA¸&ÑAÐArC   Ú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  ri   ÚbasepathrÜ   s         rA   rº   z	Lark.openB  s^   € ñ Ü—w‘w—‘ vÓ.ˆHÜ!Ÿw™wŸ|™|¨HÐ6FÓ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=...)
        Nrb   ra   )r$   Ú
setdefaultÚappend)r…   r  r  r  ri   Úpackage_loaderÚ	full_pathÚtexts           rA   Úopen_from_packagezLark.open_from_packageT  sc   € ô +¨7°LÓAˆÙ(¨¨|Ó<‰ˆ	�4Ø×Ñ˜=¨)Ô4Ø×Ñ˜>¨2Ô.Ø�Ñ×&Ñ& ~Ô6Ù�4Ñ#˜7Ñ#Ð#rC   c                 ó~   — d| j                   ›d| j                  j                  ›d| j                  j                  ›d�S )Nz
Lark(open(z
), parser=z, lexer=z, ...))rb   ri   rX   rY   rî   s    rA   Ú__repr__zLark.__repr__f  s,   � Ø=A×=MÓ=MÈtÏ|É|×ObÓObÐdh×dpÑdp×dvÓdvÐwÐwrC   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.
        rY   N)	ÚhasattrrÏ   rY   r1   Ú	from_textÚlexri   r[   rB   )r@   r  rå   rY   Úlexer_threadr;   s         rA   r"  zLark.lexj  sx   € ô �t˜WÔ%©Ø×%Ñ% kÓ2‰Eà—J‘JˆEÜ"×,Ñ,¨U°DÓ9ˆØ×!Ñ! $Ó'ˆØ�<‰<×ÒØ—<‘<×'Ñ'×/Ñ/°Ó7Ð7ØˆrC   rt   c                 ó    — | j                   |   S )z Get information about a terminal)rÌ   )r@   rt   s     rA   Úget_terminalzLark.get_terminal|  s   € à×#Ñ# DÑ)Ð)rC   rL   r   c                 ó<   — | j                   j                  ||¬«      S )aR  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()``
        )rL   )rX   Úparse_interactive)r@   r  rL   s      rA   r'  zLark.parse_interactive€  s   € ð �{‰{×,Ñ,¨T¸Ð,Ó?Ð?rC   Úon_errorz+Optional[Callable[[UnexpectedInput], bool]]r   c                 óŠ   — |�$| j                   j                  dk7  rt        d«      ‚| j                  j                  |||¬«      S )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``.

        rj   z?The on_error option is only implemented for the LALR(1) parser.)rL   r(  )ri   rX   rö   Úparse)r@   r  rL   r(  s       rA   r*  z
Lark.parseŽ  sC   € ð* Ð D§L¡L×$7Ñ$7¸6Ò$AÜ%Ð&gÓhÐhØ�{‰{× Ñ  ¨U¸XÐ ÓFÐFrC   )r•   zUnion[Grammar, str, IO[str]]r<   N)F)r<   N)r<   r   )r?   r>   )NN),rE   rF   rG   r‡   rH   rI   rK   r.   r   r0   r¬   rw   r‰   rp   r/   rÏ   rï   rÎ   rÒ   rŠ   r   r�   rÀ   r   r   rˆ   r   r8   r*   r  rÂ   r
  r   rº   r  r  r!   r	   r2   r"  r%  r"   r'  r*  r?   rC   rA   r‘   r‘   þ   s?  … ñð ÓØÓØÓØÓØƒLØÓØ˜+Ñ&Ó&â9ÐóSñB Ø�6˜K×3Ñ3Ñ3Ñ3ˆñ&¨ð &°zó &ó_ó

ñ
T z°#¡ð 
TÀó 
Tð ð�$�r‘(ð  "ò ó ðð¨D°°c°©Nð À$ÀsÈEÐR]Ð_cÐRcÑLdÐGdÑBeð Ðp{ð ð  AJó ð �Bð  ˜3ð  ¨Ró  ðD ñBó ðBð ñ%�$�r‘(ð %¨cð %¸8ÀC¹=ð %Ð]_ò %ó ð%ð" ØikÐhlñ $˜t B™xð $°#ð $ÀSð $ÐXgð $Ð|~ò $ó ð$ò"xñ˜ð °$ð ÀÈ%Áó ð$* ð *¨ó *ñ@ h¨yÑ&9ð @ÀxÐPSÁ}ð @Ð^qó @ñG˜)ð G¨H°S©Mð GÐJwð Gð  BMô GrC   )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-   rY   r.   r/   r0   r1   r2   Úparse_tree_builderr3   r4   r5   r6   r7   r•   r8   rT   r­   r®   r:   rK   r¼   rÈ   rÉ   r�   r‘   r?   rC   rA   ú<module>r6     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