Allow nonterminals to be renamed

This commit is contained in:
John Doty 2024-05-30 19:15:20 -07:00
parent 4b8fef9ad6
commit 561dcd87ff
3 changed files with 43 additions and 11 deletions

View file

@ -76,7 +76,7 @@ class FineGrammar(Grammar):
]
)
@rule
@rule("File")
def file(self) -> Rule:
return self._file_statement_list
@ -94,7 +94,7 @@ class FineGrammar(Grammar):
def import_statement(self) -> Rule:
return seq(IMPORT, STRING, AS, IDENTIFIER, SEMICOLON)
@rule
@rule("ClassDeclaration")
def class_declaration(self) -> Rule:
return seq(CLASS, IDENTIFIER, self.class_body)