CoolFace
Apppublic

Aluode/PerceptionLabPortable

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
1Metadata-Version: 2.42Name: pyparsing3Version: 3.3.14Summary: pyparsing - Classes and methods to define and execute parsing grammars5Author-email: Paul McGuire <ptmcg.gm+pyparsing@gmail.com>6Requires-Python: >=3.97Description-Content-Type: text/x-rst8License-Expression: MIT9Classifier: Development Status :: 5 - Production/Stable10Classifier: Intended Audience :: Developers11Classifier: Intended Audience :: Information Technology12Classifier: Operating System :: OS Independent13Classifier: Programming Language :: Python14Classifier: Programming Language :: Python :: 315Classifier: Programming Language :: Python :: 3.916Classifier: Programming Language :: Python :: 3.1017Classifier: Programming Language :: Python :: 3.1118Classifier: Programming Language :: Python :: 3.1219Classifier: Programming Language :: Python :: 3.1320Classifier: Programming Language :: Python :: 3.1421Classifier: Programming Language :: Python :: 3 :: Only22Classifier: Programming Language :: Python :: Implementation :: CPython23Classifier: Programming Language :: Python :: Implementation :: PyPy24Classifier: Topic :: Software Development :: Compilers25Classifier: Topic :: Text Processing26Classifier: Typing :: Typed27License-File: LICENSE28Requires-Dist: railroad-diagrams ; extra == "diagrams"29Requires-Dist: jinja2 ; extra == "diagrams"30Project-URL: Homepage, https://github.com/pyparsing/pyparsing/31Provides-Extra: diagrams32 33PyParsing -- A Python Parsing Module34====================================35 36|Version| |Build Status| |Coverage| |License| |Python Versions| |Snyk Score|37 38Introduction39============40 41The pyparsing module is an alternative approach to creating and42executing simple grammars, vs. the traditional lex/yacc approach, or the43use of regular expressions. The pyparsing module provides a library of44classes that client code uses to construct the grammar directly in45Python code.46 47*[Since first writing this description of pyparsing in late 2003, this48technique for developing parsers has become more widespread, under the49name Parsing Expression Grammars - PEGs. See more information on PEGs*50`here <https://en.wikipedia.org/wiki/Parsing_expression_grammar>`__51*.]*52 53Here is a program to parse ``"Hello, World!"`` (or any greeting of the form54``"salutation, addressee!"``):55 56.. code:: python57 58    from pyparsing import Word, alphas59    greet = Word(alphas) + "," + Word(alphas) + "!"60    hello = "Hello, World!"61    print(hello, "->", greet.parse_string(hello))62 63The program outputs the following::64 65    Hello, World! -> ['Hello', ',', 'World', '!']66 67The Python representation of the grammar is quite readable, owing to the68self-explanatory class names, and the use of '+', '|' and '^' operator69definitions.70 71The parsed results returned from ``parse_string()`` is a collection of type72``ParseResults``, which can be accessed as a73nested list, a dictionary, or an object with named attributes.74 75The pyparsing module handles some of the problems that are typically76vexing when writing text parsers:77 78- extra or missing whitespace (the above program will also handle ``"Hello,World!"``, ``"Hello , World !"``, etc.)79- quoted strings80- embedded comments81 82The examples directory includes a simple SQL parser, simple CORBA IDL83parser, a config file parser, a chemical formula parser, and a four-84function algebraic notation parser, among many others.85 86Documentation87=============88 89There are many examples in the online docstrings of the classes90and methods in pyparsing. You can find them compiled into `online docs <https://pyparsing-docs.readthedocs.io/en/latest/>`__. Additional91documentation resources and project info are listed in the online92`GitHub wiki <https://github.com/pyparsing/pyparsing/wiki>`__. An93entire directory of examples can be found `here <https://github.com/pyparsing/pyparsing/tree/master/examples>`__.94 95AI Instructions96===============97 98There are also instructions for AI agents to use when helping you to create your parser. They can99be pulled from the GitHub project repository, at pyparsing/ai/best_practices.md. You can also tell100the AI to access them programmatically after installing pyparsing, either from the CLI with101`python -m pyparsing.ai.show_best_practices` or within python with102`import pyparsing; pyparsing.show_best_practices()`.103 104 105License106=======107 108MIT License. See header of the `pyparsing __init__.py <https://github.com/pyparsing/pyparsing/blob/master/pyparsing/__init__.py#L1-L23>`__ file.109 110History111=======112 113See `CHANGES <https://github.com/pyparsing/pyparsing/blob/master/CHANGES>`__ file.114 115 116Performance benchmarks117======================118 119For usage instructions and details on the performance benchmark suite, see120``tests/README.md`` in this repository.121 122.. |Build Status| image:: https://github.com/pyparsing/pyparsing/actions/workflows/ci.yml/badge.svg123   :target: https://github.com/pyparsing/pyparsing/actions/workflows/ci.yml124 125.. |Coverage| image:: https://codecov.io/gh/pyparsing/pyparsing/branch/master/graph/badge.svg126  :target: https://codecov.io/gh/pyparsing/pyparsing127 128.. |Version| image:: https://img.shields.io/pypi/v/pyparsing?style=flat-square129    :target: https://pypi.org/project/pyparsing/130    :alt: Version131 132.. |License| image:: https://img.shields.io/pypi/l/pyparsing.svg?style=flat-square133    :target: https://pypi.org/project/pyparsing/134    :alt: License135 136.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/pyparsing.svg?style=flat-square137    :target: https://pypi.org/project/python-liquid/138    :alt: Python versions139 140.. |Snyk Score| image:: https://snyk.io//advisor/python/pyparsing/badge.svg141   :target: https://snyk.io//advisor/python/pyparsing142   :alt: pyparsing143 144