Skip to content

Commit

Permalink
Add syntax sugar for struct fields (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment authored May 9, 2024
1 parent aeb1fb1 commit 897fecb
Show file tree
Hide file tree
Showing 6 changed files with 529 additions and 426 deletions.
7 changes: 5 additions & 2 deletions src/antlr4/Navi.g4
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,14 @@ args: (expression (',' expression)* ','?)?;
fields: '{' (field (',' field)* ','?)? '}';
fieldsSpread:
'{' (
spread (',' spread)* (',' (field (',' field)* ','?)?)?
| (field (',' field)* ','?)?
spread (',' spread)* (
',' (fieldMaybeAssert (',' fieldMaybeAssert)* ','?)?
)?
| (fieldMaybeAssert (',' fieldMaybeAssert)* ','?)?
) '}';
spread: OpSpread expression;
field: Identifier assert;
fieldMaybeAssert: Identifier assert?;
parameters: '(' (parameter (',' parameter)* ','?)? ')';
varArgParameters:
'(' (
Expand Down
9 changes: 9 additions & 0 deletions src/antlr4/NaviListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,15 @@ export default class NaviListener extends antlr4.tree.ParseTreeListener {
}


// Enter a parse tree produced by NaviParser#fieldMaybeAssert.
enterFieldMaybeAssert(ctx) {
}

// Exit a parse tree produced by NaviParser#fieldMaybeAssert.
exitFieldMaybeAssert(ctx) {
}


// Enter a parse tree produced by NaviParser#parameters.
enterParameters(ctx) {
}
Expand Down
Loading

0 comments on commit 897fecb

Please sign in to comment.