@@ -738,22 +738,23 @@ TOKEN:
738
738
// which contains the <SPECIAL_ESC>, then we will need to
739
739
// 1) break the <S_CHAR_LITERAL> at <SPECIAL_ESC> close it with a "'"
740
740
// 2) continue tokenizing after that <SPECIAL_ESC> with a new <S_CHAR_LITERAL> or any other Token
741
- if ( !configuration.getAsBoolean(Feature.allowBackslashEscapeCharacter) && matchedToken.image.contains("\\'") ) {
742
- matchedToken.image = image.substring( 0, image.indexOf("\\'") + 1 ) + "'";
741
+ if ( !configuration.getAsBoolean(Feature.allowBackslashEscapeCharacter)
742
+ && matchedToken.image.contains("\\'") ) {
743
+ matchedToken.image = "'" + image.substring( 0, image.indexOf("\\'") + 1 ) + "'";
743
744
for (int i=0;i<CCJSqlParserConstants.tokenImage.length;i++) {
744
745
if ( CCJSqlParserConstants.tokenImage[i].equals("<S_CHAR_LITERAL>") ) {
745
746
matchedToken.kind = i;
746
747
}
747
748
}
748
- input_stream.backup(image.length() - matchedToken.image.length() );
749
+ input_stream.backup(image.length() + 1 - matchedToken.image.length());
749
750
} else if ( configuration.getAsBoolean(Feature.allowBackslashEscapeCharacter) && matchedToken.image.contains("\\''") ) {
750
- matchedToken.image = image.substring( 0, image.lastIndexOf("\\'") + 3);
751
+ matchedToken.image = "'" + image.substring( 0, image.lastIndexOf("\\'") + 3);
751
752
for (int i=0;i<CCJSqlParserConstants.tokenImage.length;i++) {
752
753
if ( CCJSqlParserConstants.tokenImage[i].equals("<S_CHAR_LITERAL>") ) {
753
754
matchedToken.kind = i;
754
755
}
755
756
}
756
- input_stream.backup(image.length() - matchedToken.image.length() );
757
+ input_stream.backup(image.length() + 1 - matchedToken.image.length() );
757
758
}
758
759
}
759
760
| < S_QUOTED_IDENTIFIER: "\"" ( "\"\"" | ~["\n","\r","\""])* "\"" | "$$" (~["$"])* "$$" | ("`" (~["\n","\r","`"])+ "`") | ( "[" (~["\n","\r","]"])* "]" ) >
0 commit comments