Name | pyparsing JSON |
Version |
3.2.0
JSON |
| download |
home_page | None |
Summary | pyparsing module - Classes and methods to define and execute parsing grammars |
upload_time | 2024-10-13 10:01:16 |
maintainer | None |
docs_url | https://pythonhosted.org/pyparsing/ |
author | None |
requires_python | >=3.9 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
PyParsing -- A Python Parsing Module
====================================
|Version| |Build Status| |Coverage| |License| |Python Versions| |Snyk Score|
Introduction
============
The pyparsing module is an alternative approach to creating and
executing simple grammars, vs. the traditional lex/yacc approach, or the
use of regular expressions. The pyparsing module provides a library of
classes that client code uses to construct the grammar directly in
Python code.
*[Since first writing this description of pyparsing in late 2003, this
technique for developing parsers has become more widespread, under the
name Parsing Expression Grammars - PEGs. See more information on PEGs*
`here <https://en.wikipedia.org/wiki/Parsing_expression_grammar>`__
*.]*
Here is a program to parse ``"Hello, World!"`` (or any greeting of the form
``"salutation, addressee!"``):
.. code:: python
from pyparsing import Word, alphas
greet = Word(alphas) + "," + Word(alphas) + "!"
hello = "Hello, World!"
print(hello, "->", greet.parseString(hello))
The program outputs the following::
Hello, World! -> ['Hello', ',', 'World', '!']
The Python representation of the grammar is quite readable, owing to the
self-explanatory class names, and the use of '+', '|' and '^' operator
definitions.
The parsed results returned from ``parseString()`` is a collection of type
``ParseResults``, which 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
The examples directory includes a simple SQL parser, simple CORBA IDL
parser, a config file parser, a chemical formula parser, and a four-
function algebraic notation parser, among many others.
Documentation
=============
There are many examples in the online docstrings of the classes
and methods in pyparsing. You can find them compiled into `online docs <https://pyparsing-docs.readthedocs.io/en/latest/>`__. Additional
documentation resources and project info are listed in the online
`GitHub wiki <https://github.com/pyparsing/pyparsing/wiki>`__. An
entire directory of examples can be found `here <https://github.com/pyparsing/pyparsing/tree/master/examples>`__.
License
=======
MIT License. See header of the `pyparsing __init__.py <https://github.com/pyparsing/pyparsing/blob/master/pyparsing/__init__.py#L1-L23>`__ file.
History
=======
See `CHANGES <https://github.com/pyparsing/pyparsing/blob/master/CHANGES>`__ file.
.. |Build Status| image:: https://github.com/pyparsing/pyparsing/actions/workflows/ci.yml/badge.svg
:target: https://github.com/pyparsing/pyparsing/actions/workflows/ci.yml
.. |Coverage| image:: https://codecov.io/gh/pyparsing/pyparsing/branch/master/graph/badge.svg
:target: https://codecov.io/gh/pyparsing/pyparsing
.. |Version| image:: https://img.shields.io/pypi/v/pyparsing?style=flat-square
:target: https://pypi.org/project/pyparsing/
:alt: Version
.. |License| image:: https://img.shields.io/pypi/l/pyparsing.svg?style=flat-square
:target: https://pypi.org/project/pyparsing/
:alt: License
.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/pyparsing.svg?style=flat-square
:target: https://pypi.org/project/python-liquid/
:alt: Python versions
.. |Snyk Score| image:: https://snyk.io//advisor/python/pyparsing/badge.svg
:target: https://snyk.io//advisor/python/pyparsing
:alt: pyparsing
Raw data
{
"_id": null,
"home_page": null,
"name": "pyparsing",
"maintainer": null,
"docs_url": "https://pythonhosted.org/pyparsing/",
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Paul McGuire <ptmcg.gm+pyparsing@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/8c/d5/e5aeee5387091148a19e1145f63606619cb5f20b83fccb63efae6474e7b2/pyparsing-3.2.0.tar.gz",
"platform": null,
"description": "PyParsing -- A Python Parsing Module\n====================================\n\n|Version| |Build Status| |Coverage| |License| |Python Versions| |Snyk Score|\n\nIntroduction\n============\n\nThe pyparsing module is an alternative approach to creating and\nexecuting simple grammars, vs. the traditional lex/yacc approach, or the\nuse of regular expressions. The pyparsing module provides a library of\nclasses that client code uses to construct the grammar directly in\nPython code.\n\n*[Since first writing this description of pyparsing in late 2003, this\ntechnique for developing parsers has become more widespread, under the\nname Parsing Expression Grammars - PEGs. See more information on PEGs*\n`here <https://en.wikipedia.org/wiki/Parsing_expression_grammar>`__\n*.]*\n\nHere is a program to parse ``\"Hello, World!\"`` (or any greeting of the form\n``\"salutation, addressee!\"``):\n\n.. code:: python\n\n from pyparsing import Word, alphas\n greet = Word(alphas) + \",\" + Word(alphas) + \"!\"\n hello = \"Hello, World!\"\n print(hello, \"->\", greet.parseString(hello))\n\nThe program outputs the following::\n\n Hello, World! -> ['Hello', ',', 'World', '!']\n\nThe Python representation of the grammar is quite readable, owing to the\nself-explanatory class names, and the use of '+', '|' and '^' operator\ndefinitions.\n\nThe parsed results returned from ``parseString()`` is a collection of type\n``ParseResults``, which can be accessed as a\nnested list, a dictionary, or an object with named attributes.\n\nThe pyparsing module handles some of the problems that are typically\nvexing when writing text parsers:\n\n- extra or missing whitespace (the above program will also handle ``\"Hello,World!\"``, ``\"Hello , World !\"``, etc.)\n- quoted strings\n- embedded comments\n\nThe examples directory includes a simple SQL parser, simple CORBA IDL\nparser, a config file parser, a chemical formula parser, and a four-\nfunction algebraic notation parser, among many others.\n\nDocumentation\n=============\n\nThere are many examples in the online docstrings of the classes\nand methods in pyparsing. You can find them compiled into `online docs <https://pyparsing-docs.readthedocs.io/en/latest/>`__. Additional\ndocumentation resources and project info are listed in the online\n`GitHub wiki <https://github.com/pyparsing/pyparsing/wiki>`__. An\nentire directory of examples can be found `here <https://github.com/pyparsing/pyparsing/tree/master/examples>`__.\n\nLicense\n=======\n\nMIT License. See header of the `pyparsing __init__.py <https://github.com/pyparsing/pyparsing/blob/master/pyparsing/__init__.py#L1-L23>`__ file.\n\nHistory\n=======\n\nSee `CHANGES <https://github.com/pyparsing/pyparsing/blob/master/CHANGES>`__ file.\n\n.. |Build Status| image:: https://github.com/pyparsing/pyparsing/actions/workflows/ci.yml/badge.svg\n :target: https://github.com/pyparsing/pyparsing/actions/workflows/ci.yml\n\n.. |Coverage| image:: https://codecov.io/gh/pyparsing/pyparsing/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/pyparsing/pyparsing\n\n.. |Version| image:: https://img.shields.io/pypi/v/pyparsing?style=flat-square\n :target: https://pypi.org/project/pyparsing/\n :alt: Version\n\n.. |License| image:: https://img.shields.io/pypi/l/pyparsing.svg?style=flat-square\n :target: https://pypi.org/project/pyparsing/\n :alt: License\n\n.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/pyparsing.svg?style=flat-square\n :target: https://pypi.org/project/python-liquid/\n :alt: Python versions\n\n.. |Snyk Score| image:: https://snyk.io//advisor/python/pyparsing/badge.svg\n :target: https://snyk.io//advisor/python/pyparsing\n :alt: pyparsing\n\n",
"bugtrack_url": null,
"license": null,
"summary": "pyparsing module - Classes and methods to define and execute parsing grammars",
"version": "3.2.0",
"project_urls": {
"Homepage": "https://github.com/pyparsing/pyparsing/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "beec2eb3cd785efd67806c46c13a17339708ddc346cbb684eade7a6e6f79536a",
"md5": "4b2fb885fbe566796fbb965cc056b0ea",
"sha256": "93d9577b88da0bbea8cc8334ee8b918ed014968fd2ec383e868fb8afb1ccef84"
},
"downloads": -1,
"filename": "pyparsing-3.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4b2fb885fbe566796fbb965cc056b0ea",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 106921,
"upload_time": "2024-10-13T10:01:13",
"upload_time_iso_8601": "2024-10-13T10:01:13.682155Z",
"url": "https://files.pythonhosted.org/packages/be/ec/2eb3cd785efd67806c46c13a17339708ddc346cbb684eade7a6e6f79536a/pyparsing-3.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8cd5e5aeee5387091148a19e1145f63606619cb5f20b83fccb63efae6474e7b2",
"md5": "c9fb29820d6bf6e83651a0bd7411f02c",
"sha256": "cbf74e27246d595d9a74b186b810f6fbb86726dbf3b9532efb343f6d7294fe9c"
},
"downloads": -1,
"filename": "pyparsing-3.2.0.tar.gz",
"has_sig": false,
"md5_digest": "c9fb29820d6bf6e83651a0bd7411f02c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 920984,
"upload_time": "2024-10-13T10:01:16",
"upload_time_iso_8601": "2024-10-13T10:01:16.046030Z",
"url": "https://files.pythonhosted.org/packages/8c/d5/e5aeee5387091148a19e1145f63606619cb5f20b83fccb63efae6474e7b2/pyparsing-3.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-13 10:01:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pyparsing",
"github_project": "pyparsing",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "pyparsing"
}