
    }f                       d dl mZ d dlZd dlZd dlZd dlmZmZ d dlm	Z	 d dl
mZmZ ddlmZ ddlmZ dd	lmZ  G d
 de      Z ed      Zej,                   G d d             Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d d e      Z  ej,                  d!"       G d# d$             Z!y)%    )annotationsN)CallableMapping)starmap)Any
NamedTuple   )AST)	Tokenizer)C_DERIVEc                      e Zd Zy)UndefinedStrN)__name__
__module____qualname__     J/var/www/feuerwehr-webapp/venv/lib/python3.12/site-packages/tatsu/infos.pyr   r      s    r   r   z>>undefined<<c                     e Zd ZU dZded<   dZded<   dZded	<   d
Zded<   dZded<   dZ	ded<   dZ
ded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded <   eZded!<   dZded"<   dZded#<   dZded$<   dZded%<    ej8                  e&      Zd'ed(<   dZd)ed*<   dZ ded+<   dZ!d)ed,<   e"Z#ded-<   dZ$ded.<   d/ Z%e&	 	 d7	 	 	 	 	 	 	 d8d0       Z'd1 Z(d9d2Z)	 d:	 	 	 d;d3Z*d<d4Z+d<d5Z,d6 Z-y)=ParserConfigNr   ownerTestz
str | Nonename strfilenamezutf-8encodingstart
start_rule	rule_namezre.Pattern | Nonecomments_reeol_comments_reztype[Tokenizer] | Nonetokenizerclsztype | None	semanticsFboolcomment_recoveryTmemoize_lookaheadscolorizetracetrace_filenameH   inttrace_lengthtrace_separatorgrammarleft_recursioncommentseol_commentsdefault_factoryzlist[str] | set[str]keywordszbool | None
ignorecase	namechars	nameguard
whitespace	parseinfoc                B   | j                   r-| j                  D cg c]  }|j                          c}| _        | j                  r$t	        j
                  | j                        | _        | j                  r%t	        j
                  | j                        | _        y y c c}w N)	r6   r5   upperr1   recompiler!   r2   r"   )selfks     r   __post_init__zParserConfig.__post_init__?   sk    ??04>1QWWY>DM==!zz$--8D#%::d.?.?#@D   ?s   Bc                ^     | |      }||j                  |      } |j                  di |S )N)r   r   )replace_configreplace)clsconfigr   settingsresults        r   newzParserConfig.newG   s8     5!**62Fv~~)))r   c                R    | j                   xs | j                  xs | j                  S r<   )r   r    r   r@   s    r   effective_rule_namez ParserConfig.effective_rule_nameS   s    >$..>DJJ>r   c                r    |j                         D ci c]  \  }}|t        | |      r|| c}}S c c}}w r<   )itemshasattr)r@   rH   r   values       r   _find_commonzParserConfig._find_commonW   sB      (~~/
e WT4%8 %K
 	
 
s   3c                    || S t        |t              s!t        dt        |      j                          | j
                  di t        |      S )NzUnexpected type r   )
isinstancer   	TypeErrortyper   rE   varsr@   others     r   rD   zParserConfig.replace_config^   sN     =KE<0.tE{/C/C.DEFF4<<.$u+..r   c                     | j                   di |}t        j                  | fi |}d|v r|j                  |_        |S )Nr/   r   )rR   dataclassesrE   r/   r   )r@   rH   	overridesrI   s       r   rE   zParserConfig.replaceh   sD    %D%%11	$$T7Y7	! ..FKr   c           	          | j                   di |}|j                         D ci c]  \  }}t        | |d       || }}} | j                  di |S c c}}w )Nr   )rR   rO   getattrrE   )r@   rH   r\   r   rQ   s        r   mergezParserConfig.mergeo   so    %D%%11	  )0
etT4(0 %K
	 

 t||(i((
s   Ac                f    t        j                   t        |             }|j                  dd        |S )Nr   )copyrW   pop)r@   rI   s     r   asdictzParserConfig.asdictx   s)     4:&

7D!r   )NN)rG   ParserConfig | Noner   z
Any | NonerH   r   returnr   )rH   r   re   zMapping[str, Any]r<   )rY   rd   re   r   )rH   r   re   r   ).r   r   r   r   __annotations__r   r   r   r   r   r    r!   r"   r#   r$   r&   r'   r(   r)   r*   r-   r   r.   r/   r0   r1   r2   r[   fieldlistr5   r6   r7   r8   _undefined_strr9   r:   rB   classmethodrJ   rM   rR   rD   rE   r_   rc   r   r   r   r   r      s   E3D*HcHcE:!J
! Iz %)K"))-O&-+/L(/!I{!"d"##HdE4 ND L##OS# GZNDHj#L*#%6[%6%6t%LH"L#J#Is!I{!+J
+ItA  '+ 	*#	* 	* 		*
 
	* 	*?
 ,0/(/	/)r   r   c                  <    e Zd ZU ded<   ded<   ded<   ed        Zy)PosLiner,   r   linelengthc                "   g }d}d}t        |       D ]A  \  }}t        ||t        |            }|D ]  }|j                  |        |t        |      z  }C |dz  }| r| d   r| d   d   dv r|dz  }|j                  t        ||d             ||fS )Nr   r	   z
)	enumeraterl   lenappend)linescachenirm   pl_s          r   build_line_cachezPosLine.build_line_cache   s     ' 	GAtAs4y)B !R !TNA		
 	
QU2Y59R=F#:FAWQ1%&axr   N)r   r   r   rf   staticmethodrz   r   r   r   rl   rl      s#    J
IK r   rl   c                  2    e Zd ZU ded<   ded<   ed        Zy)LineIndexInfor   r   r,   rm   c                f    t        t        t        t        || gz  t	        |      d                  S )NF)strict)rh   r   r}   ziprange)r   rv   s     r   block_indexzLineIndexInfo.block_index   s,    M3qD6z58E#JK
 	
r   N)r   r   r   rf   r{   r   r   r   r   r}   r}      s    M
I
 
r   r}   c                  J    e Zd ZU ded<   ded<   ded<   ded<   ded<   ded<   y	)
LineInfor   r   r,   rm   colr   endtextNr   r   r   rf   r   r   r   r   r      s     M
I	HJ	H
Ir   r   c                  2    e Zd ZU ded<   ded<   ed        Zy)CommentInforh   inlineeolc                     t        g g       S r<   )r   r   r   r   new_commentzCommentInfo.new_comment   s    2r""r   N)r   r   r   rf   r{   r   r   r   r   r   r      s    L	I# #r   r   c                  *    e Zd ZU dZded<   dZded<   y)Alertr	   r,   levelr   r   messageN)r   r   r   r   rf   r   r   r   r   r   r      s    E3NGSr   r   c                  t    e Zd ZU ded<   ded<   ded<   ded<   ded<   ded	<   g Zd
ed<   d Zd Zed        Zy)	ParseInfor   	tokenizerr   ruler,   posendposrm   endlinelist[Alert]alertsc                b    | j                   j                  | j                  | j                        S r<   )r   	get_linesrm   r   rL   s    r   
text_lineszParseInfo.text_lines   s!    ~~''		4<<@@r   c                b    | j                   j                  | j                  | j                        S r<   )r   
line_indexrm   r   rL   s    r   r   zParseInfo.line_index   s!    ~~((DLLAAr   c                    | j                   S r<   )r   rL   s    r   bufferzParseInfo.buffer   s    ~~r   N)	r   r   r   rf   r   r   r   propertyr   r   r   r   r   r      sJ    N
I	HK
ILFKAB  r   r   c                  ,    e Zd ZU ded<   ded<   ded<   y)MemoKeyr,   r   r   r   r   stateNr   r   r   r   r   r      s    	H
IJr   r   c                  f    e Zd ZU ded<   ded<   ded<   ded<   ded<   d	ed
<   ded<   d Zd Zd Zy)RuleInfor   r   r   implr%   
is_leftrecis_memoizableis_namerh   paramsdictkwparamsc                ,    t        | j                        S r<   )hashr   rL   s    r   __hash__zRuleInfo.__hash__   s    DIIr   c                V    t        |t              r| j                  |j                  k(  S y)NF)rT   r   r   rX   s     r   __eq__zRuleInfo.__eq__   s"    eX&99

**r   c                &    | j                  |       S r<   )r   rX   s     r   __ne__zRuleInfo.__ne__   s    ;;u%%%r   N)r   r   r   rf   r   r   r   r   r   r   r   r      s6    
I
NMLN
&r   r   c                  ,    e Zd ZU ded<   ded<   ded<   y)
RuleResultr   noder,   newposnewstateNr   r   r   r   r   r      s    
IKMr   r   T)slotsc                      e Zd ZU dZded<    ej                  e      Zded<   dZ	ded	<    ej                  e
      Zd
ed<   y)
ParseStater   r,   r   r3   r
   astNr   cstr   r   )r   r   r   r   rf   r[   rg   r
   r   r   rh   r   r   r   r   r   r      sB    CL {  5C5CO++++DAFKAr   r   )"
__future__r   ra   r[   r>   collections.abcr   r   	itertoolsr   typingr   r   r   r
   
tokenizingr   util.unicode_charactersr   r   r   ri   	dataclassr   rl   r}   r   r   r   r   r   r   r   r   r   r   r   <module>r      s    "   	 -  "  ! -	3 	 o. f f fRj ,
J 
z #* #J 

 (j &z &*  T"B B #Br   