提交 212e02a0 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Split Parser.getSpecialType() into two methods for different arguments

上级 7bb789ff
......@@ -3915,14 +3915,17 @@ public class Parser {
case CHAR_SPECIAL_2:
if (types[i] == CHAR_SPECIAL_2) {
i++;
}
currentToken = sqlCommand.substring(start, i);
currentTokenType = getSpecialType(currentToken);
currentTokenType = getSpecialType2(currentToken);
} else {
currentToken = sqlCommand.substring(start, i);
currentTokenType = getSpecialType1(currentToken);
}
parseIndex = i;
return;
case CHAR_SPECIAL_1:
currentToken = sqlCommand.substring(start, i);
currentTokenType = getSpecialType(currentToken);
currentTokenType = getSpecialType1(currentToken);
parseIndex = i;
return;
case CHAR_VALUE:
......@@ -4352,10 +4355,8 @@ public class Parser {
}
}
private int getSpecialType(String s) {
char c0 = s.charAt(0);
if (s.length() == 1) {
switch (c0) {
private int getSpecialType1(String s) {
switch (s.charAt(0)) {
case '?':
case '$':
return PARAMETER;
......@@ -4390,11 +4391,13 @@ public class Parser {
case '=':
return EQUAL;
default:
break;
throw getSyntaxError();
}
}
} else if (s.length() == 2) {
private int getSpecialType2(String s) {
char c1 = s.charAt(1);
switch (c0) {
switch (s.charAt(0)) {
case ':':
if (c1 == ':' || c1 == '=') {
return KEYWORD;
......@@ -4430,7 +4433,6 @@ public class Parser {
}
break;
}
}
throw getSyntaxError();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论