-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
Gram file
start: stmts
stmts: stmt*
stmt: block
block: "{" stmts "}"
Input
{ {} }
Result
File "<unknown>", line 1
{ {} }
^
SyntaxError: input.txt
The problem in the generated parse rule for the block stmt
Code
@memoize
def block(self) -> Optional[Any]:
# block: "{" stmts "}"
mark = self._mark()
if (
(literal := self.expect("{"))
and
(stmts := self.stmts())
and
(literal_1 := self.expect("}"))
):
return [literal, stmts, literal_1];
self._reset(mark)
return None;
(stmts := self.stmts()) shoud be (stmts := self.stmts()) is not None because an empty array is interpreted as false.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels