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-15 19:24:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-lark (Old)
 and      /work/SRC/openSUSE:Factory/.python-lark.new.1835 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-lark"

Thu Dec 15 19:24:09 2022 rev:4 rq:1042889 version:1.1.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-lark/python-lark.changes  2022-12-04 
14:57:36.488012317 +0100
+++ /work/SRC/openSUSE:Factory/.python-lark.new.1835/python-lark.changes        
2022-12-15 19:24:11.591710834 +0100
@@ -1,0 +2,11 @@
+Tue Dec 13 15:41:34 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com>
+
+- Update to v1.1.5 
+  * What's Changed
+  setup.cfg: Replace deprecated license_file with license_files by @mgorny in 
#1209
+  Fix Github shenanigans by @erezsh in #1220
+  Fix AmbiguousExpander (Issue #1214) by @chanicpanic in #1216
+  Fix EOF line information in InteractiveParser.resume_parse() by @erezsh in 
#1224
+  Use generator instead of list expand or add method by @jmishra01 in #1225
+
+-------------------------------------------------------------------

Old:
----
  lark-1.1.4.tar.gz

New:
----
  lark-1.1.5.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-lark.spec ++++++
--- /var/tmp/diff_new_pack.p4MxeF/_old  2022-12-15 19:24:12.143713975 +0100
+++ /var/tmp/diff_new_pack.p4MxeF/_new  2022-12-15 19:24:12.147713998 +0100
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define skip_python2 1
 Name:           python-lark
-Version:        1.1.4
+Version:        1.1.5
 Release:        0
 Summary:        A parsing library for Python
 License:        MIT

++++++ lark-1.1.4.tar.gz -> lark-1.1.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lark-1.1.4/.github/workflows/tests.yml 
new/lark-1.1.5/.github/workflows/tests.yml
--- old/lark-1.1.4/.github/workflows/tests.yml  2022-11-02 02:45:31.000000000 
+0100
+++ new/lark-1.1.5/.github/workflows/tests.yml  2022-12-06 13:49:34.000000000 
+0100
@@ -3,7 +3,8 @@
 
 jobs:
   build:
-    runs-on: ubuntu-latest
+    # runs-on: ubuntu-latest
+    runs-on: ubuntu-20.04   # See 
https://github.com/actions/setup-python/issues/544
     strategy:
       matrix:
         python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", 
"pypy-3.7"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lark-1.1.4/docs/recipes.md 
new/lark-1.1.5/docs/recipes.md
--- old/lark-1.1.4/docs/recipes.md      2022-11-02 02:45:31.000000000 +0100
+++ new/lark-1.1.5/docs/recipes.md      2022-12-06 13:49:34.000000000 +0100
@@ -143,7 +143,7 @@
         for subtree in tree.children:
             if isinstance(subtree, Tree):
                 assert not hasattr(subtree, 'parent')
-                subtree.parent = tree
+                subtree.parent = proxy(tree)
 ```
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lark-1.1.4/examples/advanced/error_handling.py 
new/lark-1.1.5/examples/advanced/error_handling.py
--- old/lark-1.1.4/examples/advanced/error_handling.py  2022-11-02 
02:45:31.000000000 +0100
+++ new/lark-1.1.5/examples/advanced/error_handling.py  2022-12-06 
13:49:34.000000000 +0100
@@ -12,7 +12,7 @@
 
 from lark import Token
 
-from examples.advanced._json_parser import json_parser
+from _json_parser import json_parser
 
 def ignore_errors(e):
     if e.token.type == 'COMMA':
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lark-1.1.4/examples/advanced/extend_python.py 
new/lark-1.1.5/examples/advanced/extend_python.py
--- old/lark-1.1.4/examples/advanced/extend_python.py   2022-11-02 
02:45:31.000000000 +0100
+++ new/lark-1.1.5/examples/advanced/extend_python.py   1970-01-01 
01:00:00.000000000 +0100
@@ -1,46 +0,0 @@
-"""
-Extend the Python Grammar
-==============================
-
-This example demonstrates how to use the `%extend` statement,
-to add new syntax to the example Python grammar.
-
-"""
-
-from lark.lark import Lark
-from lark.indenter import PythonIndenter
-
-GRAMMAR = r"""
-%import python (compound_stmt, single_input, file_input, eval_input, test, 
suite, _NEWLINE, _INDENT, _DEDENT, COMMENT)
-
-%extend compound_stmt: match_stmt
-
-match_stmt: "match" test ":" cases
-cases: _NEWLINE _INDENT case+ _DEDENT
-
-case: "case" test ":" suite // test is not quite correct.
-
-%ignore /[\t \f]+/          // WS
-%ignore /\\[\t \f]*\r?\n/   // LINE_CONT
-%ignore COMMENT
-"""
-
-parser = Lark(GRAMMAR, parser='lalr', start=['single_input', 'file_input', 
'eval_input'], postlex=PythonIndenter())
-
-tree = parser.parse(r"""
-def name(n):
-    match n:
-        case 1:
-            print("one")
-        case 2:
-            print("two")
-        case _:
-            print("number is too big")
-
-""", start='file_input')
-
-# Remove the 'python3__' prefix that was added to the implicitly imported 
rules.
-for t in tree.iter_subtrees():
-    t.data = t.data.rsplit('__', 1)[-1]
-
-print(tree.pretty())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lark-1.1.4/examples/relative-imports/multiples.py 
new/lark-1.1.5/examples/relative-imports/multiples.py
--- old/lark-1.1.4/examples/relative-imports/multiples.py       2022-11-02 
02:45:31.000000000 +0100
+++ new/lark-1.1.5/examples/relative-imports/multiples.py       2022-12-06 
13:49:34.000000000 +0100
@@ -13,7 +13,7 @@
 
 from lark import Lark, UnexpectedInput
 
-parser = Lark.open('multiples.lark', parser='lalr')
+parser = Lark.open('multiples.lark', rel_to=__file__, parser='lalr')
 
 def is_in_grammar(data):
     try:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lark-1.1.4/lark/__init__.py 
new/lark-1.1.5/lark/__init__.py
--- old/lark-1.1.4/lark/__init__.py     2022-11-02 02:45:31.000000000 +0100
+++ new/lark-1.1.5/lark/__init__.py     2022-12-06 13:49:34.000000000 +0100
@@ -14,7 +14,7 @@
 from .utils import logger
 from .visitors import Discard, Transformer, Transformer_NonRecursive, Visitor, 
v_args
 
-__version__: str = "1.1.4"
+__version__: str = "1.1.5"
 
 __all__ = (
     "GrammarError",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lark-1.1.4/lark/parse_tree_builder.py 
new/lark-1.1.5/lark/parse_tree_builder.py
--- old/lark-1.1.4/lark/parse_tree_builder.py   2022-11-02 02:45:31.000000000 
+0100
+++ new/lark-1.1.5/lark/parse_tree_builder.py   2022-12-06 13:49:34.000000000 
+0100
@@ -8,7 +8,7 @@
 
 ###{standalone
 from functools import partial, wraps
-from itertools import repeat, product
+from itertools import product
 
 
 class ExpandSingleChild:
@@ -186,7 +186,7 @@
 class AmbiguousExpander:
     """Deal with the case where we're expanding children ('_rule') into a 
parent but the children
        are ambiguous. i.e. (parent->_ambig->_expand_this_rule). In this case, 
make the parent itself
-       ambiguous with as many copies as their are ambiguous children, and then 
copy the ambiguous children
+       ambiguous with as many copies as there are ambiguous children, and then 
copy the ambiguous children
        into the right parents in the right places, essentially shifting the 
ambiguity up the tree."""
     def __init__(self, to_expand, tree_class, node_builder):
         self.node_builder = node_builder
@@ -212,8 +212,8 @@
         if not ambiguous:
             return self.node_builder(children)
 
-        expand = [iter(child.children) if i in ambiguous else repeat(child) 
for i, child in enumerate(children)]
-        return self.tree_class('_ambig', [self.node_builder(list(f[0])) for f 
in product(zip(*expand))])
+        expand = [child.children if i in ambiguous else (child,) for i, child 
in enumerate(children)]
+        return self.tree_class('_ambig', [self.node_builder(list(f)) for f in 
product(*expand)])
 
 
 def maybe_create_ambiguous_expander(tree_class, expansion, keep_all_tokens):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lark-1.1.4/lark/parsers/lalr_interactive_parser.py 
new/lark-1.1.5/lark/parsers/lalr_interactive_parser.py
--- old/lark-1.1.4/lark/parsers/lalr_interactive_parser.py      2022-11-02 
02:45:31.000000000 +0100
+++ new/lark-1.1.5/lark/parsers/lalr_interactive_parser.py      2022-12-06 
13:49:34.000000000 +0100
@@ -114,8 +114,9 @@
         return accepts
 
     def resume_parse(self):
-        """Resume automated parsing from the current state."""
-        return self.parser.parse_from_state(self.parser_state)
+        """Resume automated parsing from the current state.
+        """
+        return self.parser.parse_from_state(self.parser_state, 
last_token=self.lexer_state.state.last_token)
 
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lark-1.1.4/lark/parsers/lalr_parser.py 
new/lark-1.1.5/lark/parsers/lalr_parser.py
--- old/lark-1.1.4/lark/parsers/lalr_parser.py  2022-11-02 02:45:31.000000000 
+0100
+++ new/lark-1.1.5/lark/parsers/lalr_parser.py  2022-12-06 13:49:34.000000000 
+0100
@@ -171,10 +171,15 @@
         return self.parse_from_state(parser_state)
 
 
-    def parse_from_state(self, state):
-        # Main LALR-parser loop
+    def parse_from_state(self, state, last_token=None):
+        """Run the main LALR parser loop
+
+        Parameters:
+            state (ParseState) - the initial state. Changed in-place.
+            last_token (optional, Token) - Used only for line information in 
case of an empty lexer.
+        """
         try:
-            token = None
+            token = last_token
             for token in state.lexer.lex(state):
                 state.feed_token(token)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lark-1.1.4/lark/tree.py new/lark-1.1.5/lark/tree.py
--- old/lark-1.1.4/lark/tree.py 2022-11-02 02:45:31.000000000 +0100
+++ new/lark-1.1.5/lark/tree.py 2022-12-06 13:49:34.000000000 +0100
@@ -68,17 +68,16 @@
         return self.data
 
     def _pretty(self, level, indent_str):
+        yield f'{indent_str*level}{self._pretty_label()}'
         if len(self.children) == 1 and not isinstance(self.children[0], Tree):
-            return [indent_str*level, self._pretty_label(), '\t', '%s' % 
(self.children[0],), '\n']
-
-        l = [indent_str*level, self._pretty_label(), '\n']
-        for n in self.children:
-            if isinstance(n, Tree):
-                l += n._pretty(level+1, indent_str)
-            else:
-                l += [indent_str*(level+1), '%s' % (n,), '\n']
-
-        return l
+            yield f'\t{self.children[0]}\n'
+        else:
+            yield '\n'
+            for n in self.children:
+                if isinstance(n, Tree):
+                    yield from n._pretty(level+1, indent_str)
+                else:
+                    yield f'{indent_str*(level+1)}{n}\n'
 
     def pretty(self, indent_str: str='  ') -> str:
         """Returns an indented string representation of the tree.
@@ -149,13 +148,15 @@
         Iterates over all the subtrees, return nodes in order like pretty() 
does.
         """
         stack = [self]
+        stack_append = stack.append
+        stack_pop = stack.pop
         while stack:
-            node = stack.pop()
+            node = stack_pop()
             if not isinstance(node, Tree):
                 continue
             yield node
             for child in reversed(node.children):
-                stack.append(child)
+                stack_append(child)
 
     def find_pred(self, pred: 'Callable[[Tree[_Leaf_T]], bool]') -> 
'Iterator[Tree[_Leaf_T]]':
         """Returns all nodes of the tree that evaluate pred(node) as true."""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lark-1.1.4/setup.cfg new/lark-1.1.5/setup.cfg
--- old/lark-1.1.4/setup.cfg    2022-11-02 02:45:31.000000000 +0100
+++ new/lark-1.1.5/setup.cfg    2022-12-06 13:49:34.000000000 +0100
@@ -1,3 +1,3 @@
 [metadata]
-license_file = LICENSE
+license_files = LICENSE
 python_requires = >=3.6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lark-1.1.4/tests/test_parser.py 
new/lark-1.1.5/tests/test_parser.py
--- old/lark-1.1.4/tests/test_parser.py 2022-11-02 02:45:31.000000000 +0100
+++ new/lark-1.1.5/tests/test_parser.py 2022-12-06 13:49:34.000000000 +0100
@@ -526,6 +526,27 @@
                 ])
             self.assertEqual(res, expected)
 
+        def test_ambiguous_inlined_rule(self):
+            grammar = """
+            start: _field+
+            _field: f1 | f2 | f3
+            f1: INT
+            f2: INT "M"?
+            f3: INT "M"
+            %import common.INT
+            """
+
+            l = Lark(grammar, parser='earley', ambiguity='explicit', 
lexer=LEXER)
+            ambig_tree = l.parse("1M2")
+            expected = {
+                Tree('start', [Tree('f2', ['1']), Tree('f1', ['2'])]),
+                Tree('start', [Tree('f2', ['1']), Tree('f2', ['2'])]),
+                Tree('start', [Tree('f3', ['1']), Tree('f1', ['2'])]),
+                Tree('start', [Tree('f3', ['1']), Tree('f2', ['2'])]),
+            }
+            self.assertEqual(ambig_tree.data, '_ambig')
+            self.assertEqual(set(ambig_tree.children), expected)
+
         def test_ambiguous_intermediate_node(self):
             grammar = """
             start: ab bc d?

Reply via email to