-
Notifications
You must be signed in to change notification settings - Fork 4
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
RD-11232 sql compiler crash parser computes a wrong line col #465
RD-11232 sql compiler crash parser computes a wrong line col #465
Conversation
alexzerntev
commented
Jul 5, 2024
- Fixed by striping trail and removing the extra new line
@@ -26,7 +26,8 @@ class RawSqlSyntaxAnalyzer(val positions: Positions) extends Parsers(positions) | |||
val source = StringSource(s) | |||
val rawErrorListener = new RawSqlErrorListener() | |||
|
|||
val lexer = new PsqlLexer(CharStreams.fromString(s)) | |||
val striped = s.stripTrailing().stripSuffix("\r\n").stripSuffix("\n").stripSuffix("\r") |
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.
There's no risk there's another token later and we start to shift offsets?
Ah it's the whole code that gets stripped?
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.
I think stripSuffix's are unnecessary after the stripTrailing.
Its minor, just check and remove them
@@ -26,7 +26,8 @@ class RawSqlSyntaxAnalyzer(val positions: Positions) extends Parsers(positions) | |||
val source = StringSource(s) | |||
val rawErrorListener = new RawSqlErrorListener() | |||
|
|||
val lexer = new PsqlLexer(CharStreams.fromString(s)) | |||
val striped = s.stripTrailing().stripSuffix("\r\n").stripSuffix("\n").stripSuffix("\r") |
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.
The stripTrainling should remove all white space, no?
Why does it need the stripSuffix's after?