@@ -706,6 +706,40 @@ TOKEN_MGR_DECLS : {
706706 return ((SimpleCharStream)input_stream).getAbsoluteTokenBegin();
707707 return -1;
708708 }
709+
710+ private static boolean endsWithDelimiter(Deque<Character> windowQueue, String delimiter) {
711+ if (windowQueue.size() != delimiter.length()) {
712+ return false;
713+ }
714+
715+ int i = 0;
716+ for (char ch : windowQueue) {
717+ if (ch != delimiter.charAt(i++)) {
718+ return false;
719+ }
720+ }
721+ return true;
722+ }
723+
724+ public void consumeDollarQuotedString(String closingQuote) {
725+ Deque<Character> windowQueue = new ArrayDeque<Character>();
726+ int delimiterLength = closingQuote.length();
727+
728+ try {
729+ while (true) {
730+ char ch = input_stream.readChar();
731+ windowQueue.addLast(ch);
732+ if (windowQueue.size() > delimiterLength) {
733+ windowQueue.removeFirst();
734+ }
735+ if (endsWithDelimiter(windowQueue, closingQuote)) {
736+ return;
737+ }
738+ }
739+ } catch (java.io.IOException e) {
740+ reportError(Math.max(closingQuote.length(), input_stream.GetImage().length()));
741+ }
742+ }
709743}
710744
711745SKIP:
@@ -1338,10 +1372,18 @@ TOKEN:
13381372{
13391373<S_PARAMETER: ["$"] (["0"-"9"])+ >
13401374|
1341- <S_IDENTIFIER: <LETTER> (<PART_LETTER>)*>
1375+ <S_DOLLAR_QUOTED_STRING: "$$">
1376+ {
1377+ consumeDollarQuotedString(matchedToken.image);
1378+ matchedToken.image = input_stream.GetImage();
1379+ matchedToken.kind = charLiteralIndex;
1380+ }
1381+ |
1382+ <S_IDENTIFIER: (<LETTER> (<PART_LETTER>)*) | "$" | ("$" <PART_LETTER_NO_DOLLAR> (<PART_LETTER>)*)>
13421383| <#LETTER: <UnicodeIdentifierStart>
1343- | <Nd> | [ "$" , " #", "_" ] // Not SQL:2016 compliant!
1384+ | <Nd> | [ "#", "_" ] // Not SQL:2016 compliant!
13441385 >
1386+ | <#PART_LETTER_NO_DOLLAR: <UnicodeIdentifierStart> | <UnicodeIdentifierExtend> | [ "#", "_" , "@" ] >
13451387| <#PART_LETTER: <UnicodeIdentifierStart> | <UnicodeIdentifierExtend> | [ "$" , "#", "_" , "@" ] >
13461388| <S_AT_IDENTIFIER: <K_AT_SIGN> (<K_AT_SIGN>)? <S_IDENTIFIER> >
13471389
@@ -1375,7 +1417,7 @@ TOKEN:
13751417| < S_CHAR_LITERAL: (
13761418 (["U","E","N","R","B"]|"RB"|"_utf8")?
13771419 (
1378- ("'" ( <ESC> | <SPECIAL_ESC> | ~["'", "\\"] )* "'") | ("'" ("''" | ~["'"])* "'" | "$$" (~["$"])* "$$" )
1420+ ("'" ( <ESC> | <SPECIAL_ESC> | ~["'", "\\"] )* "'") | ("'" ("''" | ~["'"])* "'")
13791421 // Alternative Oracle Escape Modes
13801422 | ("q'{" (~[])* "}'")
13811423 | ("q'(" (~[])* ")'")
@@ -9041,22 +9083,14 @@ Execute Execute(): {
90419083
90429084FullTextSearch FullTextSearch() : {
90439085 Token searchModifier;
9044- Token againstValue;
9045- JdbcParameter jdbcParameter;
9046- JdbcNamedParameter jdbcNamedParameter;
9086+ Expression againstValue;
90479087 FullTextSearch fs = new FullTextSearch();
90489088 ExpressionList<Column> matchedColumns;
90499089}
90509090{
90519091 <K_MATCH> "(" matchedColumns=ColumnList() ")" <K_AGAINST>
90529092 "("
9053- (
9054- againstValue=<S_CHAR_LITERAL> { fs.setAgainstValue(new StringValue(againstValue.image)); }
9055- |
9056- jdbcParameter=JdbcParameter() { fs.setAgainstValue( jdbcParameter ); }
9057- |
9058- jdbcNamedParameter=JdbcNamedParameter() { fs.setAgainstValue( jdbcNamedParameter ); }
9059- )
9093+ againstValue=SimpleExpression() { fs.setAgainstValue(againstValue); }
90609094 [
90619095 (
90629096 searchModifier="IN NATURAL LANGUAGE MODE"
0 commit comments