Skip to main content
Marso MIT licensed Python package

Marso is a Move language parser that supports error recovery and round-trip parsing . Marso is also able to list multiple syntax errors in your move source file.

Marso has been battle-tested by jedi.

Marso consists of a small API to parse Move language and analyse the syntax tree.

A simple example:

>>> import marso
>>> module = marso.parse('hello + 1', version="3.6")
>>> expr = module.children[0]
>>> expr
PythonNode(arith_expr, [<Name: hello@1,0>, <Operator: +>, <Number: 1>])
>>> print(expr.get_code())
hello + 1
>>> name = expr.children[0]
>>> name
<Name: hello@1,0>
>>> name.end_pos
(1, 5)
>>> expr.end_pos
(1, 9)

To list multiple issues:

>>> grammar = marso.load_grammar()
>>> module = grammar.parse('foo +\nbar\ncontinue')
>>> error1, error2 = grammar.iter_errors(module)
>>> error1.message
'SyntaxError: invalid syntax'
>>> error2.message
"SyntaxError: 'continue' not properly in loop"

Resources

Installation

pip install marso

Acknowledgements

  • David Halter (@davidhalter) for the original Parso project.

  • Guido van Rossum (@gvanrossum) for creating the parser generator pgen2 (originally used in lib2to3).

Changelog

0.0.1 (2020-05-29)

  • Test publish as a pip package, not work yet.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marso-0.0.3.tar.gz (460.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

marso-0.0.3-py2.py3-none-any.whl (196.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file marso-0.0.3.tar.gz.

File metadata

  • Download URL: marso-0.0.3.tar.gz
  • Upload date:
  • Size: 460.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for marso-0.0.3.tar.gz
Algorithm Hash digest
SHA256 83b27e0724832a6dfa38896fc632a4617f03cc58c1f2f6390a8f8ed3cfca00c2
MD5 79d3cb1c14667cb08789ebc8a146436c
BLAKE2b-256 c588af7808b82fc8636efdbe9837c06607ba6c8c81d045e7c278f4c254205b40

See more details on using hashes here.

File details

Details for the file marso-0.0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: marso-0.0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 196.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for marso-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8e73e56f7d0702612c0b1d5c9dbb711184c2184c6a2e9f2528b069a1fd8e8314
MD5 179d23d66f2df83bea27437d84b26feb
BLAKE2b-256 492ecac6b47fd2203ce3b13859ba9444a574ea0ec10dd0270f1bf36403982b68

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page