mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improve sql wall
This commit is contained in:
@@ -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; // 特别处理
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user