String readName() { skipWhitespace(); if (ch != '\\' && !Character.isJavaIdentifierStart(ch)) { throw new JSONPathException("illeal jsonpath syntax. " + path); } StringBuilder buf = new StringBuilder(); while (!isEOF()) { if (ch == '\\') { next(); buf.append(ch); if (isEOF()) { return buf.toString(); } next(); continue; } boolean identifierFlag = Character.isJavaIdentifierPart(ch); if (!identifierFlag) { break; } buf.append(ch); next(); } if (isEOF() && Character.isJavaIdentifierPart(ch)) { buf.append(ch); } return buf.toString(); }
next(); accept('('); predicateFlag = true; boolean self = false; if (ch == '@') { next(); accept('.'); self = true; next(); next(); next(); Filter filter = new NotNullSegement(propertyName); while (ch == ' ') { next(); next(); next(); Filter filter = new IntOpSegement(propertyName, value, intOp); while (ch == ' ') { next(); next();
String readName() { skipWhitespace(); if (ch != '\\' && !Character.isJavaIdentifierStart(ch)) { throw new JSONPathException("illeal jsonpath syntax. " + path); } StringBuilder buf = new StringBuilder(); while (!isEOF()) { if (ch == '\\') { next(); buf.append(ch); if (isEOF()) { return buf.toString(); } next(); continue; } boolean identifierFlag = Character.isJavaIdentifierPart(ch); if (!identifierFlag) { break; } buf.append(ch); next(); } if (isEOF() && Character.isJavaIdentifierPart(ch)) { buf.append(ch); } return buf.toString(); }
protected Operator readOp() { Operator op = null; if (ch == '=') { next(); if (ch == '~') { next(); op = Operator.REG_MATCH; } else if (ch == '=') { next(); op = Operator.EQ; } else { next(); accept('='); op = Operator.NE; } else if (ch == '<') { next(); if (ch == '=') { next(); op = Operator.LE; } else { next(); if (ch == '=') { next(); op = Operator.GE; } else {
public JSONPathParser(String path){ this.path = path; next(); }
Filter filterRest(Filter filter) { boolean and = ch == '&'; if ((ch == '&' && getNextChar() == '&') || (ch == '|' && getNextChar() == '|')) { next(); next(); while (ch == ' ') { next(); } Filter right = (Filter) parseArrayAccessFilter(false); filter = new FilterGroup(filter, right, and); } return filter; }
public final void skipWhitespace() { for (;;) { if (ch <= ' ' && (ch == ' ' || ch == '\r' || ch == '\n' || ch == '\t' || ch == '\f' || ch == '\b')) { next(); continue; } else { break; } } }
void accept(char expect) { if (ch != expect) { throw new JSONPathException("expect '" + expect + ", but '" + ch + "'"); } if (!isEOF()) { next(); } }
public JSONPathParser(String path){ this.path = path; next(); }
Filter filterRest(Filter filter) { boolean and = ch == '&'; if ((ch == '&' && getNextChar() == '&') || (ch == '|' && getNextChar() == '|')) { next(); next(); while (ch == ' ') { next(); } Filter right = (Filter) parseArrayAccessFilter(false); filter = new FilterGroup(filter, right, and); } return filter; }
void accept(char expect) { if (ch != expect) { throw new JSONPathException("expect '" + expect + ", but '" + ch + "'"); } if (!isEOF()) { next(); } }
public final void skipWhitespace() { for (;;) { if (ch <= ' ' && (ch == ' ' || ch == '\r' || ch == '\n' || ch == '\t' || ch == '\f' || ch == '\b')) { next(); continue; } else { break; } } }