METADATA 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. Metadata-Version: 2.4
  2. Name: pyparsing
  3. Version: 3.3.2
  4. Summary: pyparsing - Classes and methods to define and execute parsing grammars
  5. Author-email: Paul McGuire <ptmcg.gm+pyparsing@gmail.com>
  6. Requires-Python: >=3.9
  7. Description-Content-Type: text/x-rst
  8. License-Expression: MIT
  9. Classifier: Development Status :: 5 - Production/Stable
  10. Classifier: Intended Audience :: Developers
  11. Classifier: Intended Audience :: Information Technology
  12. Classifier: Operating System :: OS Independent
  13. Classifier: Programming Language :: Python
  14. Classifier: Programming Language :: Python :: 3
  15. Classifier: Programming Language :: Python :: 3.9
  16. Classifier: Programming Language :: Python :: 3.10
  17. Classifier: Programming Language :: Python :: 3.11
  18. Classifier: Programming Language :: Python :: 3.12
  19. Classifier: Programming Language :: Python :: 3.13
  20. Classifier: Programming Language :: Python :: 3.14
  21. Classifier: Programming Language :: Python :: 3 :: Only
  22. Classifier: Programming Language :: Python :: Implementation :: CPython
  23. Classifier: Programming Language :: Python :: Implementation :: PyPy
  24. Classifier: Topic :: Software Development :: Compilers
  25. Classifier: Topic :: Text Processing
  26. Classifier: Typing :: Typed
  27. License-File: LICENSE
  28. Requires-Dist: railroad-diagrams ; extra == "diagrams"
  29. Requires-Dist: jinja2 ; extra == "diagrams"
  30. Project-URL: Documentation, https://pyparsing-docs.readthedocs.io/en/latest/
  31. Project-URL: Homepage, https://github.com/pyparsing/pyparsing/
  32. Project-URL: Source, https://github.com/pyparsing/pyparsing.git
  33. Provides-Extra: diagrams
  34. PyParsing -- A Python Parsing Module
  35. ====================================
  36. |Version| |Build Status| |Coverage| |License| |Python Versions| |Snyk Score|
  37. Introduction
  38. ============
  39. The pyparsing module is an alternative approach to creating and
  40. executing simple grammars, vs. the traditional lex/yacc approach, or the
  41. use of regular expressions. The pyparsing module provides a library of
  42. classes that client code uses to construct the grammar directly in
  43. Python code.
  44. *[Since first writing this description of pyparsing in late 2003, this
  45. technique for developing parsers has become more widespread, under the
  46. name Parsing Expression Grammars - PEGs. See more information on PEGs*
  47. `here <https://en.wikipedia.org/wiki/Parsing_expression_grammar>`__
  48. *.]*
  49. Here is a program to parse ``"Hello, World!"`` (or any greeting of the form
  50. ``"salutation, addressee!"``):
  51. .. code:: python
  52. from pyparsing import Word, alphas
  53. greet = Word(alphas) + "," + Word(alphas) + "!"
  54. hello = "Hello, World!"
  55. print(hello, "->", greet.parse_string(hello))
  56. The program outputs the following::
  57. Hello, World! -> ['Hello', ',', 'World', '!']
  58. The Python representation of the grammar is quite readable, owing to the
  59. self-explanatory class names, and the use of '+', '|' and '^' operator
  60. definitions.
  61. The parsed results returned from ``parse_string()`` is a collection of type
  62. ``ParseResults``, which can be accessed as a
  63. nested list, a dictionary, or an object with named attributes.
  64. The pyparsing module handles some of the problems that are typically
  65. vexing when writing text parsers:
  66. - extra or missing whitespace (the above program will also handle ``"Hello,World!"``, ``"Hello , World !"``, etc.)
  67. - quoted strings
  68. - embedded comments
  69. The examples directory includes a simple SQL parser, simple CORBA IDL
  70. parser, a config file parser, a chemical formula parser, and a four-
  71. function algebraic notation parser, among many others.
  72. Documentation
  73. =============
  74. There are many examples in the online docstrings of the classes
  75. and methods in pyparsing. You can find them compiled into `online docs <https://pyparsing-docs.readthedocs.io/en/latest/>`__. Additional
  76. documentation resources and project info are listed in the online
  77. `GitHub wiki <https://github.com/pyparsing/pyparsing/wiki>`__. An
  78. entire directory of examples can be found `here <https://github.com/pyparsing/pyparsing/tree/master/examples>`__.
  79. AI Instructions
  80. ===============
  81. There are also instructions for AI agents to use when helping you to create your parser. They can
  82. be pulled from the GitHub project repository, at pyparsing/ai/best_practices.md. You can also tell
  83. the AI to access them programmatically after installing pyparsing, either from the CLI with
  84. ``python -m pyparsing.ai.show_best_practices`` or within python with
  85. ``import pyparsing; pyparsing.show_best_practices()``.
  86. License
  87. =======
  88. MIT License. See header of the `pyparsing __init__.py <https://github.com/pyparsing/pyparsing/blob/master/pyparsing/__init__.py#L1-L23>`__ file.
  89. History
  90. =======
  91. See `CHANGES <https://github.com/pyparsing/pyparsing/blob/master/CHANGES>`__ file.
  92. Performance benchmarks
  93. ======================
  94. For usage instructions and details on the performance benchmark suite, see
  95. ``tests/README.md`` in this repository.
  96. .. |Build Status| image:: https://github.com/pyparsing/pyparsing/actions/workflows/ci.yml/badge.svg
  97. :target: https://github.com/pyparsing/pyparsing/actions/workflows/ci.yml
  98. .. |Coverage| image:: https://codecov.io/gh/pyparsing/pyparsing/branch/master/graph/badge.svg
  99. :target: https://codecov.io/gh/pyparsing/pyparsing
  100. .. |Version| image:: https://img.shields.io/pypi/v/pyparsing?style=flat-square
  101. :target: https://pypi.org/project/pyparsing/
  102. :alt: Version
  103. .. |License| image:: https://img.shields.io/pypi/l/pyparsing.svg?style=flat-square
  104. :target: https://pypi.org/project/pyparsing/
  105. :alt: License
  106. .. |Python Versions| image:: https://img.shields.io/pypi/pyversions/pyparsing.svg?style=flat-square
  107. :target: https://pypi.org/project/python-liquid/
  108. :alt: Python versions
  109. .. |Snyk Score| image:: https://snyk.io//advisor/python/pyparsing/badge.svg
  110. :target: https://snyk.io//advisor/python/pyparsing
  111. :alt: pyparsing