Merge "Revert changes to the alarm expression parser"

This commit is contained in:
Jenkins 2015-04-10 16:34:22 +00:00 committed by Gerrit Code Review
commit 6478dbed8a
2 changed files with 8 additions and 7 deletions

View File

@ -21,11 +21,11 @@ start
: expression EOF
;
expression
: function relational_operator literal ('times' repeat)? # relationalExprFuncFwd
| literal relational_operator function ('times' repeat)? # relationalExprFuncBwd
| compoundIdentifier relational_operator literal # relationalExprFwd
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
@ -132,7 +132,7 @@ repeat
txt
: TXT
| keyword
| INTEGER
| INTEGER
| STRING
;
LT
@ -208,11 +208,11 @@ INTEGER
;
DECIMAL
: '-'?DIGIT+('.'DIGIT+)?
: '-'?[0-9]+('.'[0-9]+)?
;
TXT
: ~('}' | '{' | '=' | ',' | ')' | '(' | ' ')*
: [//a-zA-Z_$/\\0-9]~('\''|';' | '}' | '{' | '=' | ','| '&' | ')' | '(' |' '| '"' )+
;
STRING

View File

@ -235,6 +235,7 @@ public class AlarmExpressionTest {
assertNotEquals(expr1, expr3);
}
@Test(expectedExceptions = IllegalArgumentException.class)
public void shouldParseDimensionsWithUnicode() {
AlarmExpression expr1 = new AlarmExpression(
"公{此=该,metric_name=mem} > 4"