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()); }
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()); }
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()];
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()];
RENode.Disjunction next = disjunction.getNext(); if (next != null) { next.accept(this);
RENode.Disjunction next = disjunction.getNext(); if (next != null) { next.accept(this);
@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); } } }
@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); } }
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); } }
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); } }
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); } }
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); } }