提交 8e1eeaca authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Add more context-sensitive keywords part 2

上级 fe046888
......@@ -556,6 +556,8 @@ The following tokens are keywords in H2:
<td>+</td><td>+</td><td>+</td><td>+</td><td>+</td><td>+</td></tr>
<tr><td>JOIN</td>
<td>+</td><td>+</td><td>+</td><td>+</td><td>+</td><td>+</td></tr>
<tr><td>LEFT</td>
<td>CS</td><td>+</td><td>+</td><td>+</td><td>+</td><td>+</td></tr>
<tr><td>LIKE</td>
<td>+</td><td>+</td><td>+</td><td>+</td><td>+</td><td>+</td></tr>
<tr><td>LIMIT</td>
......@@ -588,6 +590,8 @@ The following tokens are keywords in H2:
<td>+</td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>REGEXP</td>
<td>CS</td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>RIGHT</td>
<td>CS</td><td>+</td><td>+</td><td>+</td><td>+</td><td>+</td></tr>
<tr><td>ROW</td>
<td>+</td><td>+</td><td>+</td><td>+</td><td>+</td><td></td></tr>
<tr><td>_ROWID_</td>
......
......@@ -1563,13 +1563,13 @@ public class JdbcDatabaseMetaData extends TraceObject implements
* HAVING,
* IF, ILIKE, IN, INNER, INTERSECT, INTERSECTS, INTERVAL, IS,
* JOIN,
* LIKE, LIMIT, LOCALTIME, LOCALTIMESTAMP,
* LEFT, LIKE, LIMIT, LOCALTIME, LOCALTIMESTAMP,
* MINUS,
* NATURAL, NOT, NULL,
* OFFSET, ON, OR, ORDER, OVER,
* PRIMARY,
* QUALIFY,
* REGEXP, ROW, _ROWID_, ROWNUM,
* REGEXP, RIGHT, ROW, _ROWID_, ROWNUM,
* SELECT, SYSDATE, SYSTIME, SYSTIMESTAMP,
* TABLE, TODAY, TOP, TRUE,
* UNION, UNIQUE,
......
......@@ -476,6 +476,11 @@ public class ParserUtil {
} else if (eq("LOCALTIMESTAMP", s, ignoreCase, start, end)) {
return LOCALTIMESTAMP;
}
if (additionalKeywords) {
if (eq("LEFT", s, ignoreCase, start, end)) {
return KEYWORD;
}
}
return IDENTIFIER;
case 'M':
if (eq("MINUS", s, ignoreCase, start, end)) {
......@@ -522,7 +527,7 @@ public class ParserUtil {
return ROWNUM;
}
if (additionalKeywords) {
if (eq("REGEXP", s, ignoreCase, start, end)) {
if (eq("REGEXP", s, ignoreCase, start, end) || eq("RIGHT", s, ignoreCase, start, end)) {
return KEYWORD;
}
}
......
......@@ -87,7 +87,7 @@ public class TestKeywords extends TestBase {
assertEquals(10, rs.getInt(1));
assertFalse(rs.next());
}
try (ResultSet rs = stat.executeQuery("SELECT SUM(" + s + ") " + s + " FROM " + s)) {
try (ResultSet rs = stat.executeQuery("SELECT SUM(" + s + ") " + s + " FROM " + s + ' ' + s)) {
assertTrue(rs.next());
assertEquals(10, rs.getInt(1));
assertFalse(rs.next());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论