Skip to content

Commit

Permalink
Support attribute statements under case statements (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrouhard authored Sep 18, 2021
1 parent 0aeed55 commit 9bee345
Show file tree
Hide file tree
Showing 5 changed files with 40,030 additions and 39,328 deletions.
7 changes: 7 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ module.exports = grammar({
[$._type_specifier, $.macro_type_specifier],
[$.sized_type_specifier],
[$._declaration_modifiers, $.attributed_statement],
[$._declaration_modifiers, $.attributed_non_case_statement],
],

word: $ => $.identifier,
Expand Down Expand Up @@ -596,6 +597,11 @@ module.exports = grammar({
$._statement
),

attributed_non_case_statement: $ => seq(
repeat1($.attribute_declaration),
$._non_case_statement
),

_statement: $ => choice(
$.case_statement,
$._non_case_statement
Expand Down Expand Up @@ -653,6 +659,7 @@ module.exports = grammar({
),
':',
repeat(choice(
alias($.attributed_non_case_statement, $.attributed_statement),
$._non_case_statement,
$.declaration,
$.type_definition
Expand Down
29 changes: 29 additions & 0 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3786,6 +3786,22 @@
}
]
},
"attributed_non_case_statement": {
"type": "SEQ",
"members": [
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "attribute_declaration"
}
},
{
"type": "SYMBOL",
"name": "_non_case_statement"
}
]
},
"_statement": {
"type": "CHOICE",
"members": [
Expand Down Expand Up @@ -4023,6 +4039,15 @@
"content": {
"type": "CHOICE",
"members": [
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "attributed_non_case_statement"
},
"named": true,
"value": "attributed_statement"
},
{
"type": "SYMBOL",
"name": "_non_case_statement"
Expand Down Expand Up @@ -6552,6 +6577,10 @@
[
"_declaration_modifiers",
"attributed_statement"
],
[
"_declaration_modifiers",
"attributed_non_case_statement"
]
],
"precedences": [],
Expand Down
4 changes: 4 additions & 0 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,10 @@
"multiple": true,
"required": false,
"types": [
{
"type": "attributed_statement",
"named": true
},
{
"type": "break_statement",
"named": true
Expand Down
Loading

0 comments on commit 9bee345

Please sign in to comment.