Skip to content

Commit

Permalink
Fix comments in ternary exp
Browse files Browse the repository at this point in the history
  • Loading branch information
Beaglefoot committed Jan 27, 2024
1 parent 0396748 commit 61b0da1
Show file tree
Hide file tree
Showing 5 changed files with 59,897 additions and 52,345 deletions.
2 changes: 2 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,10 @@ module.exports = grammar({
seq(
field('condition', $._exp),
'?',
optional($.comment),
field('consequence', $._exp),
':',
optional($.comment),
field('alternative', $._exp)
)
),
Expand Down
24 changes: 24 additions & 0 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,18 @@
"type": "STRING",
"value": "?"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "comment"
},
{
"type": "BLANK"
}
]
},
{
"type": "FIELD",
"name": "consequence",
Expand All @@ -1403,6 +1415,18 @@
"type": "STRING",
"value": ":"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "comment"
},
{
"type": "BLANK"
}
]
},
{
"type": "FIELD",
"name": "alternative",
Expand Down
10 changes: 10 additions & 0 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -4561,6 +4561,16 @@
}
]
}
},
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "comment",
"named": true
}
]
}
},
{
Expand Down
Loading

0 comments on commit 61b0da1

Please sign in to comment.