Skip to content

Commit

Permalink
fix: correctly recognize multiple inheritance for @class
Browse files Browse the repository at this point in the history
Problem: Inheritance from multiple parent types are not correctly
recognized, only the first parent class was parsed as identifier.

Solution: Use commaSep to recognize multiple parent types.
  • Loading branch information
wookayin authored and amaanq committed Jan 22, 2024
1 parent 990926b commit 451cc56
Show file tree
Hide file tree
Showing 5 changed files with 5,453 additions and 5,302 deletions.
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = grammar({
class_annotation: $ => seq(
'@class',
$.type,
optional(seq(':', $.type)),
optional(seq(':', commaSep1($.type))),
optional(choice($.class_at_comment, $.comment)),
),

Expand Down
25 changes: 23 additions & 2 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,29 @@
"value": ":"
},
{
"type": "SYMBOL",
"name": "type"
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "type"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "SYMBOL",
"name": "type"
}
]
}
}
]
}
]
},
Expand Down
Loading

0 comments on commit 451cc56

Please # to comment.