@Test public void shouldParseParenthesizedExpression() { assertThat(parser.parseParenthesizedExpr(tokenize("('foo')")), is(paren(literal("foo")))); }
protected ParenthesizedExpression parseParenthesizedExpr( TokenStream tokens ) { tokens.consume('('); if (tokens.canConsume(')')) { return new ParenthesizedExpression(); } Component expr = collapse(parseExpr(tokens)); tokens.consume(')'); return new ParenthesizedExpression(expr); }
XPathParser { protected ParenthesizedExpression parseParenthesizedExpr( TokenStream tokens ) { tokens.consume('('); if (tokens.canConsume(')')) { return new ParenthesizedExpression(); } Component expr = collapse(parseExpr(tokens)); tokens.consume(')'); return new ParenthesizedExpression(expr); } }
XPathParser { protected ParenthesizedExpression parseParenthesizedExpr( TokenStream tokens ) { tokens.consume('('); if (tokens.canConsume(')')) { return new ParenthesizedExpression(); } Component expr = collapse(parseExpr(tokens)); tokens.consume(')'); return new ParenthesizedExpression(expr); } XPathParser( TypeSystem context ); }
XPathParser { protected ParenthesizedExpression parseParenthesizedExpr( TokenStream tokens ) { tokens.consume('('); if (tokens.canConsume(')')) { return new ParenthesizedExpression(); } Component expr = collapse(parseExpr(tokens)); tokens.consume(')'); return new ParenthesizedExpression(expr); } XPathParser( TypeSystem context ); Component parseXPath( String xpath ); }
XPathParser { protected ParenthesizedExpression parseParenthesizedExpr( TokenStream tokens ) { tokens.consume('('); if (tokens.canConsume(')')) { return new ParenthesizedExpression(); } Component expr = collapse(parseExpr(tokens)); tokens.consume(')'); return new ParenthesizedExpression(expr); } XPathParser( TypeSystem context ); Component parseXPath( String xpath );  }