Skip to content
Permalink
Browse files

Catch small edge-case in parser

  • Loading branch information
octylFractal committed Oct 27, 2019
1 parent ae71c2a commit 777b132a041cbba7c7fe971c0e3150f523a9844a
@@ -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_]* ;

@@ -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

0 comments on commit 777b132

Please sign in to comment.
You can’t perform that action at this time.