Extra marks, fields, whatnot

This commit is contained in:
John Doty 2024-09-05 06:31:42 -07:00
parent be8e017fd9
commit 5e12af9f31

View file

@ -52,8 +52,8 @@ class FineGrammar(Grammar):
def class_declaration(self) -> Rule: def class_declaration(self) -> Rule:
return seq( return seq(
self.CLASS, self.CLASS,
mark(self.IDENTIFIER, highlight=highlight.entity.name.type), mark(self.IDENTIFIER, field="name", highlight=highlight.entity.name.type),
self._class_body, mark(self._class_body, field="body"),
) )
@rule @rule
@ -107,10 +107,10 @@ class FineGrammar(Grammar):
def function_declaration(self) -> Rule: def function_declaration(self) -> Rule:
return seq( return seq(
self.FUN, self.FUN,
mark(self.IDENTIFIER, highlight=highlight.entity.name.function), mark(self.IDENTIFIER, field="name", highlight=highlight.entity.name.function),
self.function_parameters, mark(self.function_parameters, field="parameters"),
opt(self.ARROW, self.type_expression), mark(opt(self.ARROW, self.type_expression), field="return_type"),
self.block, mark(self.block, field="body"),
) )
@rule("ParamList") @rule("ParamList")