Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
e1bbb559
提交
e1bbb559
authored
6 年前
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Inline Parser.getKeywordOrIdentifier()
上级
0cc472a5
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
50 行增加
和
22 行删除
+50
-22
ParserUtil.java
h2/src/main/org/h2/util/ParserUtil.java
+50
-22
没有找到文件。
h2/src/main/org/h2/util/ParserUtil.java
浏览文件 @
e1bbb559
...
...
@@ -279,7 +279,10 @@ public class ParserUtil {
*/
switch
(
s
.
charAt
(
0
))
{
case
'A'
:
return
getKeywordOrIdentifier
(
s
,
"ALL"
,
ALL
);
if
(
"ALL"
.
equals
(
s
))
{
return
ALL
;
}
return
IDENTIFIER
;
case
'C'
:
if
(
"CHECK"
.
equals
(
s
))
{
return
CHECK
;
...
...
@@ -295,12 +298,17 @@ public class ParserUtil {
}
return
IDENTIFIER
;
case
'D'
:
return
getKeywordOrIdentifier
(
s
,
"DISTINCT"
,
DISTINCT
);
if
(
"DISTINCT"
.
equals
(
s
))
{
return
DISTINCT
;
}
return
IDENTIFIER
;
case
'E'
:
if
(
"EXCEPT"
.
equals
(
s
))
{
return
EXCEPT
;
}
else
if
(
"EXISTS"
.
equals
(
s
))
{
return
EXISTS
;
}
return
getKeywordOrIdentifier
(
s
,
"EXISTS"
,
EXISTS
)
;
return
IDENTIFIER
;
case
'F'
:
if
(
"FETCH"
.
equals
(
s
))
{
return
FETCH
;
...
...
@@ -312,12 +320,20 @@ public class ParserUtil {
return
FOREIGN
;
}
else
if
(
"FULL"
.
equals
(
s
))
{
return
FULL
;
}
else
if
(
"FALSE"
.
equals
(
s
))
{
return
FALSE
;
}
return
getKeywordOrIdentifier
(
s
,
"FALSE"
,
FALSE
)
;
return
IDENTIFIER
;
case
'G'
:
return
getKeywordOrIdentifier
(
s
,
"GROUP"
,
GROUP
);
if
(
"GROUP"
.
equals
(
s
))
{
return
GROUP
;
}
return
IDENTIFIER
;
case
'H'
:
return
getKeywordOrIdentifier
(
s
,
"HAVING"
,
HAVING
);
if
(
"HAVING"
.
equals
(
s
))
{
return
HAVING
;
}
return
IDENTIFIER
;
case
'I'
:
if
(
"INNER"
.
equals
(
s
))
{
return
INNER
;
...
...
@@ -333,7 +349,10 @@ public class ParserUtil {
}
return
IDENTIFIER
;
case
'J'
:
return
getKeywordOrIdentifier
(
s
,
"JOIN"
,
JOIN
);
if
(
"JOIN"
.
equals
(
s
))
{
return
JOIN
;
}
return
IDENTIFIER
;
case
'L'
:
if
(
"LIMIT"
.
equals
(
s
))
{
return
LIMIT
;
...
...
@@ -347,25 +366,38 @@ public class ParserUtil {
}
return
IDENTIFIER
;
case
'M'
:
return
getKeywordOrIdentifier
(
s
,
"MINUS"
,
MINUS
);
if
(
"MINUS"
.
equals
(
s
))
{
return
MINUS
;
}
return
IDENTIFIER
;
case
'N'
:
if
(
"NOT"
.
equals
(
s
))
{
return
NOT
;
}
else
if
(
"NATURAL"
.
equals
(
s
))
{
return
NATURAL
;
}
else
if
(
"NULL"
.
equals
(
s
))
{
return
NULL
;
}
return
getKeywordOrIdentifier
(
s
,
"NULL"
,
NULL
)
;
return
IDENTIFIER
;
case
'O'
:
if
(
"OFFSET"
.
equals
(
s
))
{
return
OFFSET
;
}
else
if
(
"ON"
.
equals
(
s
))
{
return
ON
;
}
else
if
(
"ORDER"
.
equals
(
s
))
{
return
ORDER
;
}
return
getKeywordOrIdentifier
(
s
,
"ORDER"
,
ORDER
)
;
return
IDENTIFIER
;
case
'P'
:
return
getKeywordOrIdentifier
(
s
,
"PRIMARY"
,
PRIMARY
);
if
(
"PRIMARY"
.
equals
(
s
))
{
return
PRIMARY
;
}
return
IDENTIFIER
;
case
'R'
:
return
getKeywordOrIdentifier
(
s
,
"ROWNUM"
,
ROWNUM
);
if
(
"ROWNUM"
.
equals
(
s
))
{
return
ROWNUM
;
}
return
IDENTIFIER
;
case
'S'
:
if
(
"SELECT"
.
equals
(
s
))
{
return
SELECT
;
...
...
@@ -389,24 +421,20 @@ public class ParserUtil {
case
'U'
:
if
(
"UNIQUE"
.
equals
(
s
))
{
return
UNIQUE
;
}
else
if
(
"UNION"
.
equals
(
s
))
{
return
UNION
;
}
return
getKeywordOrIdentifier
(
s
,
"UNION"
,
UNION
)
;
return
IDENTIFIER
;
case
'W'
:
if
(
"WITH"
.
equals
(
s
))
{
return
WITH
;
}
else
if
(
"WHERE"
.
equals
(
s
))
{
return
WHERE
;
}
return
getKeywordOrIdentifier
(
s
,
"WHERE"
,
WHERE
)
;
return
IDENTIFIER
;
default
:
return
IDENTIFIER
;
}
}
private
static
int
getKeywordOrIdentifier
(
String
s1
,
String
s2
,
int
keywordType
)
{
if
(
s1
.
equals
(
s2
))
{
return
keywordType
;
}
return
IDENTIFIER
;
}
}
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论