diff --git a/runtests.hs b/runtests.hs index b941945..2dfe7f0 100644 --- a/runtests.hs +++ b/runtests.hs @@ -64,6 +64,7 @@ testSuite = testGroup "Parser" , testCase "LiteralDecimal13" (testLiteral "1e18" "Right (JSDecimal \"1e18\")") , testCase "LiteralDecimal14" (testLiteral "1e+18" "Right (JSDecimal \"1e+18\")") , testCase "LiteralDecimal15" (testLiteral "1e-18" "Right (JSDecimal \"1e-18\")") + , testCase "LiteralDecimal16" (testLiteral "1E-01" "Right (JSDecimal \"1E-01\")") , testCase "LiteralString1" (testLiteral "\"hello\\nworld\"" "Right (JSStringLiteral '\"' \"hello\\\\nworld\")") , testCase "LiteralString2" (testLiteral "'hello\\nworld'" "Right (JSStringLiteral '\\'' \"hello\\\\nworld\")") diff --git a/src-dev/Language/JavaScript/Parser/Lexer.x b/src-dev/Language/JavaScript/Parser/Lexer.x index 47eeb0d..40a3b12 100644 --- a/src-dev/Language/JavaScript/Parser/Lexer.x +++ b/src-dev/Language/JavaScript/Parser/Lexer.x @@ -238,11 +238,11 @@ tokens :- -- | "0" -- | "0." $digit+ { mkString decimalToken } - "0" "." $digit* ("e"|"E") ("+"|"-")? $non_zero_digit+ $digit* - | $non_zero_digit $digit* "." $digit* ("e"|"E") ("+"|"-")? $non_zero_digit+ $digit* - | "." $digit+ ("e"|"E") ("+"|"-")? $non_zero_digit+ $digit* - | "0" ("e"|"E") ("+"|"-")? $non_zero_digit+ $digit* - | $non_zero_digit $digit* ("e"|"E") ("+"|"-")? $non_zero_digit+ $digit* + "0" "." $digit* ("e"|"E") ("+"|"-")? $digit+ + | $non_zero_digit $digit* "." $digit* ("e"|"E") ("+"|"-")? $digit+ + | "." $digit+ ("e"|"E") ("+"|"-")? $digit+ + | "0" ("e"|"E") ("+"|"-")? $digit+ + | $non_zero_digit $digit* ("e"|"E") ("+"|"-")? $digit+ -- ++FOO++ | "0" "." $digit* | $non_zero_digit $digit* "." $digit*