if (!preservePath) { CharEscapeTransformation escaper = new CharEscapeTransformation('/', '_'); routingDisjunction.accept(escaper); routingDisjunction.accept(transformer); RERenderer.render(routingDisjunction, routingRegex); RENode.Disjunction renderingDisjunction = parser.parseDisjunction(); ValueResolverFactory factory = new ValueResolverFactory(); renderingDisjunction.accept(transformer); List<ValueResolverFactory.Alternative> alt = factory.foo(renderingDisjunction); renderingRegexes = new RERef[alt.size()];
@Override protected void visit(RENode.Disjunction disjunction) throws RuntimeException { if (current != null) { RENode.Alternative alternative = disjunction.getAlternative(); if (alternative != null) { alternative.accept(this); } } else { RENode.Alternative alternative = disjunction.getAlternative(); if (alternative != null) { current = new Alternative(); alternative.accept(this); current.suffix = current.buffer.toString(); current.buffer.setLength(0); alternatives.add(current); current = null; } // RENode.Disjunction next = disjunction.getNext(); if (next != null) { next.accept(this); } } }
protected void visit(RENode.Disjunction disjunction) throws IOException, NullPointerException { RENode.Alternative alternative = disjunction.getAlternative(); if (alternative != null) { alternative.accept(this); } if (disjunction.hasAlternative() && disjunction.hasNext()) { appendable.append('|'); } RENode.Disjunction next = disjunction.getNext(); if (next != null) { next.accept(this); } }
if (!preservePath) { CharEscapeTransformation escaper = new CharEscapeTransformation('/', '_'); routingDisjunction.accept(escaper); routingDisjunction.accept(transformer); RERenderer.render(routingDisjunction, routingRegex); RENode.Disjunction renderingDisjunction = parser.parseDisjunction(); ValueResolverFactory factory = new ValueResolverFactory(); renderingDisjunction.accept(transformer); List<ValueResolverFactory.Alternative> alt = factory.foo(renderingDisjunction); renderingRegexes = new RERef[alt.size()];
@Override protected void visit(RENode.Disjunction disjunction) throws RuntimeException { if (disjunction.hasAlternative()) { RENode.Alternative alternative = disjunction.getAlternative(); if (alternative != null) { alternative.accept(this); RENode.Disjunction disjunction1 = new RENode.Disjunction((RENode.Alternative)null); RENode.Group group = new RENode.Group(disjunction1, GroupType.CAPTURING_GROUP); RENode.Alternative alternative1 = new RENode.Alternative(group); alternative.replaceBy(alternative1); disjunction1.setAlternative(alternative); disjunction.setAlternative( new RENode.Alternative( new RENode.Group( new RENode.Disjunction(), GroupType.CAPTURING_GROUP))); if (disjunction.hasNext()) { RENode.Disjunction next = disjunction.getNext(); if (next != null) { next.accept(this); disjunction.setNext( new RENode.Disjunction( new RENode.Alternative( new RENode.Group( new RENode.Disjunction(), GroupType.CAPTURING_GROUP))));
@Override protected void visit(RENode.Disjunction disjunction) throws RuntimeException { if (disjunction.hasAlternative()) { RENode.Alternative alternative = disjunction.getAlternative(); if (alternative != null) { alternative.accept(this); RENode.Disjunction disjunction1 = new RENode.Disjunction((RENode.Alternative)null); RENode.Group group = new RENode.Group(disjunction1, GroupType.CAPTURING_GROUP); RENode.Alternative alternative1 = new RENode.Alternative(group); alternative.replaceBy(alternative1); disjunction1.setAlternative(alternative); disjunction.setAlternative( new RENode.Alternative( new RENode.Group( new RENode.Disjunction(), GroupType.CAPTURING_GROUP))); if (disjunction.hasNext()) { RENode.Disjunction next = disjunction.getNext(); if (next != null) { next.accept(this); disjunction.setNext( new RENode.Disjunction( new RENode.Alternative( new RENode.Group( new RENode.Disjunction(), GroupType.CAPTURING_GROUP))));
if (disjunction.getParent() == null) { if (disjunction.hasAlternative()) { RENode.Alternative alternative = disjunction.getAlternative(); disjunction.clearAlternative(); if (disjunction.hasNext()) { RENode.Disjunction next = disjunction.getNext(); disjunction.clearNext(); RENode.Alternative group = new RENode.Alternative( new RENode.Group( new RENode.Disjunction(alternative, next), GroupType.CAPTURING_GROUP)); disjunction.setAlternative(group); new RENode.Disjunction(alternative), GroupType.CAPTURING_GROUP)); disjunction.setAlternative(group); if (disjunction.hasNext()) { RENode.Disjunction next = disjunction.getNext(); disjunction.clearNext(); RENode.Alternative group = new RENode.Alternative( new RENode.Group( new RENode.Disjunction(next), GroupType.CAPTURING_GROUP)); disjunction.setAlternative(group); new RENode.Disjunction(), GroupType.CAPTURING_GROUP)); disjunction.setAlternative(group);
if (disjunction.getParent() == null) { if (disjunction.hasAlternative()) { RENode.Alternative alternative = disjunction.getAlternative(); disjunction.clearAlternative(); if (disjunction.hasNext()) { RENode.Disjunction next = disjunction.getNext(); disjunction.clearNext(); RENode.Alternative group = new RENode.Alternative( new RENode.Group( new RENode.Disjunction(alternative, next), GroupType.CAPTURING_GROUP)); disjunction.setAlternative(group); new RENode.Disjunction(alternative), GroupType.CAPTURING_GROUP)); disjunction.setAlternative(group); if (disjunction.hasNext()) { RENode.Disjunction next = disjunction.getNext(); disjunction.clearNext(); RENode.Alternative group = new RENode.Alternative( new RENode.Group( new RENode.Disjunction(next), GroupType.CAPTURING_GROUP)); disjunction.setAlternative(group); new RENode.Disjunction(), GroupType.CAPTURING_GROUP)); disjunction.setAlternative(group);
@Override protected void visit(RENode.Disjunction disjunction) throws RuntimeException { if (current != null) { RENode.Alternative alternative = disjunction.getAlternative(); if (alternative != null) { alternative.accept(this); } } else { RENode.Alternative alternative = disjunction.getAlternative(); if (alternative != null) { current = new Alternative(); alternative.accept(this); current.suffix = current.buffer.toString(); current.buffer.setLength(0); alternatives.add(current); current = null; } // RENode.Disjunction next = disjunction.getNext(); if (next != null) { next.accept(this); } } }
public RENode.Disjunction parseDisjunction() throws SyntaxException { RENode.Alternative alternative = parseAlternative(); if (alternative != null) { if (lexer.next(Kind.OR)) { RENode.Disjunction next = parseDisjunction(); return new RENode.Disjunction(alternative, next); } else { return new RENode.Disjunction(alternative); } } else { if (lexer.next(Kind.OR)) { RENode.Disjunction next = parseDisjunction(); return new RENode.Disjunction(null, next); } else { return null; } } }
public RENode.Disjunction parseDisjunction() throws SyntaxException { RENode.Alternative alternative = parseAlternative(); if (alternative != null) { if (lexer.next(Kind.OR)) { RENode.Disjunction next = parseDisjunction(); return new RENode.Disjunction(alternative, next); } else { return new RENode.Disjunction(alternative); } } else { if (lexer.next(Kind.OR)) { RENode.Disjunction next = parseDisjunction(); return new RENode.Disjunction(null, next); } else { return null; } } }
private void match(String pattern, String test, String expectedValue) throws Exception { REParser parser = new REParser(pattern); CharEscapeTransformation escaper = new CharEscapeTransformation('/', '_'); RENode.Disjunction re = parser.parseDisjunction(); re.accept(escaper); Pattern p = Pattern.compile(RERenderer.render(re, new StringBuilder()).toString()); Matcher matcher = p.matcher(test); assertTrue(matcher.find()); assertEquals(expectedValue, matcher.group()); }
private void match(String pattern, String test, String expectedValue) throws Exception { REParser parser = new REParser(pattern); CharEscapeTransformation escaper = new CharEscapeTransformation('/', '_'); RENode.Disjunction re = parser.parseDisjunction(); re.accept(escaper); Pattern p = Pattern.compile(RERenderer.render(re, new StringBuilder()).toString()); Matcher matcher = p.matcher(test); assertTrue(matcher.find()); assertEquals(expectedValue, matcher.group()); }
protected void visit(RENode.Disjunction disjunction) throws E { RENode alternative = disjunction.getAlternative(); if (alternative != null) { alternative.accept(this); } RENode.Disjunction next = disjunction.getNext(); if (next != null) { next.accept(this); } }
private void match(String pattern, String test, String expectedValue) throws Exception { REParser parser = new REParser(pattern); RouteEscaper escaper = new RouteEscaper('/', '_'); RENode.Disjunction re = parser.parseDisjunction(); re.accept(escaper); Pattern p = Pattern.compile(RERenderer.render(re, new StringBuilder()).toString()); Matcher matcher = p.matcher(test); assertTrue(matcher.find()); assertEquals(expectedValue, matcher.group()); }
protected void visit(RENode.Group expr) throws E { RENode.Disjunction disjunction = expr.getDisjunction(); if (disjunction != null) { disjunction.accept(this); } }
private void match(String pattern, String test, String expectedValue) throws Exception { REParser parser = new REParser(pattern); RouteEscaper escaper = new RouteEscaper('/', '_'); RENode.Disjunction re = parser.parseDisjunction(); re.accept(escaper); Pattern p = Pattern.compile(RERenderer.render(re, new StringBuilder()).toString()); Matcher matcher = p.matcher(test); assertTrue(matcher.find()); assertEquals(expectedValue, matcher.group()); }
protected void visit(RENode.Disjunction disjunction) throws IOException, NullPointerException { RENode.Alternative alternative = disjunction.getAlternative(); if (alternative != null) { alternative.accept(this); } if (disjunction.hasAlternative() && disjunction.hasNext()) { appendable.append('|'); } RENode.Disjunction next = disjunction.getNext(); if (next != null) { next.accept(this); } }
protected void visit(RENode.Group expr) throws E { RENode.Disjunction disjunction = expr.getDisjunction(); if (disjunction != null) { disjunction.accept(this); } }
protected void visit(RENode.Disjunction disjunction) throws E { RENode alternative = disjunction.getAlternative(); if (alternative != null) { alternative.accept(this); } RENode.Disjunction next = disjunction.getNext(); if (next != null) { next.accept(this); } }