K i@( ddlmZddlZddlZddlZddlZddlmZddlm Z ddl m Z m Z mZmZmZGdde j"e j$e j&e j(e j*Ze ej.Zej2d ezd zZGd d eZGd deZGddeZGddeZGddeZ y)) annotationsN)cached_property)pyparsing_unicode)_collapse_string_to_rangescollinelinenoreplaced_by_pep8c eZdZy)_ExceptionWordUnicodeSetN)__name__ __module__ __qualname__Z/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/pyparsing/exceptions.pyr r s rr z([z ]{1,16})|.cneZdZUdZded<ded<ded<ded<d ed <d Z d d!d Zed"d#dZe d$dZ e d%dZ e d&dZ e d&dZe d&dZe d%dZedZej&dZdZd%dZd%dZdZ d'dd 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__1s= ;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^>rz:  )contextr ) parseImpl _parseNoCache.z - )wrapperz)inspectcorer$sysgetrecursionlimit isinstancerappendr columntyper __traceback__joingetinnerframessetf_localsgetf_codeco_name startswithidaddr) excdepthr-r$retcallersseenfffrmf_self self_typecodes rexplain_exceptionz$ParseBaseException.explain_exceptionAs" ' =))+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 rrrPs rr zParseBaseException.linenos dhh **rcBt|j|jSz] Return the 1-based column on the line of text where the exception occurred. rrrrPs rrzParseBaseException.col 488TYY''rcBt|j|jSrSrTrPs rr3zParseBaseException.columnrUrc`|jsy|jt|jk\rytj |j|j}||j d}n&|j|j|jdz}t |jddS)Nrz end of textrrz\\\)rrlen_exception_word_extractormatchgroupreprreplace)r found_match found_texts rfoundzParseBaseException.foundsyy 88s499~ % 055diiJ  "$**1-J488dhhl;JJ''t44rc|jSNrrPs r parserElementz ParseBaseException.parserElements"""rc||_yrcrd)r r!s rrez ParseBaseException.parserElements "rc,tj|Src)copyrPs rrhzParseBaseException.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 rz (at char z ), (line:z, col:))rarrr r3)r found_phrases rformatted_messagez$ParseBaseException.formatted_messagesU37**$**." ((L>TXXJi }TZ[_[f[fZgghiirc"|jS)zl .. versionchanged:: 3.2.0 Now uses :meth:`formatted_message` to format message. )rlrPs r__str__zParseBaseException.__str__s %%''rct|Src)rrPs r__repr__zParseBaseException.__repr__s 4yrz>!<) markerStringc||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. Nr)r r3strip)r marker_stringrqline_str line_columns rmark_input_linez"ParseBaseException.mark_input_linesX)6(A}| 99kkAo "` ('-' operator) indicates that parsing is to stop immediately because an unbacktrackable syntax error has been found. Nrrrrrr5srrc 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||_yrcparseElementTrace)r parseElementLists rr"z"RecursiveGrammarException.__init__Hs !1rc d|jS)NzRecursiveGrammarException: rrPs rrnz!RecursiveGrammarException.__str__Ks,T-C-C,DEErN)r|r}r)rrrrr"rnrrrrr>s2Frr)! __future__rrhrer/typing functoolsrunicoderppuutilrrr r r Latin1LatinALatinBGreekCyrillicr alphanums_extract_alphanumscompilerZrrrrrrrrrrs" %- JJ CJJ 3<< 00H0R0RS&BJJt.@'@<'OPuGuGr'.,.F Fr