Group(int memreg) { type = GROUP_IN; this.memreg = memreg; //used in append() current = null; in = this; prev = null; out = new Term(); out.type = GROUP_OUT; out.memreg = memreg; } }
private void newBranch() throws PatternSyntaxException { close(); startNewBranch(); }
@Override public int hashCode() { int result = atom != null ? atom.hashCode() : 0; result = 31 * result + distance; return result; } }
tmp = greedy ? makeGreedyStar(vars, current, iterators) : makeLazyStar(vars, current); current = replaceCurrent(tmp); break; tmp = greedy ? makeGreedyPlus(vars, current, iterators) : makeLazyPlus(vars, current); current = replaceCurrent(tmp); break; tmp = greedy ? makeGreedyQMark(vars, current) : makeLazyQMark(vars, current); current = replaceCurrent(tmp); break; limits[0] = 0; limits[1] = -1; int le = parseLimits(i + 1, end, data, limits); if (limits[LIMITS_PARSE_RESULT_INDEX] == LIMITS_OK) { //parse ok if (current == null) throw new PatternSyntaxException("missing term before {}"); tmp = greedy ? makeGreedyLimits(vars, current, limits, iterators) : makeLazyLimits(vars, current, limits); current = replaceCurrent(tmp); break; } else { //unicode class or named backreference i = parseGroupId(data, p, end, br, gmap, '}'); current = append(br);
term.append(t.tOffset, t.tOutside, data, vars, flags, iterators, groupNames); switch (t.ttype) { case Pretokenizer.FLAGS: case Pretokenizer.CLASS_GROUP: t.next(); Term clg = new Term(); CharacterClass.parseGroup(data, t.tOffset, t.tOutside, clg, (flags[0] & IGNORE_CASE) > 0, (flags[0] & IGNORE_SPACES) > 0, (flags[0] & UNICODE) > 0, (flags[0] & XML_SCHEMA) > 0); term.append(clg); continue; case Pretokenizer.PLAIN_GROUP: vars[DEPTH]++; term.append(makeTree(t, data, vars, new int[]{t.flags(flags[0])}, new Group(), iterators, groupNames)); break; case Pretokenizer.NAMED_GROUP: term.append(makeTree(t, data, vars, flags, new Group(id), iterators, groupNames)); break; case '(': vars[DEPTH]++; term.append(makeTree(t, data, vars, flags, new Group(vars[MEMREG_COUNT]++), iterators, groupNames)); break; case Pretokenizer.POS_LOOKAHEAD: vars[DEPTH]++; term.append(makeTree(t, data, vars, flags, new Lookahead(vars[LOOKAHEAD_COUNT]++, true), iterators, groupNames)); break; case Pretokenizer.NEG_LOOKAHEAD:
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Pattern pattern = (Pattern) o; if (memregs != pattern.memregs) return false; if (counters != pattern.counters) return false; if (lookaheads != pattern.lookaheads) return false; if (stringRepr != null ? !stringRepr.equals(pattern.stringRepr) : pattern.stringRepr != null) return false; return root != null ? root.equals(pattern.root) : pattern.root == null && (root0 != null ? root0.equals(pattern.root0) : pattern.root0 == null && (namedGroupMap != null ? namedGroupMap.equals(pattern.namedGroupMap) : pattern.namedGroupMap == null)); }
private static void link(Term term, Term next) { linkd(term, next.in); next.prev = term; }
Term append(Term term) throws PatternSyntaxException { //Term prev=this.prev; Term current = this.current; if (current == null) { in.next = term; term.prev = in; this.current = term; return term; } link(current, term); //this.prev=current; this.current = term; return term; }
protected void close() throws PatternSyntaxException { int pd = prevDistance; if (pd >= 0) { if (distance != pd) throw new PatternSyntaxException("non-equal branch lengths within a lookbehind assertion"); } super.close(); }
protected Term append(Term t) throws PatternSyntaxException { distance += length(t); return super.append(t); }
tmp = greedy ? makeGreedyStar(vars, current, iterators) : makeLazyStar(vars, current); current = replaceCurrent(tmp); break; tmp = greedy ? makeGreedyPlus(vars, current, iterators) : makeLazyPlus(vars, current); current = replaceCurrent(tmp); break; tmp = greedy ? makeGreedyQMark(vars, current) : makeLazyQMark(vars, current); current = replaceCurrent(tmp); break; limits[0] = 0; limits[1] = -1; int le = parseLimits(i + 1, end, data, limits); if (limits[LIMITS_PARSE_RESULT_INDEX] == LIMITS_OK) { //parse ok if (current == null) throw new PatternSyntaxException("missing term before {}"); tmp = greedy ? makeGreedyLimits(vars, current, limits, iterators) : makeLazyLimits(vars, current, limits); current = replaceCurrent(tmp); break; } else { //unicode class or named backreference i = parseGroupId(data, p, end, br, gmap, '}'); current = append(br);
term.append(t.tOffset, t.tOutside, data, vars, flags, iterators, groupNames); switch (t.ttype) { case Pretokenizer.FLAGS: case Pretokenizer.CLASS_GROUP: t.next(); Term clg = new Term(); CharacterClass.parseGroup(data, t.tOffset, t.tOutside, clg, (flags[0] & IGNORE_CASE) > 0, (flags[0] & IGNORE_SPACES) > 0, (flags[0] & UNICODE) > 0, (flags[0] & XML_SCHEMA) > 0); term.append(clg); continue; case Pretokenizer.PLAIN_GROUP: vars[DEPTH]++; term.append(makeTree(t, data, vars, new int[]{t.flags(flags[0])}, new Group(), iterators, groupNames)); break; case Pretokenizer.NAMED_GROUP: term.append(makeTree(t, data, vars, flags, new Group(id), iterators, groupNames)); break; case '(': vars[DEPTH]++; term.append(makeTree(t, data, vars, flags, new Group(vars[MEMREG_COUNT]++), iterators, groupNames)); break; case Pretokenizer.POS_LOOKAHEAD: vars[DEPTH]++; term.append(makeTree(t, data, vars, flags, new Lookahead(vars[LOOKAHEAD_COUNT]++, true), iterators, groupNames)); break; case Pretokenizer.NEG_LOOKAHEAD:
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; Lookahead lookahead = (Lookahead) o; return isPositive == lookahead.isPositive; }
private static void link(Term term, Term next) { linkd(term, next.in); next.prev = term; }
Term append(Term term) throws PatternSyntaxException { //Term prev=this.prev; Term current = this.current; if (current == null) { in.next = term; term.prev = in; this.current = term; return term; } link(current, term); //this.prev=current; this.current = term; return term; }
protected void close() throws PatternSyntaxException { int pd = prevDistance; if (pd >= 0) { if (distance != pd) throw new PatternSyntaxException("non-equal branch lengths within a lookbehind assertion"); } super.close(); }
protected Term append(Term t) throws PatternSyntaxException { distance += length(t); return super.append(t); }
IndependentGroup(int id) { super(0); in = this; out = new Term(); type = INDEPENDENT_IN; out.type = INDEPENDENT_OUT; lookaheadId = out.lookaheadId = id; } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; Lookbehind that = (Lookbehind) o; return isPositive == that.isPositive && prevDistance == that.prevDistance; }
@Override public int hashCode() { int result = atom != null ? atom.hashCode() : 0; result = 31 * result + distance; return result; } }