improve sql wall

This commit is contained in:
wenshao
2013-08-25 14:17:05 +08:00
parent d10e85c0f4
commit e10c681671
19 changed files with 741 additions and 60 deletions
@@ -15,6 +15,8 @@
*/
package com.alibaba.druid.sql.parser;
import static com.alibaba.druid.sql.parser.LayoutCharacters.EOI;
public class CharTypes {
private final static boolean[] hexFlags = new boolean[256];
@@ -53,9 +55,9 @@ public class CharTypes {
}
public static boolean isFirstIdentifierChar(char c) {
if (c <= firstIdentifierFlags.length) {
return firstIdentifierFlags[c];
}
if (c <= firstIdentifierFlags.length) {
return firstIdentifierFlags[c];
}
return c != ' ' && c != ',';
}
@@ -85,12 +87,15 @@ public class CharTypes {
private final static boolean[] whitespaceFlags = new boolean[256];
static {
whitespaceFlags[' '] = true;
whitespaceFlags['\n'] = true;
whitespaceFlags['\r'] = true;
whitespaceFlags['\t'] = true;
whitespaceFlags['\f'] = true;
whitespaceFlags['\b'] = true;
for (int i = 0; i <= 32; ++i) {
whitespaceFlags[i] = true;
}
whitespaceFlags[EOI] = false;
for (int i = 0x7F; i <= 0xA0; ++i) {
whitespaceFlags[i] = true;
}
whitespaceFlags[160] = true; // 特别处理
}