2bi%SSKrSSKrSSKrSSKrSSKJr SSK7 SSKJ r J r J r J r ScSS.S\ S\R\ S \R\ S \ 4S jjjrS\ S \ 4S jrS\ S \ 4S jrSdSSS.S\\R&\\4S\S\S\S\S\S \ 4SjjjrS\ S\ S \ 4SjrSeSS.S\ S\S\S \ 4SjjjrS\ S \ 4SjrS\ S \ 4S jrS!S"S\"54\"5S#.S$\\\ 4S%\\\ 4S&\R\ S'\ S(\ S \ 4 S)jjjr\"S*5\"S+54S,jrS-\\\ 4S \\ \ 44S.jr S-\\\ 4S \\ \ 44S/jr!\ \"S0'\ \"S1'\ "\#"\$\%S2-5RMS355ur'r(\RRRTRW5VVs0sHupURYS45U_M snnr-\."S5S6R_\-5-S7-5RMS85r0S9r1"S:S;\25r3\\ \\\\ \4\\ \444r4\\\4\5\3\R\64\\4\5\344r7\"S!5\"S"54S<\ S=\8\7S>\\\ 4S?\\\ 4S \ 4 S@jjr9S/4SAjr:\;"\."SB5SC-5RMSD5r<\."SE5RMSF5r=\."SG5R}5RMSH5r?\."SI5RMSJ5r@\;"\."SB5SC-\@-5RMSK5rA\ArB\."SL5RMSM5rC\D"5R5Vs/sHn\F"U\ 5(dMUPM snrG\8\ \"SN'SfSSO.S\\\ 4SP\\\ 4SQ\SR\R\5SS\R\5ST\S \ 4SUjjjrH\3rI\'rJ\(rK\0rL\ ['ab', 'cd'] # in this parser, the leading integer value is given in binary, # '10' indicating that 2 values are in the array binary_constant = Word('01').set_parse_action(lambda t: int(t[0], 2)) counted_array(Word(alphas), int_expr=binary_constant).parse_string('10 ab cd ef') # -> ['ab', 'cd'] # if other fields must be parsed after the count but before the # list items, give the fields results names and they will # be preserved in the returned ParseResults: count_with_metadata = integer + Word(alphas)("type") typed_array = counted_array(Word(alphanums), int_expr=count_with_metadata)("items") result = typed_array.parse_string("3 bool True True False") print(result.dump()) # prints # ['True', 'True', 'False'] # - items: ['True', 'True', 'False'] # - type: 'bool' cL>USnTU(aTU-O [5-mUSS2 gNr)Empty)sltn array_exprr s ڏ/builddir/build/BUILDROOT/alt-python313-pip-23.3.1-3.el8.x86_64/opt/alt/python313/lib/python3.13/site-packages/pip/_vendor/pyparsing/helpers.pycount_field_parse_action/counted_array..count_field_parse_action@s' aDQqEG3 aDc[US5$r)intrs rcounted_array..Hs AaD rarrayLenT)call_during_tryz(len) z...)ForwardWordnumsset_parse_actioncopyset_nameadd_parse_actionstr)r r r rrs` @r counted_arrayr*sR!GJt*--.AB,,. Z  5tL j * *8c$i+?%+G HHrc^[5mU4SjnURUSS9 TRS[U5-5 T$)a Helper to define an expression that is indirectly defined from the tokens matched in a previous expression, that is, it looks for a 'repeat' of a previous expression. For example:: first = Word(nums) second = match_previous_literal(first) match_expr = first + ":" + second will match ``"1:1"``, but not ``"1:2"``. Because this matches a previous literal, will also match the leading ``"1:1"`` in ``"1:10"``. If this is not desired, use :class:`match_previous_expr`. Do *not* use with packrat parsing enabled. c>U(aG[U5S:Xa TUS- g[UR55nT[SU55- gT[ 5- g)Nrrc38# UHn[U5v M g7fN)Literal).0tts r Imatch_previous_literal..copy_token_to_repeater..hs7272;;)lenras_listAndr)rrrtflatreps rcopy_token_to_repeater6match_previous_literal..copy_token_to_repeaterasJ 1v{qt !-s7777 57NrT callDuringTry(prev) )r"r(r'r))r r:r9s @rmatch_previous_literalr?PsA )C  0ELLSY&' Jrc^[5mUR5nTU-mU4SjnURUSS9 TRS[ U5-5 T$)a+Helper to define an expression that is indirectly defined from the tokens matched in a previous expression, that is, it looks for a 'repeat' of a previous expression. For example:: first = Word(nums) second = match_previous_expr(first) match_expr = first + ":" + second will match ``"1:1"``, but not ``"1:2"``. Because this matches by expressions, will *not* match the leading ``"1:1"`` in ``"1:10"``; the expressions are evaluated first, and then compared, so ``"1"`` is compared with ``"10"``. Do *not* use with packrat parsing enabled. cf>^[UR55mU4SjnTRUSS9 g)Nch>[UR55nUT:wa[XSTSU35eg)Nz Expected z, found)rr6ParseException)rrr theseTokens matchTokenss rmust_match_these_tokensTmatch_previous_expr..copy_token_to_repeater..must_match_these_tokenss?"199;/Kk)$Ik]'+G*rTr<)rr6r%)rrrrFrEr9s @rr:3match_previous_expr..copy_token_to_repeaters.qyy{+   4DIrTr<r>)r"r&r(r'r))r e2r:r9s @rmatch_previous_exprrJqsV )C BBJC J 0ELLSY&' JrFT)useRegex asKeywordstrscaseless use_regex as_keywordrKrLc^^U=(d UnU=(a Un[U[5(a)[R(a[R SSS9 U(aSnSnU(a[ O[mOSnSnU(a[O[m/n[U[5(a,[R"[U5nUR5nO,[U[5(a [U5nO [!S5eU(d [#5$[%S U55(aS n U ['U5S - :auXn [)XS -S 5HDupU"X5(a XU -S - O1U"X5(dM+XU -S - UR+X5 O U S - n U ['U5S - :aMuU(aU(a[,R.OS n [1S U55(aSSR3SU55S3nOSR3SU55nU(aSUS3n[5XS9R7SR3U55nU(a7UVs0sHnUR95U_M snmUR;U4Sj5 U$[?U4SjU55R7SR3U55$s snf![,R<a [R SSS9 Nbf=f)aHelper to quickly define a set of alternative :class:`Literal` s, and makes sure to do longest-first testing when there is a conflict, regardless of the input order, but returns a :class:`MatchFirst` for best performance. Parameters: - ``strs`` - a string of space-delimited literals, or a collection of string literals - ``caseless`` - treat all literals as caseless - (default= ``False``) - ``use_regex`` - as an optimization, will generate a :class:`Regex` object; otherwise, will generate a :class:`MatchFirst` object (if ``caseless=True`` or ``as_keyword=True``, or if creating a :class:`Regex` raises an exception) - (default= ``True``) - ``as_keyword`` - enforce :class:`Keyword`-style matching on the generated expressions - (default= ``False``) - ``asKeyword`` and ``useRegex`` are retained for pre-PEP8 compatibility, but will be removed in a future release Example:: comp_oper = one_of("< = > <= >= !=") var = Word(alphas) number = Word(nums) term = var | number comparison_expr = term + comp_oper + term print(comparison_expr.search_string("B = 12 AA=23 B<=AA AA>12")) prints:: [['B', '=', '12'], ['AA', '=', '23'], ['B', '<=', 'AA'], ['AA', '>', '12']] z`More than one string argument passed to one_of, pass choices as a list or space-delimited string) stacklevelcDUR5UR5:H$r.)upperabs rrone_of..sqwwyAGGI5rc\UR5RUR55$r.)rU startswithrVs rrrYsQWWY11!'')# UHn[U5S:v M g7frNr5r0syms rr2one_of..s +7C3s8a<7rrNc3># UHn[U5S:Hv M g7fr`rarbs rr2rds4GS3s8q=Gre[c38# UHn[U5v M g7fr.)rrbs rr2rds"UWc#TUSR5$rlower)rrr symbol_maps rrrYsZ! 5Mrz8Exception creating Regex for one_of, building MatchFirstc34># UH nT"U5v M g7fr.r])r0rcparseElementClasss rr2rds@',,s) isinstancestr_typer%warn_on_multiple_string_args_to_oneofwarningswarnCaselessKeywordCaselessLiteralKeywordr/typingcastr)splitIterablelist TypeErrorNoMatchanyr5 enumerateinsertrm IGNORECASEalljoinRegexr'rrr(error MatchFirst)rMrNrOrPrKrLisequalmaskssymbolsicurjotherre_flagspattretrcrurss @@rone_ofrsR'ZI%IH 8X&&  : :  ;  5</8Oo%,'0GgG$!!{{3%**, D( # #t*QRR y +7 +++ #g,""*C%g!eg&675&&A *3&&A *NN1,8Q#g,"")1 q 4G444277"UW"UUVVWXxxB'BBvS)-66uzz'7JKC;BB'3ciik3.'B $$%MNJ @@ @ I I 7 C xx  MMJWX   s%B K K8K K (K54K5keyvaluec@[[[X-555$)aHelper to easily and clearly define a dictionary by specifying the respective patterns for the key and value. Takes care of defining the :class:`Dict`, :class:`ZeroOrMore`, and :class:`Group` tokens in the proper order. The key pattern can include delimiting markers or punctuation, as long as they are suppressed, thereby leaving the significant key text. The value pattern can include named results, so that the :class:`Dict` results can include named token fields. Example:: text = "shape: SQUARE posn: upper left color: light blue texture: burlap" attr_expr = (label + Suppress(':') + OneOrMore(data_word, stop_on=label).set_parse_action(' '.join)) print(attr_expr[1, ...].parse_string(text).dump()) attr_label = label attr_value = Suppress(':') + OneOrMore(data_word, stop_on=label).set_parse_action(' '.join) # similar to Dict, but simpler call format result = dict_of(attr_label, attr_value).parse_string(text) print(result.dump()) print(result['shape']) print(result.shape) # object attribute access works too print(result.as_dict()) prints:: [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'light blue'], ['texture', 'burlap']] - color: 'light blue' - posn: 'upper left' - shape: 'SQUARE' - texture: 'burlap' SQUARE SQUARE {'color': 'light blue', 'shape': 'SQUARE', 'posn': 'upper left', 'texture': 'burlap'} )Dict OneOrMoreGroup)rrs rdict_ofrsJ  % ,- ..r)asString as_stringrcDU=(a Un[5RS5nUR5nSUlU"S5U-U"S5-nU(aSnOSnURU5 URUlUR [ R5 U$)aHelper to return the original, untokenized text for a given expression. Useful to restore the parsed fields of an HTML start tag into the raw tag text itself, or to revert separate tokens with intervening whitespace back to the original matching input text. By default, returns a string containing the original parsed text. If the optional ``as_string`` argument is passed as ``False``, then the return value is a :class:`ParseResults` containing any results names that were originally matched, and a single token containing the original matched text from the input string. So if the expression passed to :class:`original_text_for` contains expressions with defined results names, you must set ``as_string`` to ``False`` if you want to preserve those results name values. The ``asString`` pre-PEP8 argument is retained for compatibility, but will be removed in a future release. Example:: src = "this is test bold text normal text " for tag in ("b", "i"): opener, closer = make_html_tags(tag) patt = original_text_for(opener + ... + closer) print(patt.search_string(src)[0]) prints:: [' bold text '] ['text'] cU$r.r])rlocrs rr#original_text_for.._s3rF_original_start _original_endc2XRUR$r.)rrrrrs rrrdsa(9(9AOO&LrcPXRS5URS5/USS&g)Nrrpoprs r extractText&original_text_for..extractTextgs&ee-.1GHIAaDr)rr%r& callPreparse ignoreExprssuppress_warning Diagnostics)warn_ungrouped_named_tokens_in_collection)r rr locMarker endlocMarker matchExprrs roriginal_text_forr;sD%IH(()>?I>>#L %L+,t3l?6SSIL  J{+ ,,I {TTU rc8[U5RS5$)zcHelper to undo pyparsing's default grouping of And expressions, even if all but one are non-empty. c US$rr]rs rrungroup..ts1Q4r)TokenConverterr()r s rungrouprps $  0 0 @@rc[5RS5n[U"S5U"S5-UR5R 5"S5-5$)a (DEPRECATED - future code should use the :class:`Located` class) Helper to decorate a returned token with its starting and ending locations in the input string. This helper adds the following results names: - ``locn_start`` - location where matched expression begins - ``locn_end`` - location where matched expression ends - ``value`` - the actual parsed results Be careful if the input text contains ```` characters, you may want to call :class:`ParserElement.parse_with_tabs` Example:: wd = Word(alphas) for match in locatedExpr(wd).search_string("ljsdf123lksdjjf123lkkjj1222"): print(match) prints:: [[0, 'ljsdf', 5]] [[8, 'lksdjjf', 15]] [[18, 'lkkjj', 23]] cU$r.r])ssllr1s rrlocatedExpr..s"r locn_startrlocn_end)rr%rr&leaveWhitespace)r locators r locatedExprrwsT6g&&'<=G   w-  ,,. ( ( *: 6 7 r()) ignoreExpropenerclosercontent ignore_exprrc XC:waU[5:XaUOUnX:Xa [S5eUGc[U[5(Ga[U[5(Ga[R "[ U5n[R "[ U5n[U5S:Xa[U5S:XaUbE[[U)[X-[R-SS9-55RS5nGO[R5[X-[R-5RS5-nOUbY[[U)[!U5)-[!U5)-[[RSS9-55RS5nO`[[[!U5)[!U5)-[[RSS9-55RS5nO [S5e[#5nUb5U[%['U5[)XE-U-5-['U5-5-nO1U[%['U5[)XR-5-['U5-5-nUR+S U<U<S 35 U$) aR Helper method for defining nested lists enclosed in opening and closing delimiters (``"("`` and ``")"`` are the default). Parameters: - ``opener`` - opening character for a nested list (default= ``"("``); can also be a pyparsing expression - ``closer`` - closing character for a nested list (default= ``")"``); can also be a pyparsing expression - ``content`` - expression for items within the nested lists (default= ``None``) - ``ignore_expr`` - expression for ignoring opening and closing delimiters (default= :class:`quoted_string`) - ``ignoreExpr`` - this pre-PEP8 argument is retained for compatibility but will be removed in a future release If an expression is not provided for the content argument, the nested expression will capture all whitespace-delimited content between delimiters as a list of separate values. Use the ``ignore_expr`` argument to define expressions that may contain opening or closing characters that should not be treated as opening or closing characters for nesting, such as quoted_string or a comment expression. Specify multiple expressions using an :class:`Or` or :class:`MatchFirst`. The default is :class:`quoted_string`, but if no expressions are to be ignored, then pass ``None`` for this argument. Example:: data_type = one_of("void int short long char float double") decl_data_type = Combine(data_type + Opt(Word('*'))) ident = Word(alphas+'_', alphanums+'_') number = pyparsing_common.number arg = Group(decl_data_type + ident) LPAR, RPAR = map(Suppress, "()") code_body = nested_expr('{', '}', ignore_expr=(quoted_string | c_style_comment)) c_function = (decl_data_type("type") + ident("name") + LPAR + Opt(DelimitedList(arg), [])("args") + RPAR + code_body("body")) c_function.ignore(c_style_comment) source_code = ''' int is_odd(int x) { return (x%2); } int dec_to_hex(char hchar) { if (hchar >= '0' && hchar <= '9') { return (ord(hchar)-ord('0')); } else { return (10+ord(hchar)-ord('A')); } } ''' for func in c_function.search_string(source_code): print("%(name)s (%(type)s) args: %(args)s" % func) prints:: is_odd (int) args: [['int', 'x']] dec_to_hex (int) args: [['char', 'hchar']] z.opening and closing strings cannot be the samer)exactc(USR5$rstriprs rrnested_expr..1rc(USR5$rrrs rrrrrc(USR5$rrrs rrrrrc(USR5$rrrs rrr rrzOopening and closing arguments must be strings if no content expression is givenznested z expression) quoted_string ValueErrorrvrwr~rr)r5Combiner CharsNotIn ParserElementDEFAULT_WHITE_CHARSr%emptyr&r/r"rSuppress ZeroOrMorer')rrrrrrs r nested_exprrsZV $.-/$A[z  IJJ fh ' 'Jvx,H,H[[f-F[[f-F6{aCK1$4)%!'K( &-2S2S S&''&'=>$jjlZ-*K*KK.&&'=>?G)%!'K&v./&v./))J)JRSTU'&'=>&!$V_,&v./()J)JRSTU '&'=> a  )C  V z**:W*DE EQWHX X   hv&CM)BBXfEUUVVLLVV<= Jr<>c ^[U[5(aUm[X(+S9nO URm[ [ [ S-5nU(a[R5R[5nUU"S5-[[[U[S5-U-555-[SS/S9"S5RS 5-U-nO[ R5R[5[ ["S S 9-nUU"S5-[[[URS 5[[S5U-5-555-[SS/S9"S5RS 5-U-n[%['S5U-S -SS9nUR)ST-5 UR+U4Sj5 U"SSR-TR/SS5R15R355-5R)ST-5nTUlTUl[7U"55UlXg4$)zRInternal helper to construct opening and closing tag expressions, given a tag name)rNz_-:tag=/F)defaultrcUSS:H$Nrrr]rs rr_makeTags..- ! rr) exclude_charsc(USR5$rrqrs rrr;sqtzz|rcUSS:H$rr]rs rrrArrzc >URSSRTRSS5R5R 55-UR 55$)Nstartrh: ) __setitem__rreplacetitlerr&)rresnames rrrJsD!-- bgggooc37==?EEGH H!&&( rendrhrrz)rvrwr}namer#alphas alphanumsdbl_quoted_stringr&r% remove_quotesrrrrOptr printablesrr/r'r(rrrrrSkipTotag_body) tagStrxml suppress_LT suppress_GT tagAttrName tagAttrValueopenTagcloseTagrs @r _makeTagsr s,&(##'2++vy501K (--/@@O Um :eK(3-$?,$NOPQ R#w'0AA+     %))+<<]Kd cO   Um #445KLhsml:;< #w'0AA+    wt}v-3eDH Vg%&    S1779??ABBhw ! GKHLhj)G  rtag_strc[US5$)aHelper to construct opening and closing tag expressions for HTML, given a tag name. Matches tags in either upper or lower case, attributes with namespaces and with quoted or unquoted values. Example:: text = 'More info at the pyparsing wiki page' # make_html_tags returns pyparsing expressions for the opening and # closing tags as a 2-tuple a, a_end = make_html_tags("A") link_expr = a + SkipTo(a_end)("link_text") + a_end for link in link_expr.search_string(text): # attributes in the tag (like "href" shown here) are # also accessible as named results print(link.link_text, '->', link.href) prints:: pyparsing -> https://github.com/pyparsing/pyparsing/wiki Fr r s rmake_html_tagsrWs0 We $$rc[US5$)zHelper to construct opening and closing tag expressions for XML, given a tag name. Matches tags only in the given upper/lower case. Example: similar to :class:`make_html_tags` Trrs r make_xml_tagsrrs Wd ##r any_open_tag any_close_tagz_:zany tag;z &(?Prkz);zcommon HTML entityc@[RUR5$)zRHelper parser action to replace common HTML entities with their special characters)_htmlEntityMapgetentityrs rreplace_html_entityrs   ahh ''rc \rSrSrSrSrSrSrg)OpAssocizrEnumeration of operator associativity - used in constructing InfixNotationOperatorSpec for :class:`infix_notation`rrRr]N)__name__ __module__ __qualname____firstlineno____doc__LEFTRIGHT__static_attributes__r]rrrrsT D Err base_exprop_listlparrparc "SS[5nSUl[5n[U[5(a [ U5n[U[5(a [ U5n[U[ 5(a[U[ 5(dU[ X%-U-5-nO XU-U--n[U5GH upxUS-SSupp[U [5(a[RU 5n [R"[U 5n U S:XaA[U [[45(a[U 5S:wa [!S 5eU upU US 3nOU S 3nS U s=::aS::d O [!S 5eU ["R$["R&4;a [!S 5e[5R)U5n[R"[U5nU ["R$LaU S :XaU"Xi-5[ XiS-5-nGOZU S:XaAU b#U"Xi-U-5[ XiU-S-5-nGO.U"Xf-5[ US5-nGOU S:Xa4U"UW -U-W-U-5[ U[+X-U-U-5-5-nOU ["R&LaU S :XaE[U [,5(d [-U 5n U"U R.U-5[ U U-5-nOzU S:XaCU b"U"Xi-U-5[ XiU-S-5-nOOU"UU-5[ UUS-5-nO1U S:Xa+U"UW -U-W-U-5[ Xm-U-U-U-5-nU (a<[U [[45(aWR0"U 6 OWR1U 5 UWU-R3U5-nUnGM XV-nU$)a Helper method for constructing grammars of expressions made up of operators working in a precedence hierarchy. Operators may be unary or binary, left- or right-associative. Parse actions can also be attached to operator expressions. The generated parser will also recognize the use of parentheses to override operator precedences (see example below). Note: if you define a deep operator list, you may see performance issues when using infix_notation. See :class:`ParserElement.enable_packrat` for a mechanism to potentially improve your parser performance. Parameters: - ``base_expr`` - expression representing the most basic operand to be used in the expression - ``op_list`` - list of tuples, one for each operator precedence level in the expression grammar; each tuple is of the form ``(op_expr, num_operands, right_left_assoc, (optional)parse_action)``, where: - ``op_expr`` is the pyparsing expression for the operator; may also be a string, which will be converted to a Literal; if ``num_operands`` is 3, ``op_expr`` is a tuple of two expressions, for the two operators separating the 3 terms - ``num_operands`` is the number of terms for this operator (must be 1, 2, or 3) - ``right_left_assoc`` is the indicator whether the operator is right or left associative, using the pyparsing-defined constants ``OpAssoc.RIGHT`` and ``OpAssoc.LEFT``. - ``parse_action`` is the parse action to be associated with expressions matching this operator expression (the parse action tuple member may be omitted); if the parse action is passed a tuple or list of functions, this is equivalent to calling ``set_parse_action(*fn)`` (:class:`ParserElement.set_parse_action`) - ``lpar`` - expression for matching left-parentheses; if passed as a str, then will be parsed as ``Suppress(lpar)``. If lpar is passed as an expression (such as ``Literal('(')``), then it will be kept in the parsed results, and grouped with them. (default= ``Suppress('(')``) - ``rpar`` - expression for matching right-parentheses; if passed as a str, then will be parsed as ``Suppress(rpar)``. If rpar is passed as an expression (such as ``Literal(')')``), then it will be kept in the parsed results, and grouped with them. (default= ``Suppress(')')``) Example:: # simple example of four-function arithmetic with ints and # variable names integer = pyparsing_common.signed_integer varname = pyparsing_common.identifier arith_expr = infix_notation(integer | varname, [ ('-', 1, OpAssoc.RIGHT), (one_of('* /'), 2, OpAssoc.LEFT), (one_of('+ -'), 2, OpAssoc.LEFT), ]) arith_expr.run_tests(''' 5+3*6 (5+3)*6 -2--11 ''', full_dump=False) prints:: 5+3*6 [[5, '+', [3, '*', 6]]] (5+3)*6 [[[5, '+', 3], '*', 6]] (5+x)*y [[[5, '+', 'x'], '*', 'y']] -2--11 [[['-', 2], '-', ['-', 11]]] c\rSrSrSSjrSrg)zinfix_notation.._FBic@URRX5 U/4$r.)r try_parse)selfinstringr doActionss r parseImpl%infix_notation.._FB.parseImpls II   .7Nrr]NT)rrrr r0r$r]rr_FBinfix_notation.._FBs rr3z FollowedBy>r.NrRz@if numterms=3, opExpr must be a tuple or list of two expressionsz termrz6operator must be unary (1), binary (2), or ternary (3)z2operator must indicate right or left associativity)r.)rR.) FollowedByrr"rvr)rrrrwr_literalStringClassr~rtuplerr5rrr"r#r'rrr r%setName)r%r&r'r(r3rlastExprroperDefopExprarityrightLeftAssocpaopExpr1opExpr2 term_namethisExprrs rinfix_notationrEslj !CL )C$~$~ tX & &:dH+E+EuTZ$%677s T 12 ( -4w->,C)~ fh ' '"66v>F]F3 A:fudm44F q8H V & G")G9E2I!(%(IEQUV V ',, !> >QR R"))"4"4Y"?;;w1 W\\ )z 12U8Vn;T5UU !% #H$5$@ AE X$5v#>>E!I!$H$7 85&AQ;R RI!w&1G;hF(Yw/AG/Kh/V%WWXY w}} ,z!&#.. [F h 67%@Q:RR !% #H$5$@ AE X$5v#>>E!I!$Hx$7 85 8F#33<!I!w&1G;hF(,x7'AHLMN  "udm,,**B/**2.i(*33I>>})~C Jrc ^^^ TRTSS5 UU4Sjm U4SjnU4SjnU4Sjn[[5RS5R 55n[ 5[ 5R U5-RS5n[ 5R U5RS5n [ 5R U5RS 5n U(a?[[U5U-[U [U5-[U5-5-U -5n OD[[U5[U [U5-[U5-5-[U 5-5n U RU4S j5 U RU 4S j5 UR[[5-5 U RS 5$) a (DEPRECATED - use :class:`IndentedBlock` class instead) Helper method for defining space-delimited indentation blocks, such as those used to define block statements in Python source code. Parameters: - ``blockStatementExpr`` - expression defining syntax of statement that is repeated within the indented block - ``indentStack`` - list created by caller to manage indentation stack (multiple ``statementWithIndentedBlock`` expressions within a single grammar should share a common ``indentStack``) - ``indent`` - boolean indicating whether block must be indented beyond the current level; set to ``False`` for block of left-most statements (default= ``True``) A valid block must contain at least one ``blockStatement``. (Note that indentedBlock uses internal parse actions which make it incompatible with packrat parsing.) Example:: data = ''' def A(z): A1 B = 100 G = A2 A2 A3 B def BB(a,b,c): BB1 def BBA(): bba1 bba2 bba3 C D def spam(x,y): def eggs(z): pass ''' indentStack = [1] stmt = Forward() identifier = Word(alphas, alphanums) funcDecl = ("def" + identifier + Group("(" + Opt(delimitedList(identifier)) + ")") + ":") func_body = indentedBlock(stmt, indentStack) funcDef = Group(funcDecl + func_body) rvalue = Forward() funcCall = Group(identifier + "(" + Opt(delimitedList(rvalue)) + ")") rvalue << (funcCall | identifier | Word(nums)) assignment = Group(identifier + "=" + rvalue) stmt << (funcDef | assignment | identifier) module_body = stmt[1, ...] parseTree = module_body.parseString(data) parseTree.pprint() prints:: [['def', 'A', ['(', 'z', ')'], ':', [['A1'], [['B', '=', '100']], [['G', '=', 'A2']], ['A2'], ['A3']]], 'B', ['def', 'BB', ['(', 'a', 'b', 'c', ')'], ':', [['BB1'], [['def', 'BBA', ['(', ')'], ':', [['bba1'], ['bba2'], ['bba3']]]]]], 'C', 'D', ['def', 'spam', ['(', 'x', 'y', ')'], ':', [[['def', 'eggs', ['(', 'z', ')'], ':', [['pass']]]]]]] Nc>TSTSS&gNr]) backup_stacks indentStacksr reset_stack"indentedBlock..reset_stacks&r* Arc>U[U5:ag[X5nUTS:wa!UTS:a [XS5e[XS5eg)NrIzillegal nestingznot a peer entry)r5colrCrrrcurColrKs rcheckPeerIndent&indentedBlock..checkPeerIndentsS A; Q [_ $ B'$Q+<== '9: : %rch>[X5nUTS:aTRU5 g[XS5e)NrIznot a subentry)rOappendrCrPs rcheckSubIndent%indentedBlock..checkSubIndents4Q KO #   v & '78 8rc>U[U5:ag[X5nT(aUT;d [XS5eUTS:aTR5 gg)Nznot an unindentrI)r5rOrCrrPs r checkUnindent$indentedBlock..checkUnindentsM A; Q+ 5 '89 9 KO # OO  $rz INDENTrhUNINDENTcJ>T(aTRS5=(a S$S$rHr)rJsrrindentedBlock..s- !!"%.$ITIrc>T"5$r.r])rWrXcdrLs rrr^skmrzindented block)rUrLineEndset_whitespace_charssuppressrr%r'rrr(set_fail_actionignorer) blockStatementExprrKindentrJrRrVrYNLr[PEERUNDENTsmExprrLs ` ` @r indentedBlockrmYs~lQ(+;9 7911%8AAC DBg00@@ J J8 TF 7 # #O 4 = =b AD W % %m 4 = =j IF  G u%7883r7BC D   Gu%7883r7BC D&k   I ;<g 12 ??+ ,,rz/\*(?:[^*]|\*(?!/))*z*/zC style commentzz HTML commentz.*z rest of linez//(?:\\\n|[^\n])*z // commentzC++ style commentz#.*zPython style comment_builtin_exprsallow_trailing_delimdelimcombineminmaxrpc [XX#XES9$)z/(DEPRECATED - use :class:`DelimitedList` class)ro) DelimitedList)r rqrrrsrtrps rdelimited_listrw s  W3 rcgr.r]r]rr delimitedListry&rcgr.r]r]rrrwrw)srcgr.r]r]rr countedArrayr},rcgr.r]r]rrmatchPreviousLiteralr/srcgr.r]r]rrmatchPreviousExprr2rcgr.r]r]rroneOfr5s rcgr.r]r]rrdictOfr8srcgr.r]r]rroriginalTextForr;srcgr.r]r]rr nestedExprr>srcgr.r]r]rr makeHTMLTagsrAr~rcgr.r]r]rr makeXMLTagsrDsrcgr.r]r]rrreplaceHTMLEntityrGrrcgr.r]r]rr infixNotationrJrzrr.)FTFr2),FNN)a html.entitieshtmlrmsysr~rhrcoreutilrrrr rOptionalr*r?rJUnionrr)boolrrrrrrrrr Tuplerr__annotations__r#rrr'rrentitieshtml5itemsrstriprrrcommon_html_entityrEnumrInfixNotationOperatorArgTyper ParseActionInfixNotationOperatorSpecListrErmrc_style_comment html_commentleave_whitespace rest_of_linedbl_slash_commentcpp_style_commentjava_style_commentpython_style_commentvarsvaluesrvrnrwopAssoc anyOpenTag anyCloseTagcommonHTMLEntity cStyleComment htmlComment restOfLinedblSlashCommentcppStyleCommentjavaStyleCommentpythonStyleCommentrvryr}rrrrrrrrrr)kvs00rrs 049I/3 9I 9Ioom,9I__] + 9I  9Ix=B!m! !L { { $c) *{{{ {  {{{|%/%/}%/%/R,02EI2 2$(2>B22jA-AMA m  H),(+.2!. @ !. @ #}$ %@ #}$ %@__] +@ @  @@F(0}(3-7t% 3 % &% =- '(%6$ 3 % &$ =- '($,T!"++I6 m04}}/B/B/H/H/JK/Jtq!((3-"/JK>CHH^,DDtKLUU ( d %3eM3$67}c?Q9RRSS " $  $ &  $    $'/sm&.sm nn + ,n ]" #n ]" # n  nb;?bL-`% 784?@II$'(11.A &U|,,.77G ./88F1 !"T),== ( P&$V}--.DE0 v}}'!*Q ">A']#(+ $ $ "'  ]" #  m# $          "    %   ##%)- !- !- !()*%&'&'#$%+.!"- !%&'.!"QL@ 'sQ&Q!<Q!