Skip to content

Commit

Permalink
fix: allow string concatenations to start with an identifier
Browse files Browse the repository at this point in the history
We do ensure at least one string is present though, otherwise conflicts arise
  • Loading branch information
amaanq committed Aug 9, 2023
1 parent bfda5b9 commit d0c0b89
Show file tree
Hide file tree
Showing 3 changed files with 62,709 additions and 62,398 deletions.
3 changes: 2 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1116,8 +1116,9 @@ module.exports = grammar({
),

concatenated_string: $ => seq(
choice($.identifier, $.string_literal),
$.string_literal,
repeat1(choice($.string_literal, $.identifier)), // Identifier is added to parse macros that are strings, like PRIu64
repeat(choice($.string_literal, $.identifier)), // Identifier is added to parse macros that are strings, like PRIu64
),

string_literal: $ => seq(
Expand Down
15 changes: 14 additions & 1 deletion src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -7431,12 +7431,25 @@
"concatenated_string": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "string_literal"
}
]
},
{
"type": "SYMBOL",
"name": "string_literal"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "CHOICE",
"members": [
Expand Down
Loading

0 comments on commit d0c0b89

Please sign in to comment.