[project @ 2002-02-11 15:23:12 by simonmar]
authorsimonmar <unknown>
Mon, 11 Feb 2002 15:23:12 +0000 (15:23 +0000)
committersimonmar <unknown>
Mon, 11 Feb 2002 15:23:12 +0000 (15:23 +0000)
Fix lexer bug: we didn't look far enough ahead when parsing 1.0e+x
(i.e. the e+x shouldn't be treated as an exponent).

ghc/compiler/parser/Lex.lhs

index 01fcc3b..5dd61c3 100644 (file)
@@ -925,8 +925,10 @@ lex_num cont exts acc buf =
                    do_exponent 
                        = let buf3 = incLexeme buf2 in
                          case currentChar# buf3 of
-                               '-'# -> expandWhile# is_digit (incLexeme buf3)
-                               '+'# -> expandWhile# is_digit (incLexeme buf3)
+                               '-'# | is_digit (lookAhead# buf 1#)
+                                  -> expandWhile# is_digit (incLexeme buf3)
+                               '+'# | is_digit (lookAhead# buf 1#)
+                                  -> expandWhile# is_digit (incLexeme buf3)
                                x | is_digit x -> expandWhile# is_digit buf3
                                _ -> buf2