Mess with wrapping and whatnot
This commit is contained in:
parent
f3a4c4348a
commit
71b59302fa
1 changed files with 16 additions and 5 deletions
21
grammar.py
21
grammar.py
|
|
@ -25,6 +25,8 @@ class FineGrammar(Grammar):
|
||||||
|
|
||||||
trivia = ["BLANKS", "COMMENT"]
|
trivia = ["BLANKS", "COMMENT"]
|
||||||
|
|
||||||
|
pretty_indent = " "
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
precedence=[
|
precedence=[
|
||||||
|
|
@ -135,13 +137,22 @@ class FineGrammar(Grammar):
|
||||||
def function_declaration(self) -> Rule:
|
def function_declaration(self) -> Rule:
|
||||||
return seq(
|
return seq(
|
||||||
group(
|
group(
|
||||||
self.FUN,
|
|
||||||
sp,
|
|
||||||
mark(self.IDENTIFIER, field="name", highlight=highlight.entity.name.function),
|
|
||||||
sp,
|
|
||||||
group(
|
group(
|
||||||
|
group(
|
||||||
|
self.FUN,
|
||||||
|
sp,
|
||||||
|
mark(
|
||||||
|
self.IDENTIFIER,
|
||||||
|
field="name",
|
||||||
|
highlight=highlight.entity.name.function,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
nl,
|
||||||
mark(self.function_parameters, field="parameters"),
|
mark(self.function_parameters, field="parameters"),
|
||||||
mark(opt(sp, group(self.ARROW, sp, self.type_expression)), field="return_type"),
|
),
|
||||||
|
mark(
|
||||||
|
opt(indent(sp, group(self.ARROW, sp, self.type_expression))),
|
||||||
|
field="return_type",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
sp,
|
sp,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue