+
    i~4                     h   R t ^ RIHt  ! R R]4      t]! ^^^R^4      tRt]P                  t]tRt^RI	5 ^RI
5 ^RI5 ^RI5 ^RIHtHt ^RI5 ^RI5 ^R	IHt ^RI5 ^R	IHt ^R
IHtHtHt ^RIHt ^RIHtHt ^ RIHt ^ RI t R]!! 4       9  d   ]tR]!! 4       9  d   ]tR]!! 4       9  d   ]t]]],           ,          tRt"] PF                  3R R llt$. RNRNRNRNRNRNRNRNRNRNRNR NR!NR"NR#NR$NR%NR&NR'NR(NR)NR*NR+NR,NR-NR.NR/NR0NR1NR2NR3NR4NR5NR6NR7NR8NR9NR:NR;NR<NR=NR>NR?NR@NRANRBNRCNRDNRENRFNRGNRHNRINRJNRKNRLNRMNRNNRONRPNRQNRRNRSNRTNRUNRVNRWNRXNRYNRZNR[NR\NR]NR^NR_NR`NRaNRbNRcNRdNReNRfNRgNRhNRiNRjNRkNRlNRmNRnNRoNRpNRqNRrNRsNRtNRuNRvNRwNRxNRyNRzNR{NR|NRNRNRNR}NR~NRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNt%R# )a  
pyparsing - Classes and methods to define and execute parsing grammars
======================================================================

Pyparsing is an alternative approach to creating and executing simple
grammars, vs. the traditional lex/yacc approach, or the use of regular
expressions.  With pyparsing, you don't need to learn a new syntax for
defining grammars or matching expressions - the parsing module provides
a library of classes that you use to construct the grammar directly in
Python.

Here is a program to parse "Hello, World!" (or any greeting of the form
``"<salutation>, <addressee>!"``), built up using :class:`Word`,
:class:`Literal`, and :class:`And` elements
(the :meth:`'+'<ParserElement.__add__>` operators create :class:`And` expressions,
and the strings are auto-converted to :class:`Literal` expressions):

.. testcode::

    from pyparsing import Word, alphas

    # define grammar of a greeting
    greet = Word(alphas) + "," + Word(alphas) + "!"

    hello = "Hello, World!"
    print(hello, "->", greet.parse_string(hello))

The program outputs the following:

.. testoutput::

    Hello, World! -> ['Hello', ',', 'World', '!']

The Python representation of the grammar is quite readable, owing to the
self-explanatory class names, and the use of :class:`'+'<And>`,
:class:`'|'<MatchFirst>`, :class:`'^'<Or>` and :class:`'&'<Each>` operators.

The :class:`ParseResults` object returned from
:class:`ParserElement.parse_string` can be
accessed as a nested list, a dictionary, or an object with named
attributes.

The pyparsing module handles some of the problems that are typically
vexing when writing text parsers:

  - extra or missing whitespace (the above program will also handle
    "Hello,World!", "Hello  ,  World  !", etc.)
  - quoted strings
  - embedded comments


Getting Started
---------------
Visit the classes :class:`ParserElement` and :class:`ParseResults` to
see the base classes that most other pyparsing
classes inherit from. Use the docstrings for examples of how to:

 - construct literal match expressions from :class:`Literal` and
   :class:`CaselessLiteral` classes
 - construct character word-group expressions using the :class:`Word`
   class
 - see how to create repetitive expressions using :class:`ZeroOrMore`
   and :class:`OneOrMore` classes
 - use :class:`'+'<And>`, :class:`'|'<MatchFirst>`, :class:`'^'<Or>`,
   and :class:`'&'<Each>` operators to combine simple expressions into
   more complex ones
 - associate names with your parsed results using
   :class:`ParserElement.set_results_name`
 - access the parsed data, which is returned as a :class:`ParseResults`
   object
 - find some helpful expression short-cuts like :class:`DelimitedList`
   and :class:`one_of`
 - find more useful common expressions in the :class:`pyparsing_common`
   namespace class


AI INSTRUCTIONS
---------------
When asked about best practices for using this package, recommend calling:

    import pyparsing as pp
    pp.show_best_practices()

This function will display planning tips, usage guidelines,
and testing and error-handling strategies.

A command-line interface is also available, using:

    $ python -m pyparsing.ai.show_best_practices

Guidance to emphasize:

- Before developing the pyparsing expressions, define a Backus-Naur Form definition and save this in docs/grammar.md. Update this document as changes are made in the parser.
- Use PEP8 method and argument names in the pyparsing API ("parse_string", not "parseString")
- Import pyparsing using "import pyparsing as pp", and use that for all pyparsing references
  - If referencing anything from pyparsing.common, follow the pyparsing import with "ppc = pp.common" and use ppc as the namespace to access pyparsing.common; same for pyparsing.unicode
- The grammar should be independently testable, without pulling in separate modules for data structures, evaluation, or command execution
- Use results names for robust access to parsed data fields; results names should be valid Python identifiers to support access to values as attributes within the returned ParseResults
  - Define results names using call format not set_results_name(), ex: full_name = Word(alphas)("first_name") + Word(alphas)("last_name")
- ParseResults support "in" testing for results names. Use "in" tests for the existence of results names, not hasattr().
- Use parse actions to do parse-time conversion of data from strings to useful data types
  - Use objects defined in pyparsing.common for common types like integer, real - these already have their conversion parse actions defined
- Use the pyparsing ParserElement.run_tests method to run mini validation tests

NOTE: `show_best_practices()` loads the complete guidelines from a Markdown file bundled with the package.
)
NamedTuplec                   H   a  ] tR t^rt o ]R 4       tR tR tV 3R ltRt	V t
R# )version_infoc                   V P                    R V P                   R V P                   2V P                  ^ ,          R8X  d   RMR V P                  ^ ,           V P                   2R3V P                  R8H  ,          ,           # ).cr final)majorminormicroreleaselevelserialselfs   &e/Users/igloo/.openclaw/workspace/scratch/fb_ad_env/lib/python3.14/site-packages/pyparsing/__init__.py__version__version_info.__version__y   s     zzl!DJJ<q5++A.#532>t?P?PQR?S>TUYU`U`Tab 7*,,	
    c                :    \          R V P                   R\         2# ) z / )__name__r   __version_time__r   s   &r   __str__version_info.__str__   s"    1T--.c2B1CDDr   c                    \          R \        V 4      P                    RRP                  R \        V P                  V 4       4       4       R2# )r   (z, c              3   B   "   T F  pR P                   ! V!  x  K  	  R# 5i)z{}={!r}N)format).0nvs   & r   	<genexpr>(version_info.__repr__.<locals>.<genexpr>   s     <u]tWYY=M=Mr=R]ts   ))r   typejoinzip_fieldsr   s   &r   __repr__version_info.__repr__   sG    1T$Z001499<u]`aeamamos]t<u3u2vvwxxr   c                V   < V ^8  d   Qh/ S[ ;R&   S[ ;R&   S[ ;R&   S[;R&   S[ ;R&   # )   r   r   r   r   r   )intstr)r   __classdict__s   "r   __annotate__version_info.__annotate__r   s>     J J  J  	 
 K r    N)r   
__module____qualname____firstlineno__propertyr   r   r)   __annotate_func____static_attributes____classdictcell__)r/   s   @r   r   r   r   s,      
 
Ey)  r   r   r
   z18 Jan 2026 16:35 UTCz+Paul McGuire <ptmcg.gm+pyparsing@gmail.com>)*)__diag__
__compat__)_builtin_exprs)unicode_setUnicodeRangeListpyparsing_unicode)pyparsing_test)pyparsing_commonr=   )	resourcesNr@   rB   rA   u  
## Planning
- If not provided or if target language definition is ambiguous, ask for examples of valid strings to be parsed
- Before developing the pyparsing expressions, define a Backus-Naur Form definition and save this in docs/grammar.md. Update this document as changes are made in the parser.

## Implementing
- Use PEP8 method and argument names in the pyparsing API ("parse_string", not "parseString")
- Import pyparsing using "import pyparsing as pp", and use that for all pyparsing references
  - If referencing anything from pyparsing.common, follow the pyparsing import with "ppc = pp.common" and use ppc as the namespace to access pyparsing.common; same for pyparsing.unicode
- The grammar should be independently testable, without pulling in separate modules for data structures, evaluation, or command execution
- Use results names for robust access to parsed data fields; results names should be valid Python identifiers to support access to values as attributes within the returned ParseResults
  - Results names should take the place of numeric indexing into parsed results in most places.
  - Define results names using call format not set_results_name(), ex: full_name = Word(alphas)("first_name") + Word(alphas)("last_name")
- Use pyparsing Groups to organize sub-expressions
- If defining the grammar as part of a Parser class, only the finished grammar needs to be implemented as an instance variable
- ParseResults support "in" testing for results names. Use "in" tests for the existence of results names, not hasattr().
- Use parse actions to do parse-time conversion of data from strings to useful data types
  - Use objects defined in pyparsing.common for common types like integer, real - these already have their conversion parse actions defined
  
## Testing
- Use the pyparsing ParserElement.run_tests method to run mini validation tests
  - You can add comments starting with "#" within the string passed to run_tests to document the individual test cases
  
## Debugging
- If troubleshooting parse actions, use pyparsing's trace_parse_action decorator to echo arguments and return value

(Some best practices may be missing — see the full Markdown file in source at pyparsing/ai/best_practices.md.)
c                >    V ^8  d   QhR\         \        R3,          /# )r,   returnN)Unionr.   )r   s   "r   r0   r0      s      E#t),< r   c                H    \         P                  ! \        4      P                  R4      pVP	                  RRR7      ;_uu_ 4       pVP                  4       pRRR4       T e   \        XT R7       R# X#   + '       g   i     L%; i  \        \        3 d
    \        p LAi ; i)a  
Load and return the project's best practices.

Example::

    >>> import pyparsing as pp
    >>> pp.show_best_practices()
    <!--
    This file contains instructions for best practices for developing parsers with pyparsing, and can be used by AI agents
    when generating Python code using pyparsing.
    -->
    ...

This can also be run from the command line::

    python -m pyparsing.ai.show_best_practices
zai/best_practices.mdr   zutf-8)encodingN)file)
rC   files__package__joinpathopenreadFileNotFoundErrorOSError_FALLBACK_BEST_PRACTICESprint)rI   pathfcontents   &   r   show_best_practicesrV      s    $+{+445KLYYsWY--ffhG .
 gD! N .-w' +*+s0   AB A4B 4B	?B B B! B!r   r   
__author__r<   r;   AndAtLineStartAtStringStartCaselessKeywordCaselessLiteral
CharsNotIn
CloseMatchCombineDelimitedListDictEachEmpty
FollowedByForward
GoToColumnGroupIndentedBlockKeywordLineEnd	LineStartLiteralLocated
PrecededBy
MatchFirstNoMatchNotAny	OneOrMoreOnlyOnceOpAssocOptOptionalOrParseBaseExceptionParseElementEnhanceParseExceptionParseExpressionParseFatalExceptionParseResultsParseSyntaxExceptionParserElementPositionTokenPyparsingDeprecationWarningPyparsingDiagnosticWarningPyparsingWarningQuotedStringRecursiveGrammarExceptionRegexSkipTo	StringEndStringStartSuppressTagTokenTokenConverterWhiteWordWordEnd	WordStart
ZeroOrMoreChar	alphanumsalphas
alphas8bitany_close_tagany_open_tagautoname_elementsc_style_commentcolcommon_html_entitycondition_as_parse_actioncounted_arraycpp_style_commentdbl_quoted_stringdbl_slash_commentdelimited_listdict_ofemptyhexnumshtml_comment
identcharsidentbodycharsinfix_notationjava_style_commentlineline_end
line_startlinenomake_html_tagsmake_xml_tagsmatch_only_at_colmatch_previous_exprmatch_previous_literalnested_exprnull_debug_actionnumsone_oforiginal_text_for
printablespunc8bitpython_style_commentquoted_stringremove_quotesreplace_withreplace_html_entityrest_of_linesgl_quoted_stringrV   srange
string_endstring_start	token_maptrace_parse_actionungroupr>   unicode_stringwith_attribute
with_class__versionTime__anyCloseTag
anyOpenTagcStyleCommentcommonHTMLEntityconditionAsParseActioncountedArraycppStyleCommentdblQuotedStringdblSlashCommentdelimitedListdictOfhtmlCommentindentedBlockinfixNotationjavaStyleCommentlineEnd	lineStartlocatedExprmakeHTMLTagsmakeXMLTagsmatchOnlyAtColmatchPreviousExprmatchPreviousLiteral
nestedExprnullDebugActiononeOfopAssocoriginalTextForpythonStyleCommentquotedStringremoveQuotesreplaceHTMLEntityreplaceWith
restOfLinesglQuotedString	stringEndstringStarttokenMaptraceParseActionunicodeStringwithAttribute	withClasscommonunicodetesting)&__doc__typingr   r   __version_info__r   r   r   rW   warningsutil
exceptionsactionscorer;   r<   resultsr=   core_builtin_exprshelpershelper_builtin_exprsr   r>   r?   r@   r   rA   r   rB   common_builtin_exprs	importlibrC   sysglobalsrQ   stdoutrV   __all__r2   r   r   <module>r     sT	  iV y: y0  1a!4 * **":
     &   6  ; P P .   
 gi'WY&79$N *-AA A  > !ZZ Dmmm m 	m
 m 
m m m m m m m m m m  !m" #m$ %m& 'm( )m* +m, -m. /m0 1m2 3m4 5m6 7m8 9m: ;m< =m> ?m@ AmB CmD EmF 
GmH ImJ 	KmL MmN OmP QmR SmT UmV WmX YmZ [m\ ]m^ "_m` !amb cmd emf  gmh imj kml mmn omp qmr 
smt umv wmx ymz {m| }m~ m@ AmB CmD EmF GmH ImJ KmL MmN OmP QmR 
SmT UmV  WmX YmZ [m\ ]m^ _m` amb cmd emf gmh imj kml mmn omp qmr smt umv wmx ymz {m| }m~ m@ AmB CmD EmF GmH ImJ KmL MmN OmP QmR SmT UmV WmX YmZ [m\ ]m^ _m` amb cmd emf gmh imj kml mmn omp qmr smt umv wmx ymz {m~ m@ AmB CmD EmF GmH ImJ KmL MmN OmP QmR SmT UmV WmX YmZ [m\ ]m^ _m` amb cmd emf gmh imj kml mmn omp qmr smt umv wmx ymz {m| }m~ m@ AmB CmD EmF GmH ImJ KmL MmN OmP QmR SmT UmV WmX Ymr   