Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-lark for openSUSE:Factory checked in at 2022-12-04 14:57:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-lark (Old) and /work/SRC/openSUSE:Factory/.python-lark.new.1835 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-lark" Sun Dec 4 14:57:34 2022 rev:3 rq:1039667 version:1.1.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-lark/python-lark.changes 2022-11-01 13:41:21.519510002 +0100 +++ /work/SRC/openSUSE:Factory/.python-lark.new.1835/python-lark.changes 2022-12-04 14:57:36.488012317 +0100 @@ -1,0 +2,13 @@ +Fri Dec 2 18:23:05 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- Update to v1.1.4 + ci: Python 3.11 final by @henryiii in #1204 + Add __all__ to __init__ by @aspizu in #1200 + PropagatePositions: Allow any object to carry the metadata, + by returning it in __lark_meta__() by @erezsh in #1203 + fix: Token now pattern matches correctly by @marcinplatek in #1181 + Updates to merge PR #1151 by @erezsh in #1205 + style: pre-commit basic config by @henryiii in #1151 + PR for v1.1.4 by @erezsh in #1208 + +------------------------------------------------------------------- Old: ---- lark-1.1.3.tar.gz New: ---- lark-1.1.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-lark.spec ++++++ --- /var/tmp/diff_new_pack.gXqwsK/_old 2022-12-04 14:57:38.220022295 +0100 +++ /var/tmp/diff_new_pack.gXqwsK/_new 2022-12-04 14:57:38.224022318 +0100 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-lark -Version: 1.1.3 +Version: 1.1.4 Release: 0 Summary: A parsing library for Python License: MIT ++++++ lark-1.1.3.tar.gz -> lark-1.1.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/.github/ISSUE_TEMPLATE/other.md new/lark-1.1.4/.github/ISSUE_TEMPLATE/other.md --- old/lark-1.1.3/.github/ISSUE_TEMPLATE/other.md 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/.github/ISSUE_TEMPLATE/other.md 2022-11-02 02:45:31.000000000 +0100 @@ -6,5 +6,3 @@ assignees: '' --- - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/.github/workflows/mypy.yml new/lark-1.1.4/.github/workflows/mypy.yml --- old/lark-1.1.3/.github/workflows/mypy.yml 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/.github/workflows/mypy.yml 2022-11-02 02:45:31.000000000 +0100 @@ -1,7 +1,7 @@ name: Python type check on: [push, pull_request] jobs: - build: + type: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -9,3 +9,11 @@ submodules: recursive - name: Lint with mypy run: pipx run tox -e type + + pre-commit: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v2.0.3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/.github/workflows/tests.yml new/lark-1.1.4/.github/workflows/tests.yml --- old/lark-1.1.3/.github/workflows/tests.yml 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/.github/workflows/tests.yml 2022-11-02 02:45:31.000000000 +0100 @@ -6,14 +6,14 @@ runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11-dev", "pypy-3.7"] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "pypy-3.7"] steps: - uses: actions/checkout@v3 with: submodules: recursive - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/.gitignore new/lark-1.1.4/.gitignore --- old/lark-1.1.3/.gitignore 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/.gitignore 2022-11-02 02:45:31.000000000 +0100 @@ -11,4 +11,4 @@ /dist /build docs/_build -docs/examples \ No newline at end of file +docs/examples diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/.pre-commit-config.yaml new/lark-1.1.4/.pre-commit-config.yaml --- old/lark-1.1.3/.pre-commit-config.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/lark-1.1.4/.pre-commit-config.yaml 2022-11-02 02:45:31.000000000 +0100 @@ -0,0 +1,32 @@ +# To use: +# +# pre-commit run -a +# +# Or: +# +# pre-commit install # (runs every time you commit in git) +# +# To update this file: +# +# pre-commit autoupdate +# +# See https://github.com/pre-commit/pre-commit + +repos: +# Standard hooks +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: "v4.2.0" + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-merge-conflict + - id: check-symlinks + - id: check-toml + - id: check-yaml + - id: debug-statements + - id: end-of-file-fixer + exclude: '(^tests/.*\.lark|\.svg)$' + - id: mixed-line-ending + - id: requirements-txt-fixer + - id: trailing-whitespace + exclude: '(^tests/.*\.lark|\.svg)$' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/CHANGELOG.md new/lark-1.1.4/CHANGELOG.md --- old/lark-1.1.3/CHANGELOG.md 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/CHANGELOG.md 2022-11-02 02:45:31.000000000 +0100 @@ -10,4 +10,4 @@ - `use_accepts` in `UnexpectedInput.match_examples()` is now True by default -- `v_args(meta=True)` now gives meta as the first argument. i.e. `(meta, children)` \ No newline at end of file +- `v_args(meta=True)` now gives meta as the first argument. i.e. `(meta, children)` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/LICENSE new/lark-1.1.4/LICENSE --- old/lark-1.1.3/LICENSE 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/LICENSE 2022-11-02 02:45:31.000000000 +0100 @@ -16,4 +16,3 @@ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/README.md new/lark-1.1.4/README.md --- old/lark-1.1.3/README.md 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/README.md 2022-11-02 02:45:31.000000000 +0100 @@ -105,7 +105,7 @@ - Grammar composition - Import terminals and rules from other grammars - Standard library of terminals (strings, numbers, names, etc.) - Import grammars from Nearley.js ([read more](/docs/tools.md#importing-grammars-from-nearleyjs)) - - Extensive test suite [](https://codecov.io/gh/lark-parser/lark) + - Extensive test suite [](https://codecov.io/gh/lark-parser/lark) - Type annotations (MyPy support) - And much more! @@ -193,4 +193,3 @@ For anything else, I can be reached by email at erezshin at gmail com. -- [Erez](https://github.com/erezsh) - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/docs/Makefile new/lark-1.1.4/docs/Makefile --- old/lark-1.1.3/docs/Makefile 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/docs/Makefile 2022-11-02 02:45:31.000000000 +0100 @@ -17,4 +17,4 @@ # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/docs/_static/sppf/sppf.html new/lark-1.1.4/docs/_static/sppf/sppf.html --- old/lark-1.1.3/docs/_static/sppf/sppf.html 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/docs/_static/sppf/sppf.html 2022-11-02 02:45:31.000000000 +0100 @@ -209,4 +209,4 @@ </div> </footer> -</body> \ No newline at end of file +</body> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/docs/classes.rst new/lark-1.1.4/docs/classes.rst --- old/lark-1.1.3/docs/classes.rst 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/docs/classes.rst 2022-11-02 02:45:31.000000000 +0100 @@ -81,7 +81,7 @@ ast_utils --------- -For an example of using ``ast_utils``, see `/examples/advanced/create_ast.py`_ +For an example of using ``ast_utils``, see `/examples/advanced/create_ast.py`_ .. autoclass:: lark.ast_utils.Ast @@ -89,4 +89,4 @@ .. autofunction:: lark.ast_utils.create_transformer -.. _/examples/advanced/create_ast.py: examples/advanced/create_ast.html \ No newline at end of file +.. _/examples/advanced/create_ast.py: examples/advanced/create_ast.html diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/docs/conf.py new/lark-1.1.4/docs/conf.py --- old/lark-1.1.3/docs/conf.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/docs/conf.py 2022-11-02 02:45:31.000000000 +0100 @@ -182,4 +182,4 @@ sphinx_gallery_conf = { 'examples_dirs': ['../examples'], 'gallery_dirs': ['examples'], -} \ No newline at end of file +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/docs/features.md new/lark-1.1.4/docs/features.md --- old/lark-1.1.3/docs/features.md 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/docs/features.md 2022-11-02 02:45:31.000000000 +0100 @@ -29,4 +29,3 @@ - Visualize your parse trees as dot or png files ([see_example](https://github.com/lark-parser/lark/blob/master/examples/fruitflies.py)) - Automatic reconstruction of input from parse-tree (see examples) - Use Lark grammars in Julia and Javascript. - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/docs/how_to_develop.md new/lark-1.1.4/docs/how_to_develop.md --- old/lark-1.1.3/docs/how_to_develop.md 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/docs/how_to_develop.md 2022-11-02 02:45:31.000000000 +0100 @@ -63,5 +63,5 @@ Another way to run the tests is using setup.py: ```bash -python setup.py test +python setup.py test ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/docs/ide/app/app.py new/lark-1.1.4/docs/ide/app/app.py --- old/lark-1.1.3/docs/ide/app/app.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/docs/ide/app/app.py 2022-11-02 02:45:31.000000000 +0100 @@ -80,4 +80,3 @@ html5.Body().appendChild( App() ) - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/docs/ide/app/examples.py new/lark-1.1.4/docs/ide/app/examples.py --- old/lark-1.1.3/docs/ide/app/examples.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/docs/ide/app/examples.py 2022-11-02 02:45:31.000000000 +0100 @@ -147,4 +147,4 @@ "favoriteFruit": "strawberry" } ]""") -} \ No newline at end of file +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/docs/ide/app/files.json new/lark-1.1.4/docs/ide/app/files.json --- old/lark-1.1.3/docs/ide/app/files.json 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/docs/ide/app/files.json 2022-11-02 02:45:31.000000000 +0100 @@ -6,4 +6,4 @@ "ext.py", "ignite.py", "utils.py" -] \ No newline at end of file +] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/docs/ide/app/html5.py new/lark-1.1.4/docs/ide/app/html5.py --- old/lark-1.1.3/docs/ide/app/html5.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/docs/ide/app/html5.py 2022-11-02 02:45:31.000000000 +0100 @@ -2,5 +2,3 @@ from .core import * from . import ext, utils, ignite - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/docs/philosophy.md new/lark-1.1.4/docs/philosophy.md --- old/lark-1.1.3/docs/philosophy.md 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/docs/philosophy.md 2022-11-02 02:45:31.000000000 +0100 @@ -62,4 +62,3 @@ - Automatically resolve terminal collisions whenever possible - Automatically keep track of line & column numbers - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/docs/recipes.md new/lark-1.1.4/docs/recipes.md --- old/lark-1.1.3/docs/recipes.md 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/docs/recipes.md 2022-11-02 02:45:31.000000000 +0100 @@ -171,4 +171,4 @@ print( t.transform(tree)) except VisitError as e: raise e.orig_exc -``` \ No newline at end of file +``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/docs/requirements.txt new/lark-1.1.4/docs/requirements.txt --- old/lark-1.1.3/docs/requirements.txt 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/docs/requirements.txt 2022-11-02 02:45:31.000000000 +0100 @@ -1,6 +1,6 @@ # https://docs.readthedocs.io/en/stable/guides/specifying-dependencies.html#specifying-a-requirements-file +pillow +recommonmark sphinx-gallery sphinx_markdown_tables -recommonmark sphinx_rtd_theme -pillow \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/docs/tools.md new/lark-1.1.4/docs/tools.md --- old/lark-1.1.3/docs/tools.md 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/docs/tools.md 2022-11-02 02:45:31.000000000 +0100 @@ -68,4 +68,3 @@ - Lark currently cannot export grammars to Nearley These might get added in the future, if enough users ask for them. - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/docs/visitors.rst new/lark-1.1.4/docs/visitors.rst --- old/lark-1.1.3/docs/visitors.rst 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/docs/visitors.rst 2022-11-02 02:45:31.000000000 +0100 @@ -119,4 +119,4 @@ VisitError ---------- -.. autoclass:: lark.exceptions.VisitError \ No newline at end of file +.. autoclass:: lark.exceptions.VisitError diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/examples/advanced/error_handling.py new/lark-1.1.4/examples/advanced/error_handling.py --- old/lark-1.1.3/examples/advanced/error_handling.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/examples/advanced/error_handling.py 2022-11-02 02:45:31.000000000 +0100 @@ -34,4 +34,3 @@ print(res) # prints [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0] main() - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/examples/advanced/error_reporting_earley.py new/lark-1.1.4/examples/advanced/error_reporting_earley.py --- old/lark-1.1.3/examples/advanced/error_reporting_earley.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/examples/advanced/error_reporting_earley.py 2022-11-02 02:45:31.000000000 +0100 @@ -75,5 +75,3 @@ if __name__ == '__main__': test() - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/examples/advanced/error_reporting_lalr.py new/lark-1.1.4/examples/advanced/error_reporting_lalr.py --- old/lark-1.1.3/examples/advanced/error_reporting_lalr.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/examples/advanced/error_reporting_lalr.py 2022-11-02 02:45:31.000000000 +0100 @@ -75,5 +75,3 @@ if __name__ == '__main__': test() - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/examples/advanced/py3to2.py new/lark-1.1.4/examples/advanced/py3to2.py --- old/lark-1.1.3/examples/advanced/py3to2.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/examples/advanced/py3to2.py 2022-11-02 02:45:31.000000000 +0100 @@ -45,12 +45,12 @@ # # 2. Define translations using templates (each template code is parsed to a template tree) -# +# pytemplate = TemplateConf(parse=parse_template) translations_3to2 = { - 'yield from $a': + 'yield from $a': 'for _tmp in $a: yield _tmp', 'raise $e from $x': @@ -63,7 +63,7 @@ # # 3. Translate and reconstruct Python 3 code into valid Python 2 code -# +# python_reconstruct = PythonReconstructor(parser) @@ -91,4 +91,4 @@ print(translate_py3to2(_TEST_CODE)) if __name__ == '__main__': - test() \ No newline at end of file + test() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/examples/advanced/python2.lark new/lark-1.1.4/examples/advanced/python2.lark --- old/lark-1.1.3/examples/advanced/python2.lark 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/examples/advanced/python2.lark 2022-11-02 02:45:31.000000000 +0100 @@ -165,4 +165,3 @@ %ignore /\\[\t \f]*\r?\n/ // LINE_CONT %ignore COMMENT %declare _INDENT _DEDENT - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/examples/advanced/python_parser.py new/lark-1.1.4/examples/advanced/python_parser.py --- old/lark-1.1.3/examples/advanced/python_parser.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/examples/advanced/python_parser.py 2022-11-02 02:45:31.000000000 +0100 @@ -76,4 +76,4 @@ if __name__ == '__main__': test_python_lib() # test_earley_equals_lalr() - # python_parser3.parse(_read(sys.argv[1]) + '\n') \ No newline at end of file + # python_parser3.parse(_read(sys.argv[1]) + '\n') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/examples/advanced/reconstruct_python.py new/lark-1.1.4/examples/advanced/reconstruct_python.py --- old/lark-1.1.3/examples/advanced/reconstruct_python.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/examples/advanced/reconstruct_python.py 2022-11-02 02:45:31.000000000 +0100 @@ -83,4 +83,4 @@ if __name__ == '__main__': - test() \ No newline at end of file + test() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/examples/advanced/templates.py new/lark-1.1.4/examples/advanced/templates.py --- old/lark-1.1.3/examples/advanced/templates.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/examples/advanced/templates.py 2022-11-02 02:45:31.000000000 +0100 @@ -26,4 +26,4 @@ parser = Lark(grammar) print(parser.parse('[1, "a", 2]')) -print(parser.parse('{"a": 2, "b": 6}')) \ No newline at end of file +print(parser.parse('{"a": 2, "b": 6}')) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/examples/composition/README.md new/lark-1.1.4/examples/composition/README.md --- old/lark-1.1.3/examples/composition/README.md 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/examples/composition/README.md 2022-11-02 02:45:31.000000000 +0100 @@ -7,4 +7,4 @@ We show how, by using namespaces, Lark grammars and their transformers can be fully reused - they don't need to care if their grammar is used directly, or being imported, or who is doing the importing. -See [``main.py``](main.py) for more details. \ No newline at end of file +See [``main.py``](main.py) for more details. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/examples/composition/main.py new/lark-1.1.4/examples/composition/main.py --- old/lark-1.1.3/examples/composition/main.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/examples/composition/main.py 2022-11-02 02:45:31.000000000 +0100 @@ -48,4 +48,4 @@ if __name__ == "__main__": - main() \ No newline at end of file + main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/examples/composition/storage.lark new/lark-1.1.4/examples/composition/storage.lark --- old/lark-1.1.3/examples/composition/storage.lark 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/examples/composition/storage.lark 2022-11-02 02:45:31.000000000 +0100 @@ -6,4 +6,3 @@ %import .json.start -> json__start %import .csv._NL -> _NL - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/examples/grammars/README.md new/lark-1.1.4/examples/grammars/README.md --- old/lark-1.1.3/examples/grammars/README.md 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/examples/grammars/README.md 2022-11-02 02:45:31.000000000 +0100 @@ -2,4 +2,4 @@ This directory is a collection of lark grammars, taken from real world projects. -- [Verilog](verilog.lark) - Taken from https://github.com/circuitgraph/circuitgraph/blob/master/circuitgraph/parsing/verilog.lark \ No newline at end of file +- [Verilog](verilog.lark) - Taken from https://github.com/circuitgraph/circuitgraph/blob/master/circuitgraph/parsing/verilog.lark diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/examples/grammars/verilog.lark new/lark-1.1.4/examples/grammars/verilog.lark --- old/lark-1.1.3/examples/grammars/verilog.lark 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/examples/grammars/verilog.lark 2022-11-02 02:45:31.000000000 +0100 @@ -3,9 +3,9 @@ // 1. Source Text start: description* - + ?description: module - + module: "module" name_of_module list_of_ports? ";" module_item* "endmodule" ?name_of_module: IDENTIFIER @@ -13,7 +13,7 @@ list_of_ports: "(" port ("," port)* ")" ?port: IDENTIFIER - + ?module_item: input_declaration | output_declaration | net_declaration diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/examples/indented_tree.py new/lark-1.1.4/examples/indented_tree.py --- old/lark-1.1.3/examples/indented_tree.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/examples/indented_tree.py 2022-11-02 02:45:31.000000000 +0100 @@ -52,4 +52,3 @@ if __name__ == '__main__': test() - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/examples/standalone/README.md new/lark-1.1.4/examples/standalone/README.md --- old/lark-1.1.3/examples/standalone/README.md 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/examples/standalone/README.md 2022-11-02 02:45:31.000000000 +0100 @@ -17,4 +17,3 @@ ```bash python json_parser_main.py <path-to.json> ``` - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/examples/standalone/json_parser_main.py new/lark-1.1.4/examples/standalone/json_parser_main.py --- old/lark-1.1.3/examples/standalone/json_parser_main.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/examples/standalone/json_parser_main.py 2022-11-02 02:45:31.000000000 +0100 @@ -34,4 +34,3 @@ if __name__ == '__main__': with open(sys.argv[1]) as f: print(parser.parse(f.read())) - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/examples/tests/no_newline_at_end.lark new/lark-1.1.4/examples/tests/no_newline_at_end.lark --- old/lark-1.1.3/examples/tests/no_newline_at_end.lark 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/examples/tests/no_newline_at_end.lark 2022-11-02 02:45:31.000000000 +0100 @@ -1 +1 @@ -start: "a" \ No newline at end of file +start: "a" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/lark/__init__.py new/lark-1.1.4/lark/__init__.py --- old/lark-1.1.3/lark/__init__.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/lark/__init__.py 2022-11-02 02:45:31.000000000 +0100 @@ -1,9 +1,38 @@ -from .utils import logger -from .tree import Tree, ParseTree -from .visitors import Transformer, Visitor, v_args, Discard, Transformer_NonRecursive -from .exceptions import (ParseError, LexError, GrammarError, UnexpectedToken, - UnexpectedInput, UnexpectedCharacters, UnexpectedEOF, LarkError) -from .lexer import Token +from .exceptions import ( + GrammarError, + LarkError, + LexError, + ParseError, + UnexpectedCharacters, + UnexpectedEOF, + UnexpectedInput, + UnexpectedToken, +) from .lark import Lark +from .lexer import Token +from .tree import ParseTree, Tree +from .utils import logger +from .visitors import Discard, Transformer, Transformer_NonRecursive, Visitor, v_args + +__version__: str = "1.1.4" -__version__: str = "1.1.3" +__all__ = ( + "GrammarError", + "LarkError", + "LexError", + "ParseError", + "UnexpectedCharacters", + "UnexpectedEOF", + "UnexpectedInput", + "UnexpectedToken", + "Lark", + "Token", + "ParseTree", + "Tree", + "logger", + "Discard", + "Transformer", + "Transformer_NonRecursive", + "Visitor", + "v_args", +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/lark/__pyinstaller/__init__.py new/lark-1.1.4/lark/__pyinstaller/__init__.py --- old/lark-1.1.3/lark/__pyinstaller/__init__.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/lark/__pyinstaller/__init__.py 2022-11-02 02:45:31.000000000 +0100 @@ -3,4 +3,4 @@ import os def get_hook_dirs(): - return [os.path.dirname(__file__)] \ No newline at end of file + return [os.path.dirname(__file__)] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/lark/ast_utils.py new/lark-1.1.4/lark/ast_utils.py --- old/lark-1.1.3/lark/ast_utils.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/lark/ast_utils.py 2022-11-02 02:45:31.000000000 +0100 @@ -44,7 +44,7 @@ Parameters: ast_module: A Python module containing all the subclasses of ``ast_utils.Ast`` transformer (Optional[Transformer]): An initial transformer. Its attributes may be overwritten. - decorator_factory (Callable): An optional callable accepting two booleans, inline, and meta, + decorator_factory (Callable): An optional callable accepting two booleans, inline, and meta, and returning a decorator for the methods of ``transformer``. (default: ``v_args``). """ t = transformer or Transformer() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/lark/exceptions.py new/lark-1.1.4/lark/exceptions.py --- old/lark-1.1.3/lark/exceptions.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/lark/exceptions.py 2022-11-02 02:45:31.000000000 +0100 @@ -168,7 +168,7 @@ class UnexpectedCharacters(LexError, UnexpectedInput): - """An exception that is raised by the lexer, when it cannot match the next + """An exception that is raised by the lexer, when it cannot match the next string of characters to any of its terminals. """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/lark/grammars/python.lark new/lark-1.1.4/lark/grammars/python.lark --- old/lark-1.1.3/lark/grammars/python.lark 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/lark/grammars/python.lark 2022-11-02 02:45:31.000000000 +0100 @@ -50,14 +50,14 @@ ?stmt: simple_stmt | compound_stmt ?simple_stmt: small_stmt (";" small_stmt)* [";"] _NEWLINE ?small_stmt: (expr_stmt | assign_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | nonlocal_stmt | assert_stmt) -expr_stmt: testlist_star_expr +expr_stmt: testlist_star_expr assign_stmt: annassign | augassign | assign annassign: testlist_star_expr ":" test ["=" test] assign: testlist_star_expr ("=" (yield_expr|testlist_star_expr))+ augassign: testlist_star_expr augassign_op (yield_expr|testlist) !augassign_op: "+=" | "-=" | "*=" | "@=" | "/=" | "%=" | "&=" | "|=" | "^=" | "<<=" | ">>=" | "**=" | "//=" -?testlist_star_expr: test_or_star_expr +?testlist_star_expr: test_or_star_expr | test_or_star_expr ("," test_or_star_expr)+ ","? -> tuple | test_or_star_expr "," -> tuple @@ -95,13 +95,13 @@ try_stmt: "try" ":" suite except_clauses ["else" ":" suite] [finally] | "try" ":" suite finally -> try_finally finally: "finally" ":" suite -except_clauses: except_clause+ +except_clauses: except_clause+ except_clause: "except" [test ["as" name]] ":" suite // NB compile.c makes sure that the default except clause is last with_stmt: "with" with_items ":" suite -with_items: with_item ("," with_item)* +with_items: with_item ("," with_item)* with_item: test ["as" name] match_stmt: "match" test ":" _NEWLINE _INDENT case+ _DEDENT @@ -204,7 +204,7 @@ | "{" _set_exprlist "}" -> set | "{" comprehension{test} "}" -> set_comprehension | name -> var - | number + | number | string_concat | "(" test ")" | "..." -> ellipsis @@ -217,7 +217,7 @@ _testlist_comp: test | _tuple_inner _tuple_inner: test_or_star_expr (("," test_or_star_expr)+ [","] | ",") - + ?test_or_star_expr: test | star_expr @@ -253,7 +253,7 @@ comprehension{comp_result}: comp_result comp_fors [comp_if] -comp_fors: comp_for+ +comp_fors: comp_for+ comp_for: [ASYNC] "for" exprlist "in" or_test ASYNC: "async" ?comp_if: "if" test_nocond diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/lark/lark.py new/lark-1.1.4/lark/lark.py --- old/lark-1.1.3/lark/lark.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/lark/lark.py 2022-11-02 02:45:31.000000000 +0100 @@ -1,6 +1,6 @@ from abc import ABC, abstractmethod import getpass -import sys, os, pickle, hashlib +import sys, os, pickle import tempfile import types import re @@ -17,7 +17,7 @@ else: from typing_extensions import Literal from .parser_frontends import ParsingFrontend - + from .exceptions import ConfigurationError, assert_config, UnexpectedInput from .utils import Serialize, SerializeMemoizer, FS, isascii, logger from .load_grammar import load_grammar, FromPackageLoader, Grammar, verify_used_files, PackageResource, md5_digest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/lark/lexer.py new/lark-1.1.4/lark/lexer.py --- old/lark-1.1.3/lark/lexer.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/lark/lexer.py 2022-11-02 02:45:31.000000000 +0100 @@ -5,9 +5,10 @@ from contextlib import suppress from typing import ( TypeVar, Type, List, Dict, Iterator, Collection, Callable, Optional, FrozenSet, Any, - Pattern as REPattern, ClassVar, TYPE_CHECKING + Pattern as REPattern, ClassVar, TYPE_CHECKING, overload ) from types import ModuleType +import warnings if TYPE_CHECKING: from .common import LexerConf @@ -147,18 +148,61 @@ """ __slots__ = ('type', 'start_pos', 'value', 'line', 'column', 'end_line', 'end_column', 'end_pos') + __match_args__ = ('type', 'value') + type: str - start_pos: int + start_pos: Optional[int] value: Any - line: int - column: int - end_line: int - end_column: int - end_pos: int + line: Optional[int] + column: Optional[int] + end_line: Optional[int] + end_column: Optional[int] + end_pos: Optional[int] + + + @overload + def __new__( + cls, + type: str, + value: Any, + start_pos: Optional[int]=None, + line: Optional[int]=None, + column: Optional[int]=None, + end_line: Optional[int]=None, + end_column: Optional[int]=None, + end_pos: Optional[int]=None + ) -> 'Token': + ... + + @overload + def __new__( + cls, + type_: str, + value: Any, + start_pos: Optional[int]=None, + line: Optional[int]=None, + column: Optional[int]=None, + end_line: Optional[int]=None, + end_column: Optional[int]=None, + end_pos: Optional[int]=None + ) -> 'Token': ... + + def __new__(cls, *args, **kwargs): + if "type_" in kwargs: + warnings.warn("`type_` is deprecated use `type` instead", DeprecationWarning) + + if "type" in kwargs: + raise TypeError("Error: using both 'type' and the deprecated 'type_' as arguments.") + kwargs["type"] = kwargs.pop("type_") + + return cls._future_new(*args, **kwargs) + - def __new__(cls, type_, value, start_pos=None, line=None, column=None, end_line=None, end_column=None, end_pos=None): + @classmethod + def _future_new(cls, type, value, start_pos=None, line=None, column=None, end_line=None, end_column=None, end_pos=None): inst = super(Token, cls).__new__(cls, value) - inst.type = type_ + + inst.type = type inst.start_pos = start_pos inst.value = value inst.line = line @@ -168,9 +212,27 @@ inst.end_pos = end_pos return inst + @overload + def update(self, type: Optional[str]=None, value: Optional[Any]=None) -> 'Token': + ... + + @overload def update(self, type_: Optional[str]=None, value: Optional[Any]=None) -> 'Token': + ... + + def update(self, *args, **kwargs): + if "type_" in kwargs: + warnings.warn("`type_` is deprecated use `type` instead", DeprecationWarning) + + if "type" in kwargs: + raise TypeError("Error: using both 'type' and the deprecated 'type_' as arguments.") + kwargs["type"] = kwargs.pop("type_") + + return self._future_update(*args, **kwargs) + + def _future_update(self, type: Optional[str]=None, value: Optional[Any]=None) -> 'Token': return Token.new_borrow_pos( - type_ if type_ is not None else self.type, + type if type is not None else self.type, value if value is not None else self.value, self ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/lark/parse_tree_builder.py new/lark-1.1.4/lark/parse_tree_builder.py --- old/lark-1.1.3/lark/parse_tree_builder.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/lark/parse_tree_builder.py 2022-11-02 02:45:31.000000000 +0100 @@ -73,6 +73,8 @@ return c.meta elif isinstance(c, Token): return c + elif hasattr(c, '__lark_meta__'): + return c.__lark_meta__() def make_propagate_positions(option): if callable(option): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/lark/parsers/earley.py new/lark-1.1.4/lark/parsers/earley.py --- old/lark-1.1.3/lark/parsers/earley.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/lark/parsers/earley.py 2022-11-02 02:45:31.000000000 +0100 @@ -170,7 +170,7 @@ return True # def create_leo_transitives(origin, start): - # ... # removed at commit 4c1cfb2faf24e8f8bff7112627a00b94d261b420 + # ... # removed at commit 4c1cfb2faf24e8f8bff7112627a00b94d261b420 def scan(i, token, to_scan): """The core Earley Scanner. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/lark/parsers/earley_common.py new/lark-1.1.4/lark/parsers/earley_common.py --- old/lark-1.1.3/lark/parsers/earley_common.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/lark/parsers/earley_common.py 2022-11-02 02:45:31.000000000 +0100 @@ -39,4 +39,4 @@ # class TransitiveItem(Item): -# ... # removed at commit 4c1cfb2faf24e8f8bff7112627a00b94d261b420 \ No newline at end of file +# ... # removed at commit 4c1cfb2faf24e8f8bff7112627a00b94d261b420 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/lark/parsers/lalr_interactive_parser.py new/lark-1.1.4/lark/parsers/lalr_interactive_parser.py --- old/lark-1.1.3/lark/parsers/lalr_interactive_parser.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/lark/parsers/lalr_interactive_parser.py 2022-11-02 02:45:31.000000000 +0100 @@ -37,20 +37,20 @@ Returns an iterator of the tokens it encounters. - When the parse is over, the resulting tree can be found in ``InteractiveParser.result``. + When the parse is over, the resulting tree can be found in ``InteractiveParser.result``. """ for token in self.lexer_thread.lex(self.parser_state): yield token self.result = self.feed_token(token) - + def exhaust_lexer(self) -> List[Token]: """Try to feed the rest of the lexer state into the interactive parser. - + Note that this modifies the instance in place and does not feed an '$END' Token """ return list(self.iter_parse()) - + def feed_eof(self, last_token=None): """Feed a '$END' Token. Borrows from 'last_token' if given.""" eof = Token.new_borrow_pos('$END', '', last_token) if last_token is not None else self.lexer_thread._Token('$END', '', 0, 1, 1) @@ -146,4 +146,3 @@ """Convert to an ``InteractiveParser``.""" p = copy(self) return InteractiveParser(p.parser, p.parser_state, p.lexer_thread) - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/lark/parsers/lalr_parser.py new/lark-1.1.4/lark/parsers/lalr_parser.py --- old/lark-1.1.3/lark/parsers/lalr_parser.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/lark/parsers/lalr_parser.py 2022-11-02 02:45:31.000000000 +0100 @@ -197,4 +197,3 @@ raise ###} - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/lark/tools/__init__.py new/lark-1.1.4/lark/tools/__init__.py --- old/lark-1.1.3/lark/tools/__init__.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/lark/tools/__init__.py 2022-11-02 02:45:31.000000000 +0100 @@ -53,7 +53,7 @@ if file is None: file = sys.stderr if file is None: - return + return try: file.write(text) except OSError: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/lark/tools/standalone.py new/lark-1.1.4/lark/tools/standalone.py --- old/lark-1.1.3/lark/tools/standalone.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/lark/tools/standalone.py 2022-11-02 02:45:31.000000000 +0100 @@ -29,7 +29,7 @@ from types import ModuleType from typing import ( TypeVar, Generic, Type, Tuple, List, Dict, Iterator, Collection, Callable, Optional, FrozenSet, Any, - Union, Iterable, IO, TYPE_CHECKING, + Union, Iterable, IO, TYPE_CHECKING, overload, Pattern as REPattern, ClassVar, Set, Mapping ) ###} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/lark/visitors.py new/lark-1.1.4/lark/visitors.py --- old/lark-1.1.3/lark/visitors.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/lark/visitors.py 2022-11-02 02:45:31.000000000 +0100 @@ -72,7 +72,7 @@ class Transformer(_Decoratable, ABC, Generic[_Leaf_T, _Return_T]): - """Transformers work bottom-up (or depth-first), starting with visiting the leaves and working + """Transformers work bottom-up (or depth-first), starting with visiting the leaves and working their way up until ending at the root of the tree. For each node visited, the transformer will call the appropriate method (callbacks), according to the @@ -83,7 +83,7 @@ If the transformer cannot find a method with the right name, it will instead call ``__default__``, which by default creates a copy of the node. - + To discard a node, return Discard (``lark.visitors.Discard``). ``Transformer`` can do anything ``Visitor`` can do, but because it reconstructs the tree, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/setup.py new/lark-1.1.4/setup.py --- old/lark-1.1.3/setup.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/setup.py 2022-11-02 02:45:31.000000000 +0100 @@ -69,4 +69,3 @@ ] }, ) - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/test-requirements.txt new/lark-1.1.4/test-requirements.txt --- old/lark-1.1.3/test-requirements.txt 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/test-requirements.txt 2022-11-02 02:45:31.000000000 +0100 @@ -1,2 +1,2 @@ Js2Py==0.68 -regex \ No newline at end of file +regex diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/tests/__main__.py new/lark-1.1.4/tests/__main__.py --- old/lark-1.1.3/tests/__main__.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/tests/__main__.py 2022-11-02 02:45:31.000000000 +0100 @@ -2,6 +2,7 @@ import unittest import logging +import sys from lark import logger from .test_trees import TestTrees @@ -26,6 +27,9 @@ from .test_parser import * # We define __all__ to list which TestSuites to run +if sys.version_info >= (3, 10): + from .test_pattern_matching import TestPatternMatching + logger.setLevel(logging.INFO) if __name__ == '__main__': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/tests/test_cache.py new/lark-1.1.4/tests/test_cache.py --- old/lark-1.1.3/tests/test_cache.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/tests/test_cache.py 2022-11-02 02:45:31.000000000 +0100 @@ -71,12 +71,12 @@ class TestCache(TestCase): g = '''start: "a"''' - + def setUp(self): self.fs = lark_module.FS self.mock_fs = MockFS() lark_module.FS = self.mock_fs - + def tearDown(self): self.mock_fs.files = {} lark_module.FS = self.fs @@ -88,7 +88,7 @@ assert fn in self.mock_fs.files parser = Lark(self.g, parser='lalr', cache=fn) assert parser.parse('a') == Tree('start', []) - + def test_automatic_naming(self): assert len(self.mock_fs.files) == 0 Lark(self.g, parser='lalr', cache=True) @@ -102,7 +102,7 @@ parser = Lark(self.g, parser='lalr', cache=True) assert parser.parse('a') == Tree('start', []) - + def test_custom_lexer(self): parser = Lark(self.g, parser='lalr', lexer=CustomLexer, cache=True) @@ -115,7 +115,7 @@ Lark(self.g, parser="lalr", debug=True, cache=True) parser = Lark(self.g, parser="lalr", debug=True, cache=True) assert parser.options.options['debug'] - + def test_inline(self): # Test inline transformer (tree-less) & lexer_callbacks # Note: the Transformer should not be saved to the file, @@ -136,7 +136,7 @@ res1 = parser.parse(text) res2 = InlineTestT().transform(Lark(g, parser="lalr", cache=True, lexer_callbacks={'NUM': append_zero}).parse(text)) assert res0 == res1 == res2 == expected - + def test_imports(self): g = """ %import .grammars.ab (startab, expr) @@ -167,7 +167,7 @@ # should only have the dummy log self.assertCountEqual(cm.output, ["ERROR:lark:dummy message"]) - + if __name__ == '__main__': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/tests/test_grammar.py new/lark-1.1.4/tests/test_grammar.py --- old/lark-1.1.3/tests/test_grammar.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/tests/test_grammar.py 2022-11-02 02:45:31.000000000 +0100 @@ -302,6 +302,3 @@ if __name__ == '__main__': main() - - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/tests/test_lexer.py new/lark-1.1.4/tests/test_lexer.py --- old/lark-1.1.3/tests/test_lexer.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/tests/test_lexer.py 2022-11-02 02:45:31.000000000 +0100 @@ -20,4 +20,4 @@ if __name__ == '__main__': - main() \ No newline at end of file + main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/tests/test_parser.py new/lark-1.1.4/tests/test_parser.py --- old/lark-1.1.3/tests/test_parser.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/tests/test_parser.py 2022-11-02 02:45:31.000000000 +0100 @@ -193,11 +193,11 @@ class T(base): def add(self, children): return sum(children if isinstance(children, list) else children.children) - + def NUM(self, token): return int(token) - - + + parser = Lark(g, parser='lalr', transformer=T()) result = parser.parse(text) self.assertEqual(result, expected) @@ -385,7 +385,7 @@ tokens = {'A%d'%i:'"%d"'%i for i in range(300)} g = """start: %s %s""" % (' '.join(tokens), '\n'.join("%s: %s"%x for x in tokens.items())) - + p = Lark(g, parser='lalr') @@ -2478,7 +2478,7 @@ NAME: /[\w]+/ """, regex=True) self.assertEqual(g.parse('வணà®à¯à®à®®à¯'), 'வணà®à¯à®à®®à¯') - + @unittest.skipIf(not regex, "regex not installed") def test_regex_width_fallback(self): g = r""" @@ -2488,7 +2488,7 @@ self.assertRaises((GrammarError, LexError, re.error), _Lark, g) p = _Lark(g, regex=True) self.assertEqual(p.parse("123abc"), Tree('start', ['123', 'abc'])) - + g = r""" start: NAME NAME? NAME: /(?(?=\d)\d+|\w*)/ @@ -2503,7 +2503,7 @@ A: "a" B: "b" ''') - + ip = g.parse_interactive() self.assertRaises(UnexpectedToken, ip.feed_eof) @@ -2526,7 +2526,7 @@ res = ip.feed_eof(ip.lexer_thread.state.last_token) self.assertEqual(res, Tree('start', ['a', 'b'])) self.assertRaises(UnexpectedToken ,ip.feed_eof) - + self.assertRaises(UnexpectedToken, ip_copy.feed_token, Token('A', 'a')) ip_copy.feed_token(Token('B', 'b')) res = ip_copy.feed_eof() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/tests/test_pattern_matching.py new/lark-1.1.4/tests/test_pattern_matching.py --- old/lark-1.1.3/tests/test_pattern_matching.py 1970-01-01 01:00:00.000000000 +0100 +++ new/lark-1.1.4/tests/test_pattern_matching.py 2022-11-02 02:45:31.000000000 +0100 @@ -0,0 +1,52 @@ +from unittest import TestCase, main + +from lark import Token + + +class TestPatternMatching(TestCase): + token = Token('A', 'a') + + def setUp(self): + pass + + def test_matches_with_string(self): + match self.token: + case 'a': + pass + case _: + assert False + + def test_matches_with_str_positional_arg(self): + match self.token: + case str('a'): + pass + case _: + assert False + + def test_matches_with_token_positional_arg(self): + match self.token: + case Token('a'): + assert False + case Token('A'): + pass + case _: + assert False + + def test_matches_with_token_kwarg_type(self): + match self.token: + case Token(type='A'): + pass + case _: + assert False + + def test_matches_with_bad_token_type(self): + match self.token: + case Token(type='B'): + assert False + case _: + pass + + + +if __name__ == '__main__': + main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/tests/test_python_grammar.py new/lark-1.1.4/tests/test_python_grammar.py --- old/lark-1.1.3/tests/test_python_grammar.py 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/tests/test_python_grammar.py 2022-11-02 02:45:31.000000000 +0100 @@ -190,7 +190,7 @@ case str() | bytes(): print("Something string-like") case _: - print("Something else") + print("Something else") """), # guards diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lark-1.1.3/tox.ini new/lark-1.1.4/tox.ini --- old/lark-1.1.3/tox.ini 2022-10-11 10:16:28.000000000 +0200 +++ new/lark-1.1.4/tox.ini 2022-11-02 02:45:31.000000000 +0100 @@ -1,5 +1,5 @@ [tox] -envlist = py36, py37, py38, py39, py310, pypy3, type +envlist = lint, type, py36, py37, py38, py39, py310, py311, pypy3 skip_missing_interpreters = true [testenv] @@ -28,3 +28,12 @@ rich commands = mypy + +[testenv:lint] +description = run linters on code base +skip_install = true +recreate = false +deps = + pre-commit +commands = + pre-commit run --all-files --show-diff-on-failure