bg?# pddlZddlZddlZddlmZmZmZmZddlm Z Gdde j e j e j e je jZeejZejdezdzZGd d eZGd d eZGd deZGddeZGddeZdS)N)collinelineno_collapse_string_to_ranges)pyparsing_unicodeceZdZdS)ExceptionWordUnicodeN)__name__ __module__ __qualname__e/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/pyparsing/exceptions.pyr r sDrr z([z ]{1,16})|.ceZdZdZ ddededejefdZe dd Z e d Z e d efd Ze d efd Ze d efdZe d efdZd efdZdZdddded efdZdd efdZeZdS)ParseBaseExceptionz7base exception class for all parsing runtime exceptionsrNpstrlocmsgc||_|||_d|_n||_||_|x|_|_|||f|_dS)N)rrrparser_element parserElementargs)selfrrrelems r__init__zParseBaseException.__init__sP ;DHDIIDHDI377d03$ rcddl}ddlm}|tj}g}t |t r=||j|d|j dz zdz|d t|j ||dkr| |j|}t}t!|| dD]M\}}|d} | jd d} t | |r| jjd vrHt+| |vrZ|t+| t| } |d | j| j | n| Ct| } |d | j| j n?| j} | jd vr|d | j|dz}|snOd|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 _parseNoCachez {}.{} - {}z{}.{})wrapperzz{} )inspectcorer sysgetrecursionlimit isinstancerappendrcolumnformattyper getinnerframes __traceback__set enumeratef_localsgetf_codeco_nameidaddr join) excdepthr(r retcallersseenifffrmf_self self_typecodes rexplain_exceptionz$ParseBaseException.explain_exception)sW" '''''' =)++E c- . . 5 JJsx JJscj1n-3 4 4 4 8??499#5s;;<<< 199,,S->,NNG55D"7E677#344  2e))&$77fm44:z)1OOO &zzT)) HHRZZ((( $V IJJ$++%0)2Df ' $V IJJw~~i.BIDVWWXXXX:D|'>>> JJt{{4<88999 Eyy~~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_exceptionks# s27BFBFB,<===rreturnc6t|j|jS)zG Return the line of text where the exception occurred. )rrrrs rrzParseBaseException.liness DHdi(((rc6t|j|jS)zV Return the 1-based line number of text where the exception occurred. )rrrrNs rrzParseBaseException.linenozs dh ***rc6t|j|jSz] Return the 1-based column on the line of text where the exception occurred. rrrrNs rrzParseBaseException.col 48TY'''rc6t|j|jSrQrRrNs rr.zParseBaseException.columnrSrc|jr|jt|jkrd}nut|j|j}||d}n|j|j|jdz}d|zdd}nd}d|j||j|j |j S) Nz, found end of textrrz , found %rz\\\rz%{}{} (at char {}), (line:{}, col:{})) rrlen_exception_word_extractormatchgroupreplacer/rrr.)rfoundstr found_matchfounds r__str__zParseBaseException.__str__s 9 x3ty>>))08==diRR *'--a00EE IdhA&=>E(5099%FFH6== Hh$+t{   rc t|SN)strrNs r__repr__zParseBaseException.__repr__s4yyrz>!<) markerString marker_stringc||n|}|j}|jdz }|r(d|d||||df}|S)z Extracts the exception line from the input string, and marks the location of the exception with a special symbol. Nrr)rr.r;strip)rrerdline_str line_columns rmark_input_linez"ParseBaseException.mark_input_linesm )6(A}}| 9kAo  ww,;,'x 7MNH~~rc.|||S)a  Method to translate the Python internal traceback into a list of the pyparsing expressions that caused the exception to be raised. Parameters: - 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. Example:: expr = pp.Word(pp.nums) * 3 try: expr.parse_string("123 456 A789") except pp.ParseException as pe: print(pe.explain(depth=0)) prints:: 123 456 A789 ^ ParseException: Expected W:(0-9), found 'A' (at char 8), (line:1, col:9) Note: the diagnostic output will include string representations of the expressions that failed to parse. These representations will be more helpful if you use `set_name` to give identifiable names to your expressions. Otherwise they will use the default string forms, which may be cryptic to read. Note: pyparsing's default truncation of exception tracebacks may also truncate the stack of expressions that are displayed in the ``explain`` output. To get the full listing of parser expressions, you may have to set ``ParserElement.verbose_stacktrace = True`` )rG)rr=s rexplainzParseBaseException.explainsJ%%dE222r)rNN)rra)r r r __doc__rbinttypingOptionalr staticmethodrG classmethodrKpropertyrrrr.r_rcrjrl markInputlinerrrrrsAA$(  %%%%_S ! %%%%"???\?B>>[>)c)))X) ++++X+ (S(((X( ((((X(      $      S  SV     %3%33%3%3%3%3N$MMMrrceZdZdZdS)ParseExceptionaq Exception thrown when a parse expression doesn't match the input string Example:: try: Word(nums).set_name("integer").parse_string("ABC") except ParseException as pe: print(pe) print("column: {}".format(pe.column)) prints:: Expected integer (at char 0), (line:1, col:1) column: 1 Nr r r rmrrrrvrvsrrvceZdZdZdS)ParseFatalExceptionzu User-throwable exception thrown when inconsistent parse content is found; stops all parsing immediately NrwrrrryrysrryceZdZdZdS)ParseSyntaxExceptionz Just like :class:`ParseFatalException`, but thrown internally when an :class:`ErrorStop` ('-' operator) indicates that parsing is to stop immediately because an unbacktrackable syntax error has been found. Nrwrrrr{r{srr{c$eZdZdZdZdefdZdS)RecursiveGrammarExceptionz 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||_dSra)parseElementTrace)rparseElementLists rrz"RecursiveGrammarException.__init__s!1rrLc6d|jS)NzRecursiveGrammarException: {})r/rrNs rr_z!RecursiveGrammarException.__str__ s.55d6LMMMrN)r r r rmrrbr_rrrr}r}sO 222NNNNNNNrr})rer*routilrrrrunicoderppuLatin1LatinALatinBGreekCyrillicr alphanums_extract_alphanumscompilerX Exceptionrrvryr{r}rrrrs ????????????------     3:sz3:sy#,   0/0D0NOO&BJt.@'@<'OPPF$F$F$F$F$F$F$F$R'(,. N N N N N N N N N Nr