Mpj* ddlmZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl mZmZmZmZmZmZGdd e j(e j*e j,e j.e j0Zeej4Zej8d ed ZGd d eZGddeZ GddeZ!Gdde!Z"GddeZ#y)) annotationsN)cached_property)PyparsingDeprecationWarning)pyparsing_unicode)_collapse_string_to_rangescoldeprecate_argumentlinelinenoreplaced_by_pep8c eZdZy)_ExceptionWordUnicodeSetN)__name__ __module__ __qualname__b/mnt/ssd/data/Dropbox/adrian/scripts/msg_venv/lib/python3.12/site-packages/pyparsing/exceptions.pyrrs rrz([z ]{1,16})|.cdeZdZUdZded<ded<ded<ded<d ed <d Z d dd Zed d!dZe d"dZ e d#dZ e d$dZ e d$dZe d$dZe d#dZedZej&dZdZd#dZd#dZdZ d% d&dZd d'dZedeZy )(ParseBaseExceptionz7base exception class for all parsing runtime exceptionsintlocstrmsgpstrz typing.Anyparser_elementz%tuple[str, int, typing.Optional[str]]argsrrrrrNc\||d}}||_||_||_||_|||f|_y)Nr)selfrrrelems r__init__zParseBaseException.__init__4s= ;bC "3$ rcVddl}ddlm}|tj}g}t |t r<|j|j|jdd|jd|jt|jd||dks |jd j|S|j|j| }t}|| dD]/}|d}|j j#d d} t | |r|j$j&j)d sWt+| |vre|j-t+| t| } |j| j.d | jd| no| 6t| } |j| j.d | jn7|j$} | j&dvr |j| j&|dz}|r0nd j|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^>r!:  )contextr") parseImpl _parseNoCache.z - )wrapperz)inspectcorer&sysgetrecursionlimit isinstancerappendr columntyper __traceback__joingetinnerframessetf_localsgetf_codeco_name startswithidaddr) excdepthr0r&retcallersseenfffrmf_self self_typecodes rexplain_exceptionz$ParseBaseException.explain_exceptionDs" ' =))+E c- . JJsxx JJ#a |0^, . d3i(()C512 A:**299S> !(():):E(J5&'" BQ%C\\%%fd3F&-0zz))445STf:%F$ L  i2231Y5G5G4HF8TU# L  i2231Y5G5G4HIJzz<<#:: 4<<( QJE7 :yy~rch||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' 277BFFBFFB,=,=>>rcBt|j|jS)zG Return the line of text where the exception occurred. )r rrr"s rr zParseBaseException.lines DHHdii((rcBt|j|jS)zV Return the 1-based line number of text where the exception occurred. )r rrrSs rr zParseBaseException.linenos dhh **rcBt|j|jSz] Return the 1-based column on the line of text where the exception occurred. r rrrSs rr zParseBaseException.col 488TYY''rcBt|j|jSrVrWrSs rr6zParseBaseException.columnrXrcH|jsy|jt|jk\rytj |j|j}||d}n&|j|j|jdz}t |j ddS)Nr!z end of textrrz\\\)rrlen_exception_word_extractormatchreprreplace)r" found_match found_texts rfoundzParseBaseException.foundsyy 88s499~ % 055diiJ  "$QJ488dhhl;JJ''t44rcRtjdtd|jSNz/parserElement is deprecated, use parser_element) stacklevelwarningswarnrrrSs r parserElementz ParseBaseException.parserElements% = ' """rcJtjdtd||_yrerh)r"r#s rrkz ParseBaseException.parserElements! = ' #rc,tj|SN)copyrSs rrozParseBaseException.copysyyrc |jrd|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:))rcrrr r6)r" found_phrases rformatted_messagez$ParseBaseException.formatted_messagesU37**$**." ((L>TXXJi }TZ[_[f[fZgghiirc  |jS#t$rH}t|jd|jdt|jd|dcYd}~Sd}~wwxYw)zl .. versionchanged:: 3.2.0 Now uses :meth:`formatted_message` to format message. r)z (z while formatting message)N)rs Exceptionr7rr)r"exs r__str__zParseBaseException.__str__sf  ))+ + :&&'r$((T"X&&'r"-GI  s A#=AA#A#ct|Srn)rrSs r__repr__zParseBaseException.__repr__s 4yrc t|dd}||n|}|j}|jdz }|r|d||||d}|jS)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 eZdZdZddZddZy)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` c||_yrnparseElementTrace)r"parseElementLists rr$z"RecursiveGrammarException.__init__]s !1rc d|jS)NzRecursiveGrammarException: rrSs rrwz!RecursiveGrammarException.__str__`s,T-C-C,DEErN)rrr)rrrrr$rwrrrrrSs2Frr)$ __future__rrorer2typingri functoolsrrunicoderppuutilrr r r r r Latin1LatinALatinBGreekCyrillicr alphanums_extract_alphanumscompiler]rurrrrrrrrrs" %1- JJ CJJ 3<< 00H0R0RS&BJJ"-?,@ 'MNGGGGV'.,.F Fr