Skip to content

Commit

Permalink
[grammar] make keywords always have type str
Browse files Browse the repository at this point in the history
fixes #335
  • Loading branch information
apalala committed Mar 18, 2024
1 parent f6f6ec0 commit 9b5b142
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion grammar/tatsu.ebnf
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ keywords
keyword
=
'@@keyword' ~ '::' ~ {@+:literal !(':'|'=')}
'@@keyword' ~ '::' ~ {@+:(word|string) !(':'|'=')}
;
Expand Down
11 changes: 10 additions & 1 deletion tatsu/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,16 @@ def _keyword_(self):
self._cut()

def block0():
self._literal_()
with self._group():
with self._choice():
with self._option():
self._word_()
with self._option():
self._string_()
self._error(
'expecting one of: '
'<string> <word>'
)
self.add_last_node_to_name('@')
with self._ifnot():
with self._group():
Expand Down

0 comments on commit 9b5b142

Please sign in to comment.