Debian Codegraph @

PKG-INFO

raw
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 <[email protected]>
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
35 PyParsing -- A Python Parsing Module
36 ====================================
37
38 |Version| |Build Status| |Coverage| |License| |Python Versions| |Snyk Score|
39
40 Introduction
41 ============
42
43 The pyparsing module is an alternative approach to creating and
44 executing simple grammars, vs. the traditional lex/yacc approach, or the
45 use of regular expressions. The pyparsing module provides a library of
46 classes that client code uses to construct the grammar directly in
47 Python code.
48
49 *[Since first writing this description of pyparsing in late 2003, this
50 technique for developing parsers has become more widespread, under the
51 name Parsing Expression Grammars - PEGs. See more information on PEGs*
52 `here <https://en.wikipedia.org/wiki/Parsing_expression_grammar>`__
53 *.]*
54
55 Here is a program to parse ``"Hello, World!"`` (or any greeting of the form
56 ``"salutation, addressee!"``):
57
58 .. code:: python
59
60 from pyparsing import Word, alphas
61 greet = Word(alphas) + "," + Word(alphas) + "!"
62 hello = "Hello, World!"
63 print(hello, "->", greet.parse_string(hello))
64
65 The program outputs the following::
66
67 Hello, World! -> ['Hello', ',', 'World', '!']
68
69 The Python representation of the grammar is quite readable, owing to the
70 self-explanatory class names, and the use of '+', '|' and '^' operator
71 definitions.
72
73 The parsed results returned from ``parse_string()`` is a collection of type
74 ``ParseResults``, which can be accessed as a
75 nested list, a dictionary, or an object with named attributes.
76
77 The pyparsing module handles some of the problems that are typically
78 vexing when writing text parsers:
79
80 - extra or missing whitespace (the above program will also handle ``"Hello,World!"``, ``"Hello , World !"``, etc.)
81 - quoted strings
82 - embedded comments
83
84 The examples directory includes a simple SQL parser, simple CORBA IDL
85 parser, a config file parser, a chemical formula parser, and a four-
86 function algebraic notation parser, among many others.
87
88 Documentation
89 =============
90
91 There are many examples in the online docstrings of the classes
92 and methods in pyparsing. You can find them compiled into `online docs <https://pyparsing-docs.readthedocs.io/en/latest/>`__. Additional
93 documentation resources and project info are listed in the online
94 `GitHub wiki <https://github.com/pyparsing/pyparsing/wiki>`__. An
95 entire directory of examples can be found `here <https://github.com/pyparsing/pyparsing/tree/master/examples>`__.
96
97 AI Instructions
98 ===============
99
100 There are also instructions for AI agents to use when helping you to create your parser. They can
101 be pulled from the GitHub project repository, at pyparsing/ai/best_practices.md. You can also tell
102 the AI to access them programmatically after installing pyparsing, either from the CLI with
103 ``python -m pyparsing.ai.show_best_practices`` or within python with
104 ``import pyparsing; pyparsing.show_best_practices()``.
105
106
107 License
108 =======
109
110 MIT License. See header of the `pyparsing __init__.py <https://github.com/pyparsing/pyparsing/blob/master/pyparsing/__init__.py#L1-L23>`__ file.
111
112 History
113 =======
114
115 See `CHANGES <https://github.com/pyparsing/pyparsing/blob/master/CHANGES>`__ file.
116
117
118 Performance benchmarks
119 ======================
120
121 For usage instructions and details on the performance benchmark suite, see
122 ``tests/README.md`` in this repository.
123
124 .. |Build Status| image:: https://github.com/pyparsing/pyparsing/actions/workflows/ci.yml/badge.svg
125 :target: https://github.com/pyparsing/pyparsing/actions/workflows/ci.yml
126
127 .. |Coverage| image:: https://codecov.io/gh/pyparsing/pyparsing/branch/master/graph/badge.svg
128 :target: https://codecov.io/gh/pyparsing/pyparsing
129
130 .. |Version| image:: https://img.shields.io/pypi/v/pyparsing?style=flat-square
131 :target: https://pypi.org/project/pyparsing/
132 :alt: Version
133
134 .. |License| image:: https://img.shields.io/pypi/l/pyparsing.svg?style=flat-square
135 :target: https://pypi.org/project/pyparsing/
136 :alt: License
137
138 .. |Python Versions| image:: https://img.shields.io/pypi/pyversions/pyparsing.svg?style=flat-square
139 :target: https://pypi.org/project/python-liquid/
140 :alt: Python versions
141
142 .. |Snyk Score| image:: https://snyk.io//advisor/python/pyparsing/badge.svg
143 :target: https://snyk.io//advisor/python/pyparsing
144 :alt: pyparsing
145