[i* ddlmZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl mZmZmZmZmZmZGdd e je je je je jZeejZejd ed ZGd d eZGddeZ GddeZ!Gdde!Z"GddeZ#dS)) annotationsN)cached_property)PyparsingDeprecationWarning)pyparsing_unicode)_collapse_string_to_rangescoldeprecate_argumentlinelinenoreplaced_by_pep8ceZdZdS)_ExceptionWordUnicodeSetN)__name__ __module__ __qualname__d/home/jenkins/workspace/simtester-sanitize/venv/lib/python3.11/site-packages/pyparsing/exceptions.pyrrs Drrz([z ]{1,16})|.ceZdZUdZded<ded<ded<ded<d ed <d Z d'd(dZed)d*dZe d+dZ e d,dZ e d-dZ e d-dZe d-dZe d,dZedZejdZdZd,d Zd,d!Zd"Z d.d/d$Zd)d0d%Zed&eZd S)1ParseBaseExceptionz7base 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__4sA ;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^>:  )contextr%) parseImpl _parseNoCache.z - )wrapperz)inspectcorer-sysgetrecursionlimit isinstancerappendr columntyper __traceback__joingetinnerframessetf_localsgetf_codeco_name startswithidaddr) r)r+r7r-retcallersseenfffrmf_self self_typecodes rexplain_exceptionz$ParseBaseException.explain_exceptionDsV" '''''' =)++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 rrrXs rr zParseBaseException.linenos dh ***rc6t|j|jSz] Return the 1-based column on the line of text where the exception occurred. r rrrXs rr zParseBaseException.col 48TY'''rc6t|j|jSr[r\rXs rr=zParseBaseException.columnr]rc0|jsdS|jt|jkrdSt|j|j}| |d}n|j|j|jdz}t |ddS)Nr$z end of textrrz\\\)rrlen_exception_word_extractormatchreprreplace)r% found_match found_texts rfoundzParseBaseException.foundsy 2 8s49~~ % % =055diJJ  "$QJJ48dhl#:;JJ''t444rcHtjdtd|jSNz/parserElement is deprecated, use parser_element) stacklevelwarningswarnrrrXs r parserElementz ParseBaseException.parserElements/ = '    ""rcLtjdtd||_dSrjrm)r%r&s rrpz ParseBaseException.parserElements4 = '    #rc*tj|SN)copyrXs rrtzParseBaseException.copysyrc p|jr d|jnd}|j|d|jd|jd|jd S)z Output the formatted exception message. Can be overridden to customize the message formatting or contents. .. versionadded:: 3.2.0 z, found r$z (at char z ), (line:z, col:))rhrrr r=)r% found_phrases rformatted_messagez$ParseBaseException.formatted_messagesV37*D.$*..." (iLiiTXii ii[_[fiiiirc  |S#t$rA}t|jd|jdt|jd|dcYd}~Sd}~wwxYw)zl .. versionchanged:: 3.2.0 Now uses :meth:`formatted_message` to format message. r0z (z while formatting message)N)rxr*r>rr)r%exs r__str__zParseBaseException.__str__s  ))++ +   ::&II$(II"XX&II*,III       s A!6AA!A!c t|Srs)rrXs r__repr__zParseBaseException.__repr__s4yyr marker_stringc t|dd}||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. markerStringz>!` ('-' operator) indicates that parsing is to stop immediately because an unbacktrackable syntax error has been found. NrrrrrrJsrrc"eZdZdZddZd dZdS) RecursiveGrammarExceptionaL .. deprecated:: 3.0.0 Only used by the deprecated :meth:`ParserElement.validate`. 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` r!r"c||_dSrsparseElementTrace)r%parseElementLists rr'z"RecursiveGrammarException.__init__]s!1rrcd|jS)NzRecursiveGrammarException: rrXs rr{z!RecursiveGrammarException.__str__`sET-CEEErN)r!r"r)rrrrr'r{rrrrrSsL2222FFFFFFrr)$ __future__rrtrer9typingrn functoolsrrunicoderppuutilrr r r r r Latin1LatinALatinBGreekCyrillicr alphanums_extract_alphanumscompilerbr*rrrrrrrrrs7"""""" %%%%%%111111------     J CJ 3<   0/0H0RSS&BJ'M-?'M'M'MNNGGGGGGGGGGGGGGGGV'.,.FFFFF FFFFFr