Skip to content

Commit

Permalink
Fix empty switch default
Browse files Browse the repository at this point in the history
  • Loading branch information
Beaglefoot committed Nov 5, 2023
1 parent 6fdea72 commit 0965151
Show file tree
Hide file tree
Showing 4 changed files with 15,996 additions and 15,955 deletions.
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ module.exports = grammar({
)
),

switch_default: $ => seq('default', ':', repeat($.comment), $._statement),
switch_default: $ => prec.right(seq('default', ':', repeat($.comment), optional($._statement))),

_io_statement: $ =>
choice(
Expand Down
54 changes: 33 additions & 21 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -895,28 +895,40 @@
}
},
"switch_default": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "default"
},
{
"type": "STRING",
"value": ":"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "comment"
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "default"
},
{
"type": "STRING",
"value": ":"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "comment"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_statement"
},
{
"type": "BLANK"
}
]
}
},
{
"type": "SYMBOL",
"name": "_statement"
}
]
]
}
},
"_io_statement": {
"type": "CHOICE",
Expand Down
Loading

0 comments on commit 0965151

Please sign in to comment.