D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
lib
/
python3
/
dist-packages
/
pyparsing
/
__pycache__
/
Filename :
__init__.cpython-314.pyc
back
Copy
+ '[�i~4 � �h � R t ^ RIHt ! R R]4 t]! ^^^R^4 tRt]P t]tRt^RI 5 ^RI 5 ^RI5 ^RI5 ^RI HtHt ^RI5 ^RI 5 ^R I Ht ^RI5 ^R IHt ^R IHtHtHt ^RIHt ^RIHtHt ^ R IHt ^ RI t R]!! 4 9 d ]tR]!! 4 9 d ]tR]!! 4 9 d ]t]]], , tRt"] PF 3R R llt$. RNRNRNRNRNRNRNRNRNRNRNR NR!NR"NR#NR$NR%NR&NR'NR(NR)NR*NR+NR,NR-NR.NR/NR0NR1NR2NR3NR4NR5NR6NR7NR8NR9NR:NR;NR<NR=NR>NR?NR@NRANRBNRCNRDNRENRFNRGNRHNRINRJNRKNRLNRMNRNNRONRPNRQNRRNRSNRTNRUNRVNRWNRXNRYNRZNR[NR\NR]NR^NR_NR`NRaNRbNRcNRdNReNRfNRgNRhNRiNRjNRkNRlNRmNRnNRoNRpNRqNRrNRsNRtNRuNRvNRwNRxNRyNRzNR{NR|NRNRNRNR}NR~NRNR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�NR�Nt%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 � ] tR t^rt o ]R 4 tR tR tV 3R ltRt V t R# )�version_infoc � � V P R V P R V P 2V P ^ , R8X d RMR V P ^ , V P 2R3V P R8H , , # )�.�c�r� �final)�major�minor�micro�releaselevel�serial��selfs &�4/usr/lib/python3/dist-packages/pyparsing/__init__.py�__version__�version_info.__version__y s� � � �z�z�l�!�D�J�J�<�q�����5��+�+�A�.�#�5�3�2�>�t�?P�?P�QR�?S�>T�UY�U`�U`�Ta�b��� ���7�*�,� ,� � c �: � \ R V P R\ 2# )� z / )�__name__r �__version_time__r s &r �__str__�version_info.__str__� s"