use of com.google.refine.grel.ast.OperatorCallExpr in project OpenRefine by OpenRefine.
the class Parser method parseSubExpression.
/**
* <sub-expression> := <term>
* | <sub-expression> [ "+" "-" ] <term>
*/
protected Evaluable parseSubExpression() throws ParsingException {
Evaluable sub = parseTerm();
while (_token != null && _token.type == TokenType.Operator && "+-".indexOf(_token.text) >= 0) {
String op = _token.text;
next(true);
Evaluable sub2 = parseTerm();
sub = new OperatorCallExpr(new Evaluable[] { sub, sub2 }, op);
}
return sub;
}
use of com.google.refine.grel.ast.OperatorCallExpr in project OpenRefine by OpenRefine.
the class Parser method parseExpression.
/**
* <expression> := <sub-expression>
* | <expression> [ "<" "<=" ">" ">=" "==" "!=" ] <sub-expression>
*/
protected Evaluable parseExpression() throws ParsingException {
Evaluable sub = parseSubExpression();
while (_token != null && _token.type == TokenType.Operator && ">=<==!=".indexOf(_token.text) >= 0) {
String op = _token.text;
next(true);
Evaluable sub2 = parseSubExpression();
sub = new OperatorCallExpr(new Evaluable[] { sub, sub2 }, op);
}
return sub;
}
use of com.google.refine.grel.ast.OperatorCallExpr in project OpenRefine by OpenRefine.
the class Parser method parseTerm.
/**
* <term> := <factor>
* | <term> [ "*" "/" "%" ] <factor>
*/
protected Evaluable parseTerm() throws ParsingException {
Evaluable factor = parseFactor();
while (_token != null && _token.type == TokenType.Operator && "*/%".indexOf(_token.text) >= 0) {
String op = _token.text;
next(true);
Evaluable factor2 = parseFactor();
factor = new OperatorCallExpr(new Evaluable[] { factor, factor2 }, op);
}
return factor;
}
Aggregations