-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow identifiers in string concatentations #145
Conversation
cherry-picked from neovim#2 @lewis6991 @amaanq |
@ahlinc would like your thoughts too |
Resolves errors in strings of the form: ("failed in line %" PRIdLINENR)
I'd also alias the It make sense to add a bellow additional fix on top of this PR: diff --git i/grammar.js w/grammar.js
index 94e7f3d..b51cacd 100644
--- i/grammar.js
+++ w/grammar.js
@@ -1055,13 +1055,16 @@ module.exports = grammar({
concatenated_string: $ => seq(
$.string_literal,
- repeat1(choice($.string_literal, $.identifier)),
+ repeat1(choice(
+ $.string_literal,
+ alias($.identifier, $.string),
+ )),
),
string_literal: $ => seq(
choice('L"', 'u"', 'U"', 'u8"', '"'),
repeat(choice(
- token.immediate(prec(1, /[^\\"\n]+/)),
+ alias(token.immediate(prec(1, /[^\\"\n]+/)), $.string),
$.escape_sequence,
)),
'"', |
Maybe |
Also gotta get rid of the appveyor thing after this @clason tests need updates |
Used |
Mentioned this earlier here, but the formatting of the header/test delimiters needs to not happen, it pollutes the diff (not your problem, it looks fine to me 😅) |
Would it be acceptable for me to do a separate commit before the change to reformat the corpus? I think the convenience of using |
hmm not sure what you mean, like a commit of additional tests? |
like a commit just calling |
Oooh, yeah I'm way too tired my bad for not getting that - that would be nicer for the future |
@amaanq in concatenations identifiers aren't identifiers because they are concatenated literally and not by value. |
well it's like an identifier that holds a string, so it shouldn't be aliased as such so users can distinguish them imo |
sorry, my bad, For C the |
Agreed.. |
Resolves errors in strings of the form:
("failed in line %" PRIdLINENR)