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
{{ message }}
Repository navigation
Bad Token's line and column when code line is broken with backslash #14
we could expect that calling token.getLine() for Token representing number "2" would return line 8, but surprisingly the entire define definition is regarded as one-line preprocessor directive, so the result is 6.
mm, this is presumably due to a weirdness in the cpp spec where backslash-newline is elided and reinserted after the line. We use JoinReader to elide the \ sequences. In order to fix this, it's likely that we will have to merge JoinReader into LexerSource.
Hrrrrnnnng. OK, I accept this as a good bug, but I'll have to think about how to fix it!
You're quite right. I need to merge JoinReader into LexerSource, but how one knows whether to unget a \ is a little beyond me at this time in the morning. Suggestions taken, else I'll get there soon enough. :-) I appreciate the test cases.
Activity
shevek commentedon Feb 2, 2014
mm, this is presumably due to a weirdness in the cpp spec where backslash-newline is elided and reinserted after the line. We use JoinReader to elide the \ sequences. In order to fix this, it's likely that we will have to merge JoinReader into LexerSource.
Hrrrrnnnng. OK, I accept this as a good bug, but I'll have to think about how to fix it!
grzegorz8 commentedon Mar 2, 2014
What's more, if we have a string broken by backslashes into multi-line token, the location of the following tokens is wrong. Example:
The expected semicolon's location is (6, 8) but actual is (4, 31).
shevek commentedon Mar 3, 2014
You're quite right. I need to merge JoinReader into LexerSource, but how one knows whether to unget a \ is a little beyond me at this time in the morning. Suggestions taken, else I'll get there soon enough. :-) I appreciate the test cases.