You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed your comment Allow \("""...""") to appear inside a block string
I assume this won't apply for raw strings? #"""\#(#"""..."""#)"""#
because the starting and ending delimiters are different?
I assume this won't apply for raw strings? #"""\#(#"""..."""#)"""# because the starting and ending delimiters are different?
I'm not quite sure I understand which scenario you are asking about, but I believe all the nesting options are valid. In your example, some of the " are part of the string since it's not actually a multi-line string.
I think the point of the comment/rule you pointed out is: usually [something]""" is not allowed for multi-line strings (the closing delimiter should be on its own line) however, actually \###(""" is okay since that starts a string interpolation.
Honestly, I'm not sure if keeping the invalid.illegal rules is really worth it 🤷 It was a convention I inherited from other TextMate grammars, but generally highlighting valid code seems much more important than highlighting invalid code.
Refactored it again
supports infinite hash raw strings
added more tests
added a Markdown test example
made single-line strings end at eol $ and mark the last char as invalid invalid.illegal.returns-not-allowed.swift
I'm pretty happy with it now
only issue I know is that if theres an invalid escape (thats too big)
the grammar will then 'forget' how many hashes # it was tracking and just assume the next escape is correct
so it thinks \#n is a valid escape here (because \###a is a too big invalid escape)
##"""\###a\#n"""##
could add a hardcoded #""" ... """# rule so that single # raw strings always work 100% of the time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #3
#, grammar limitations prevent us from supporting escapes) #3only a few hundred files with more than one #
https://github.com/search?q=lang%3Aswift+%2F%23%23%2B%22%22%22%2F&type=code