Disallow alarm expressions with threshold first

Disallow expressions like "0 < test_metric"

Change-Id: I6da58862216402651772063c01e5e25420a4f000
This commit is contained in:
Ryan Brandt 2015-06-08 13:47:10 -06:00
parent 271a26a730
commit b1752d381c
2 changed files with 0 additions and 19 deletions

View File

@ -70,23 +70,6 @@ class AlarmSubExpressionListener extends AlarmExpressionBaseListener {
saveSubExpression();
}
@Override
public void exitRelationalExprBwd(AlarmExpressionParser.RelationalExprBwdContext ctx) {
operator = AlarmOperator.reverseOperator(operator);
// This is *right now* basically the same as a min or max function, convert it
if (operator == AlarmOperator.GT || operator == AlarmOperator.GTE)
function = AggregateFunction.MAX;
else
function = AggregateFunction.MIN;
saveSubExpression();
}
@Override
public void exitRelationalExprFuncBwd(AlarmExpressionParser.RelationalExprFuncBwdContext ctx) {
operator = AlarmOperator.reverseOperator(operator);
saveSubExpression();
}
@Override
public void enterFunctionType(AlarmExpressionParser.FunctionTypeContext ctx) {
function = AggregateFunction.valueOf(ctx.getChild(0).getText().toUpperCase());

View File

@ -24,8 +24,6 @@ start
expression
: compoundIdentifier relational_operator literal # relationalExprFwd
| function relational_operator literal ('times' repeat)? # relationalExprFuncFwd
| literal relational_operator compoundIdentifier # relationalExprBwd
| literal relational_operator function ('times' repeat)? # relationalExprFuncBwd
| expression and expression # andExpr
| expression or expression # orExpr
| '(' expression ')' # parenExpr