You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

159 lines
4.4 KiB

4 years ago
  1. Metadata-Version: 2.0
  2. Name: parso
  3. Version: 0.3.1
  4. Summary: A Python Parser
  5. Home-page: https://github.com/davidhalter/parso
  6. Author: David Halter
  7. Author-email: davidhalter88@gmail.com
  8. Maintainer: David Halter
  9. Maintainer-email: davidhalter88@gmail.com
  10. License: MIT
  11. Keywords: python parser parsing
  12. Platform: any
  13. Classifier: Development Status :: 4 - Beta
  14. Classifier: Environment :: Plugins
  15. Classifier: Intended Audience :: Developers
  16. Classifier: License :: OSI Approved :: MIT License
  17. Classifier: Operating System :: OS Independent
  18. Classifier: Programming Language :: Python :: 2
  19. Classifier: Programming Language :: Python :: 2.6
  20. Classifier: Programming Language :: Python :: 2.7
  21. Classifier: Programming Language :: Python :: 3
  22. Classifier: Programming Language :: Python :: 3.3
  23. Classifier: Programming Language :: Python :: 3.4
  24. Classifier: Programming Language :: Python :: 3.5
  25. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  26. Classifier: Topic :: Text Editors :: Integrated Development Environments (IDE)
  27. Classifier: Topic :: Utilities
  28. ###################################################################
  29. parso - A Python Parser
  30. ###################################################################
  31. .. image:: https://secure.travis-ci.org/davidhalter/parso.png?branch=master
  32. :target: http://travis-ci.org/davidhalter/parso
  33. :alt: Travis-CI build status
  34. .. image:: https://coveralls.io/repos/davidhalter/parso/badge.png?branch=master
  35. :target: https://coveralls.io/r/davidhalter/parso
  36. :alt: Coverage Status
  37. .. image:: https://raw.githubusercontent.com/davidhalter/parso/master/docs/_static/logo_characters.png
  38. Parso is a Python parser that supports error recovery and round-trip parsing
  39. for different Python versions (in multiple Python versions). Parso is also able
  40. to list multiple syntax errors in your python file.
  41. Parso has been battle-tested by jedi_. It was pulled out of jedi to be useful
  42. for other projects as well.
  43. Parso consists of a small API to parse Python and analyse the syntax tree.
  44. A simple example:
  45. .. code-block:: python
  46. >>> import parso
  47. >>> module = parso.parse('hello + 1', version="3.6")
  48. >>> expr = module.children[0]
  49. >>> expr
  50. PythonNode(arith_expr, [<Name: hello@1,0>, <Operator: +>, <Number: 1>])
  51. >>> print(expr.get_code())
  52. hello + 1
  53. >>> name = expr.children[0]
  54. >>> name
  55. <Name: hello@1,0>
  56. >>> name.end_pos
  57. (1, 5)
  58. >>> expr.end_pos
  59. (1, 9)
  60. To list multiple issues:
  61. .. code-block:: python
  62. >>> grammar = parso.load_grammar()
  63. >>> module = grammar.parse('foo +\nbar\ncontinue')
  64. >>> error1, error2 = grammar.iter_errors(module)
  65. >>> error1.message
  66. 'SyntaxError: invalid syntax'
  67. >>> error2.message
  68. "SyntaxError: 'continue' not properly in loop"
  69. Resources
  70. =========
  71. - `Testing <http://parso.readthedocs.io/en/latest/docs/development.html#testing>`_
  72. - `PyPI <https://pypi.python.org/pypi/parso>`_
  73. - `Docs <https://parso.readthedocs.org/en/latest/>`_
  74. - Uses `semantic versioning <http://semver.org/>`_
  75. Installation
  76. ============
  77. pip install parso
  78. Future
  79. ======
  80. - There will be better support for refactoring and comments. Stay tuned.
  81. - There's a WIP PEP8 validator. It's however not in a good shape, yet.
  82. Known Issues
  83. ============
  84. - `async`/`await` are already used as keywords in Python3.6.
  85. - `from __future__ import print_function` is not ignored.
  86. Acknowledgements
  87. ================
  88. - Guido van Rossum (@gvanrossum) for creating the parser generator pgen2
  89. (originally used in lib2to3).
  90. - `Salome Schneider <https://www.crepes-schnaegg.ch/cr%C3%AApes-schn%C3%A4gg/kunst-f%C3%BCrs-cr%C3%AApes-mobil/>`_
  91. for the extremely awesome parso logo.
  92. .. _jedi: https://github.com/davidhalter/jedi
  93. .. :changelog:
  94. Changelog
  95. ---------
  96. 0.3.1 (2018-07-09)
  97. +++++++++++++++++++
  98. - Bugfixes in the diff parser and keyword-only arguments
  99. 0.3.0 (2018-06-30)
  100. +++++++++++++++++++
  101. - Rewrote the pgen2 parser generator.
  102. 0.2.1 (2018-05-21)
  103. +++++++++++++++++++
  104. - A bugfix for the diff parser.
  105. - Grammar files can now be loaded from a specific path.
  106. 0.2.0 (2018-04-15)
  107. +++++++++++++++++++
  108. - f-strings are now parsed as a part of the normal Python grammar. This makes
  109. it way easier to deal with them.
  110. 0.1.1 (2017-11-05)
  111. +++++++++++++++++++
  112. - Fixed a few bugs in the caching layer
  113. - Added support for Python 3.7
  114. 0.1.0 (2017-09-04)
  115. +++++++++++++++++++
  116. - Pulling the library out of Jedi. Some APIs will definitely change.