Skip to content

Commit

Permalink
Fix end line comment not being included in node text (#144)
Browse files Browse the repository at this point in the history
* Fix ending line comment not being included in node text

* npm run build

* Rework solution, add more tests

* npm run build

* Lift out $.line_comment from $._single_type_expression

* npm run build
  • Loading branch information
Qluxzz authored Dec 18, 2023
1 parent ac2b629 commit 44ffae4
Show file tree
Hide file tree
Showing 5 changed files with 17,165 additions and 16,574 deletions.
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ module.exports = grammar({
prec.left(
seq(
field("name", $.upper_case_identifier),
repeat($._single_type_expression)
repeat(choice($.line_comment, $._single_type_expression))
)
),

Expand Down
13 changes: 11 additions & 2 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -744,8 +744,17 @@
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_single_type_expression"
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "line_comment"
},
{
"type": "SYMBOL",
"name": "_single_type_expression"
}
]
}
}
]
Expand Down
10 changes: 10 additions & 0 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -2602,6 +2602,16 @@
}
]
}
},
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "line_comment",
"named": true
}
]
}
},
{
Expand Down
Loading

0 comments on commit 44ffae4

Please sign in to comment.