in oak-core/src/main/java/org/apache/jackrabbit/oak/query/xpath/XPathToSQL2Converter.java [934:1017]
private void initialize(String query) throws ParseException {
if (query == null) {
query = "";
}
statement = query;
int len = query.length() + 1;
char[] command = new char[len];
int[] types = new int[len];
len--;
query.getChars(0, len, command, 0);
command[len] = ' ';
int startLoop = 0;
for (int i = 0; i < len; i++) {
char c = command[i];
int type = 0;
switch (c) {
case '@':
case '|':
case '/':
case '-':
case '(':
case ')':
case '{':
case '}':
case '*':
case ',':
case ';':
case '+':
case '%':
case '?':
case '$':
case '[':
case ']':
type = CHAR_SPECIAL_1;
break;
case '!':
case '<':
case '>':
case '=':
type = CHAR_SPECIAL_2;
break;
case '.':
type = CHAR_DECIMAL;
break;
case '\'':
type = CHAR_STRING;
types[i] = CHAR_STRING;
startLoop = i;
while (command[++i] != '\'') {
checkRunOver(i, len, startLoop);
}
break;
case '\"':
type = CHAR_STRING;
types[i] = CHAR_STRING;
startLoop = i;
while (command[++i] != '\"') {
checkRunOver(i, len, startLoop);
}
break;
case ':':
case '_':
type = CHAR_NAME;
break;
default:
if (c >= 'a' && c <= 'z') {
type = CHAR_NAME;
} else if (c >= 'A' && c <= 'Z') {
type = CHAR_NAME;
} else if (c >= '0' && c <= '9') {
type = CHAR_VALUE;
} else {
if (Character.isJavaIdentifierPart(c)) {
type = CHAR_NAME;
}
}
}
types[i] = (byte) type;
}
statementChars = command;
types[len] = CHAR_END;
characterTypes = types;
parseIndex = 0;
}