-
-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
Summary
The generated ModelBuilderSemantics class raises a tatsu.exceptions.SemanticError: Could not call constructor for Sequence: 'closure' object is not callable
Context
Some cases work:
tatsu.compile(grammar).parse("(test)")
BugParser().parse("(test)")
But BugParser().parse("(test)", semantics=BugModelBuilderSemantics())
fails
The grammar
# bug.peg
@@grammar :: Bug
start = sequence $ ;
sequence::Sequence = children:{term [',']}+ ;
term = parens | word ;
parens = '(' ~ @:sequence ')' ;
word::Word = val:/\w+/ ;
Reproduction
Reproduction
-
Generate the parser and model:
python -m tatsu bug.peg -o bug_parser.py -G bug_model.py
-
Run
parser = BugParser()
semantics = BugModelBuilderSemantics()
parser.parse("(test)", semantics=semantics)
GitHub repo with full code
Full reproduction code is available:
https://github.com/EGrunzke/tatsu-sematic-error-closure-not-callable
Metadata
Metadata
Assignees
Labels
No labels