Skip to content

Commit

Permalink
Catch small edge-case in parser
Browse files Browse the repository at this point in the history
  • Loading branch information
octylFractal committed Oct 27, 2019
1 parent ae71c2a commit 777b132
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Expand Up @@ -63,7 +63,7 @@ fragment EXP_CHAR : [eE] ;
fragment DECIMAL : '.' DIGIT+ ( EXP_CHAR SIGN? DIGIT+ )? ;

// All numbers are treated the same. No int/dec divide.
NUMBER : SIGN? ( DIGIT+ DECIMAL? | DECIMAL ) ;
NUMBER : ( DIGIT+ DECIMAL? | DECIMAL ) ;

ID : [A-Za-z] [0-9A-Za-z_]* ;

Expand Down
Expand Up @@ -74,6 +74,11 @@ public void testEvaluate() throws ExpressionException {
assertEquals(8, compile("foo+bar", "foo", "bar").evaluate(5D, 3D), 0);
}

@Test
void testTightTokenization() {
assertEquals(4, simpleEval("3+1"), 0);
}

@Test
public void testErrors() {
// test lexer errors
Expand Down

0 comments on commit 777b132

Please sign in to comment.