[#5955] Supported additional quote sequences

This commit is contained in:
lukaseder 2017-08-04 10:19:05 +02:00
parent b5f07a6d43
commit 3a3cd95d47
2 changed files with 11 additions and 8 deletions

View File

@ -486,6 +486,7 @@ term =
| 'FIRST_VALUE' '(' field ')' over
| 'GREATEST' '(' fields ')'
| 'GROUP_CONCAT' '(' [ 'DISTINCT' ] field [ 'ORDER BY' sortFields ] [ 'SEPARATOR' stringLiteral ] ')'
| 'GROUP_ID' '(' ')'
| 'GROUPING_ID' '(' fields ')'
| 'GROUPING' '(' fields ')'
| 'HOUR' '(' field ')'
@ -705,11 +706,11 @@ name = identifier { '.' identifier }
stringLiteral =
(
"'" character* "'"
| "q'!" characters* "!'"
| "q'[" characters* "]'"
| "q'{" characters* "}'"
| "q'(" characters* ")'"
| "q'<" characters* ">'"
| "q'" nonSpaceCharacter characters* nonSpaceCharacter "'"
)
;

View File

@ -5171,13 +5171,15 @@ class ParserImpl implements Parser {
char end;
switch (start) {
case '!': end = '!'; ctx.position = ctx.position + 1; break;
case '[': end = ']'; ctx.position = ctx.position + 1; break;
case '{': end = '}'; ctx.position = ctx.position + 1; break;
case '(': end = ')'; ctx.position = ctx.position + 1; break;
case '<': end = '>'; ctx.position = ctx.position + 1; break;
default:
throw ctx.exception("Illegal quote string character");
case '[' : end = ']'; ctx.position = ctx.position + 1; break;
case '{' : end = '}'; ctx.position = ctx.position + 1; break;
case '(' : end = ')'; ctx.position = ctx.position + 1; break;
case '<' : end = '>'; ctx.position = ctx.position + 1; break;
case ' ' :
case '\t':
case '\r':
case '\n': throw ctx.exception("Illegal quote string character");
default : end = start; ctx.position = ctx.position + 1; break;
}
StringBuilder sb = new StringBuilder();