langium-lox
langium-lox copied to clipboard
make some parts of the grammar easier to read and more DRY, format with the default Langium formatter
I felt like the formatting of the grammar was a little difficult to read, namely the function/method calls, so I formatted them and took out the arguments lists into a shared fragment. I also formatted the rest of the file using Langium's default grammar formatter.
The new formatting is also closer to how JavaScript/TypeScript people format code.
Sidenote, the formatter wants to un-indent the comment, which was out of my controls:
({infer MemberCall.previous=current}
"." element=[NamedElement:ID] ( FunctionCallArguments )?
// Chained function call
| ( FunctionCallArguments )
)*;
The formatter would need a tweak so that it will instead do this:
({infer MemberCall.previous=current}
"." element=[NamedElement:ID] ( FunctionCallArguments )?
// Chained function call
| ( FunctionCallArguments )
)*;