-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-135148: Correctly handle f/t strings with comments and debug expressions #135198
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
base: main
Are you sure you want to change the base?
Conversation
bd49471
to
5f8456e
Compare
Parser/lexer/lexer.c
Outdated
|
||
// Process each character of input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lysnikolaou please read this carefully. I am mostly sure its correct but it really needs some extra eyes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was thinking something very similar as a solution, too! I found one problem, but it looks good otherwise.
When you're done making the requested changes, leave the comment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good now! Thanks @pablogsal!
I left a couple of inline comments for some very minor improvements.
if (!in_string) { | ||
in_string = 1; | ||
quote_char = ch; | ||
} | ||
else if (ch == quote_char) { | ||
in_string = 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only works because there's always an odd number of quotes in a STRING
token and we're sure that all STRING
tokens will be valid at this point. Maybe add a comment to explain that?
char quote_char = 0; | ||
char string_quote = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need both of these?
Uh oh!
There was an error while loading. Please reload this page.