nebius/SWE-bench-extra huggingface dataset:
Repository: neogeny/TatSu

Issue:
Void doesn't end recursion
```python
    def test_nullable_void(self):
        left_grammar = '''
            @@left_recursion :: True
            @@nameguard :: False

            start = A $ ;
            A = | A 'a' | () ;
        '''

        assert [['a', 'a'], 'a'] == parse(left_grammar, 'aaa')  # warning: infinite recursion
```



Comments:

Patch:
diff --git a/tatsu/contexts.py b/tatsu/contexts.py
index 29024cb..8baf4df 100644
--- a/tatsu/contexts.py
+++ b/tatsu/contexts.py
@@ -557,7 +557,7 @@ class ParseContext(object):
             self._results[key] = result
 
             initial = self._pos
-            lastpos = initial
+            lastpos = initial - 1
             while True:
                 try:
                     self._clear_recursion_errors()


Test patch:
diff --git a/test/grammar/left_recursion_test.py b/test/grammar/left_recursion_test.py
index 6a64e5c..6c46c0c 100644
--- a/test/grammar/left_recursion_test.py
+++ b/test/grammar/left_recursion_test.py
@@ -535,7 +535,6 @@ class LeftRecursionTests(unittest.TestCase):
 
         assert ['a', ['a', 'a']] == parse(right_grammar, 'aaa')
 
-    @unittest.skip('bug in calculation of nullable')
     def test_nullable_void(self):
         left_grammar = '''
             @@left_recursion :: True