ParserTester assertParseExpression(String expectedValue, int expectedIndex) { try { RENode.Expr exp = parser.parseExpression(); assertEquals(expectedValue, exp.toString()); assertEquals(expectedIndex, parser.getIndex()); return this; } catch (SyntaxException e) { throw failure(e); } }
public RENode.Expr parseExpression() throws SyntaxException { RENode.Expr expr; if (lexer.next(Kind.BEGIN)) { expr = new RENode.Assertion.Begin(); } else if (lexer.next(Kind.END)) { expr = new RENode.Assertion.End(); } else if (lexer.next(Kind.GROUP_OPEN)) { GroupType groupType = GroupType.forPrefix(lexer.getToken()); RENode.Disjunction group = parseDisjunction(); if (lexer.next(Kind.GROUP_CLOSE)) { expr = new RENode.Group(group, groupType); } else { throw new SyntaxException("Group not closed "); } } else { expr = parseCharacter(); } if (expr != null) { Quantifier quantifier = parseQuantifier(); if (quantifier != null) { expr.setQuantifier(quantifier); } } return expr; }
public RENode.Expr parseExpression() throws SyntaxException { RENode.Expr expr; if (lexer.next(Kind.BEGIN)) { expr = new RENode.Assertion.Begin(); } else if (lexer.next(Kind.END)) { expr = new RENode.Assertion.End(); } else if (lexer.next(Kind.GROUP_OPEN)) { GroupType groupType = GroupType.forPrefix(lexer.getToken()); RENode.Disjunction group = parseDisjunction(); if (lexer.next(Kind.GROUP_CLOSE)) { expr = new RENode.Group(group, groupType); } else { throw new SyntaxException("Group not closed "); } } else { expr = parseCharacter(); } if (expr != null) { Quantifier quantifier = parseQuantifier(); if (quantifier != null) { expr.setQuantifier(quantifier); } } return expr; }
protected void visit(RENode.Alternative alternative) throws IOException, NullPointerException { alternative.getExpr().accept(this); RENode.Alternative next = alternative.getNext(); if (next != null) { visit(next); } }
protected void visit(RENode.Alternative alternative) throws E { alternative.getExpr().accept(this); RENode.Alternative next = alternative.getNext(); if (next != null) { next.accept(this); } }
@Override protected void visit(RENode.Alternative alternative) throws RuntimeException { alternative.getExpr().accept(this); RENode.Alternative next = alternative.getNext(); if (next != null) { next.accept(this); } }
ParserTester assertParseExpression(String expectedValue, int expectedIndex) { try { RENode.Expr exp = parser.parseExpression(); assertEquals(expectedValue, exp.toString()); assertEquals(expectedIndex, parser.getIndex()); return this; } catch (SyntaxException e) { throw failure(e); } }
protected void visit(RENode.Alternative alternative) throws IOException, NullPointerException { alternative.getExpr().accept(this); RENode.Alternative next = alternative.getNext(); if (next != null) { visit(next); } }
@Override protected void visit(RENode.Alternative alternative) throws RuntimeException { alternative.getExpr().accept(this); RENode.Alternative next = alternative.getNext(); if (next != null) { next.accept(this); } }
protected void visit(RENode.Alternative alternative) throws E { alternative.getExpr().accept(this); RENode.Alternative next = alternative.getNext(); if (next != null) { next.accept(this); } }