\h& ddlmZddlZddlZddlZddlZddlmZddlm Z ddl m Z m Z mZmZmZGdde je je je je jZe ejZejd ezd zZGd d eZGd deZGddeZGddeZGddeZ dS)) annotationsN)cached_property)pyparsing_unicode)_collapse_string_to_rangescollinelinenoreplaced_by_pep8ceZdZdS)_ExceptionWordUnicodeSetN)__name__ __module__ __qualname__d/home/jenkins/workspace/simtester-sanitize/venv/lib/python3.11/site-packages/pyparsing/exceptions.pyr r s Drr z([z ]{1,16})|.ceZdZUdZded<ded<ded<ded<d ed <d Z d*d+dZed,d-dZe d.dZ e d/dZ e d0dZ e d0dZe d0dZe d/dZedZejdZdZd/d Zd/d!Zd"Z d1d#d$d2d'Zd,d3d(Zed)eZd S)4ParseBaseExceptionz7base exception class for all parsing runtime exceptionsintlocstrmsgpstrz typing.Anyparser_elementz%tuple[str, int, typing.Optional[str]]argsrrrrrrNtyping.Optional[str]returnNonec^||d}}||_||_||_||_|||f|_dS)Nr)selfrrrelems r__init__zParseBaseException.__init__1sA ;bC "3$ rexc Exceptiondepthclddl}ddlm}|tj}g}t |t r9||j|dd|j |t|j d||dks|j d |S||j | }t}|| dD],}|d}|jd d} t | |r|jjd sVt+| |vrh|t+| t| } || jd | j d | nb| 4t| } || jd | j n,|j} | jdvr || j|dz}|sn.d |S)a Method to take an exception and translate the Python internal traceback into a list of the pyparsing expressions that caused the exception to be raised. Parameters: - exc - exception raised during parsing (need not be a ParseException, in support of Python exceptions that might be raised in a parse action) - depth (default=16) - number of levels back in the stack trace to list expression and function names; if None, the full stack trace names will be listed; if 0, only the failing input line, marker, and exception string will be shown Returns a multi-line string listing the ParserElements and/or function names in the exception's stack trace. rNr) ParserElement^>z:  )contextr#) parseImpl _parseNoCache.z - )wrapperz)inspectcorer+sysgetrecursionlimit isinstancerappendr columntyper __traceback__joingetinnerframessetf_localsgetf_codeco_name startswithidaddr) r'r)r4r+retcallersseenfffrmf_self self_typecodes rexplain_exceptionz$ParseBaseException.explain_exceptionAsV" '''''' =)++E c- . . / JJsx JJ#- --- . . . d3ii(11C11222 A::*299S>> !(():E(JJ5&''"  BQ%C\%%fd33F&-00 )z)445STTf::%%F$$$ LL  i2TTY5GTTFTTUUUU# LL  i2IIY5GIIJJJJz<#::: 4<((( QJE  yy~~rcF||j|j|j|jS)z internal factory method to simplify creating one type of ParseException from another - avoids having __init__ signature conflicts among subclasses )rrrr)clspes r_from_exceptionz"ParseBaseException._from_exceptions# s27BFBFB,=>>>rc6t|j|jS)zG Return the line of text where the exception occurred. )r rrr#s rr zParseBaseException.lines DHdi(((rc6t|j|jS)zV Return the 1-based line number of text where the exception occurred. )r rrrUs rr zParseBaseException.linenos dh ***rc6t|j|jSz] Return the 1-based column on the line of text where the exception occurred. rrrrUs rrzParseBaseException.col 48TY'''rc6t|j|jSrXrYrUs rr:zParseBaseException.columnrZrcJ|jsdS|jt|jkrdSt|j|j}||d}n|j|j|jdz}t |ddS)Nr"z end of textrrz\\\)rrlen_exception_word_extractormatchgroupreprreplace)r# found_match found_texts rfoundzParseBaseException.foundsy 2 8s49~~ % % =055diJJ  "$**1--JJ48dhl#:;JJ''t444rc|jSNrrUs r parserElementz ParseBaseException.parserElements ""rc||_dSrhri)r#r$s rrjz ParseBaseException.parserElements"rc*tj|Srh)copyrUs rrmzParseBaseException.copysyrc p|jr d|jnd}|j|d|jd|jd|jd S)Nz, found r"z (at char z ), (line:z, col:))rfrrr r:)r# found_phrases rformatted_messagez$ParseBaseException.formatted_messagesT26*D.$*..." (iLiiTXii ii[_[fiiiirc*|Srh)rqrUs r__str__zParseBaseException.__str__s%%'''rc t|Srh)rrUs r__repr__zParseBaseException.__repr__s4yyrz>!<) markerString marker_stringrvc||n|}|j}|jdz }|r|d||||d}|S)z Extracts the exception line from the input string, and marks the location of the exception with a special symbol. Nr)r r:strip)r#rwrvline_str line_columns rmark_input_linez"ParseBaseException.mark_input_linesd)6(A}}| 9kAo  Y"` ('-' operator) indicates that parsing is to stop immediately because an unbacktrackable syntax error has been found. Nrrrrrr#srrc"eZdZdZddZd dZdS) RecursiveGrammarExceptiona6 Exception thrown by :class:`ParserElement.validate` if the grammar could be left-recursive; parser may need to enable left recursion using :class:`ParserElement.enable_left_recursion` Deprecated: only used by deprecated method ParserElement.validate. rr c||_dSrhparseElementTrace)r#parseElementLists rr%z"RecursiveGrammarException.__init__5s!1rrcd|jS)NzRecursiveGrammarException: rrUs rrsz!RecursiveGrammarException.__str__8sET-CEEErN)rr r)rrrrr%rsrrrrr,sL2222FFFFFFrr)! __future__rrmrer6typing functoolsrunicoderppuutilrrr r r Latin1LatinALatinBGreekCyrillicr alphanums_extract_alphanumscompiler_r(rrrrrrrrrs"""""" %%%%%%------     J CJ 3<   0/0H0RSS&BJt.@'@<'OPPgGgGgGgGgGgGgGgGV'&,. F F F F F F F F F Fr