-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add support for raw strings #12
Conversation
Hmm, looks like this causes tests to hang in CI. Weird since the tests pass for me locally... |
9b2892c
to
32e5ce2
Compare
OK, I can repro the infinite loop on mac with some other code, so there's definitely something wrong in this PR. This also makes me think there should be some additional checks to show we can parse some top N Swift repositories - I got lucky that the tests caught this on CI. In the meantime, I think this is probably not good enough for testing. Next step: find a minimal repro on mac and debug it. |
Had the issue once. Ran it again on the same file (without modification) and it did work. |
Maybe it's related but another issue I found was that the raw string ends at the end of line even if unterminated. |
😶🌫️ figured out the issue and it is... embarrassingly silly. Update incoming |
32e5ce2
to
90bc6e8
Compare
The syntax highlighting Xcode does is #"abc as String, \#( as Plain Text, value depending on the variables scope, ) as Plain Text and ."# as String. In order for us to do the same, we need to separate out the `\#(` from the prior `raw_str_part` (and the same with the closing parenthesis). This requires a slightly complicated dance between the grammar and the custom scanner, where the scanner validates the `\#(` but does not parse it, and the grammar parses it but does not validate it. In turn, the closing parenthesis gets consumed as a separate token by the grammar but must leave some remnant behind in the form of a synthetic external rule that just signals its position.
2c3d18a
to
c152d39
Compare
Uses a custom scanner and ongoing state to parse code like:
Fixes #7, #11