Skip to content

Commit

Permalink
Merge pull request #130 from cfroystad/attribute_group
Browse files Browse the repository at this point in the history
Adds attribute_group node to complete attributes support
  • Loading branch information
aryx authored May 27, 2022
2 parents 6be89d5 + f53b758 commit c8955e9
Show file tree
Hide file tree
Showing 5 changed files with 52,546 additions and 51,706 deletions.
7 changes: 5 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1163,11 +1163,14 @@ module.exports = grammar({
seq('[', commaSep($.array_element_initializer), optional(','), ']')
),

attribute_list: $ => repeat1(seq(
attribute_group: $ => seq(
'#[',
commaSep1($.attribute),
optional(','),
']',
)),
),

attribute_list: $ => repeat1($.attribute_group),

attribute: $ => seq(
choice($.name, alias($._reserved_identifier, $.name), $.qualified_name),
Expand Down
88 changes: 52 additions & 36 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -6499,45 +6499,61 @@
}
]
},
"attribute_group": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "#["
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "attribute"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "SYMBOL",
"name": "attribute"
}
]
}
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "]"
}
]
},
"attribute_list": {
"type": "REPEAT1",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "#["
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "attribute"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "SYMBOL",
"name": "attribute"
}
]
}
}
]
},
{
"type": "STRING",
"value": "]"
}
]
"type": "SYMBOL",
"name": "attribute_group"
}
},
"attribute": {
Expand Down
25 changes: 20 additions & 5 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@
}
},
{
"type": "attribute_list",
"type": "attribute_group",
"named": true,
"fields": {},
"children": {
Expand All @@ -697,6 +697,21 @@
]
}
},
{
"type": "attribute_list",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "attribute_group",
"named": true
}
]
}
},
{
"type": "augmented_assignment_expression",
"named": true,
Expand Down Expand Up @@ -5044,11 +5059,11 @@
},
{
"type": "float",
"named": false
"named": true
},
{
"type": "float",
"named": true
"named": false
},
{
"type": "fn",
Expand Down Expand Up @@ -5144,11 +5159,11 @@
},
{
"type": "null",
"named": false
"named": true
},
{
"type": "null",
"named": true
"named": false
},
{
"type": "or",
Expand Down
Loading

0 comments on commit c8955e9

Please sign in to comment.