use of org.csstudio.autocomplete.parser.engine.expr.ExprBinaryOperator in project yamcs-studio by yamcs.
the class ExprParser method parseOperator.
private void parseOperator(ExprToken e, ExprLexer lexer) throws ExprException, IOException {
// handle negative numbers
if ((e.type == ExprTokenType.Minus || e.type == ExprTokenType.Plus) && current == null) {
ExprToken nextToken = lexer.next();
if (nextToken == null)
return;
Expr value = null;
switch(nextToken.type) {
case Decimal:
value = new ExprDouble(e.type == ExprTokenType.Minus ? -nextToken.doubleValue : nextToken.doubleValue);
setValue(value);
return;
case Integer:
value = new ExprInteger(e.type == ExprTokenType.Minus ? -nextToken.integerValue : nextToken.integerValue);
setValue(value);
return;
default:
break;
}
current = new ExprBinaryOperator(ExprType.BinaryOperation, null, null);
parseToken(lexer, nextToken);
return;
}
current = new ExprBinaryOperator(ExprType.BinaryOperation, current, null);
}
Aggregations