Error while parsing literals with backslash
See original GitHub issueDescribe the bug Can’t properly parse the statement when
- Backslash is the last character of a literal;
- The literal is not the last value of a sequence.
To Reproduce Steps to reproduce the behavior:
- Example:
CCJSqlParserUtil.parseStatements("""INSERT INTO "a"."b"("c", "d", "e") VALUES ('c c\', 'dd', 'ee\')""")
(Kotlin) - Exception:
net.sf.jsqlparser.JSQLParserException: Encountered unexpected token: "dd" <S_IDENTIFIER>
at line 1, column 53.
Was expecting one of:
"&"
")"
","
"::"
"<<"
">>"
"COLLATE"
"["
"^"
"|"
- Note that
CCJSqlParserUtil.parseStatements("""INSERT INTO "a"."b"("c", "d", "e") VALUES ('c c', 'dd', 'ee\')""")
won’t trigger the exception.
Expected behavior
The literals 'c c\'
and 'dd'
should be properly parsed.
System
- Database: Oracle
- Kotlin Version: 1.4.21-release-IJ2020.2-1
- Java Version: 1.8
- JSqlParser version: 4.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:35 (20 by maintainers)
Top Results From Across the Web
Why can't Python's raw string literals end with a single ...
So any character following a backslash is part of raw string. Once parser enters a raw string (non Unicode one) and encounters a...
Read more >Strings - Manual - PHP
All other instances of backslash will be treated as a literal backslash: this ... PHP Parse error: Invalid indentation - tabs and spaces...
Read more >Simple question - end a raw string with a single backslash ?
I am trying to write a simple expression to build a raw string that ends in a single backslash. My understanding is that...
Read more >Python Raw String - DigitalOcean
When a backslash is followed by a quote in a raw string, it's escaped. However, the backslash also remains in the result. Because...
Read more >Raw string parsing fails with backslash as last character
http://docs.python.org/dev/reference/lexical_analysis.html#string-literals r"\" is not a valid string literal (even a raw string cannot end in ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, this was exactly what I have suggested to the @wumpz. As kind of Pre-Processing and Post-Processing outside of the Parser itself.
On Mon, 2021-05-24 at 21:06 -0700, Xingcan Cui wrote:
Andreas, you really need to stop this kind of thing. It’s really not a good thing, not a good behavior pattern.
Look, you’re now insinuating something about me that has no basis in reality. For the record, I never said anything about you or any other user being “qualified”. And I never would say such a thing because that does not even correspond to my whole way of thinking. You must be projecting your own inferiority complex.
Regardless, this kind of thing has a sleazy sort of feel to it, kind of makes my skin crawl.
I didn’t really want to get into this conversation even. Truth told, I basically wrote off this community long ago. I only entered the conversation because you were making some very bizarre misstatements. For me, the real tipping point in this was when you casually said you had “doubts about JavaCC21’s ‘maturity’”
Well, as I recall, you said that you had read the full history of this that I wrote. So, surely you understand that JavaCC21 (previously FreeCC when it was initially forked back 2008) is a more advanced version of the tool that these people already happen to be using! And it’s the result of systematically fixing every well-known, longstanding bug in the abandoned legacy tool.
To be clear, generally speaking it is not invalid to question the “maturity” of JavaCC21 (or whatever thing.) BUT… when we’re in a context in which the only real point of comparison is a far more backward of the very same tool… that’s just… And finally, it’s very hard to interpret this generously. Anybody can look at the issues page on JavaCC21 and see that I was very responsive and helpful to you. After that, I don’t think you should be here (or anywhere else!) spreading this kind of sleazy FUD. I can’t turn a blind eye to this.
Back in my earlier run at open source, the FreeMarker days, I put my trust in some very low-quality, treacherous people, mostly I’m thinking of Daniel Dekany, a real back-stabber. I try to learn from the past and any sign that somebody is a treacherous backstabber, I intend to extirpate the problem very quickly this time round. So I just banned you from my world. But never mind. It’s not really personal.
(Actually, the above is formulaic. It is personal.)