From: simonpj Date: Mon, 6 Oct 2003 13:14:36 +0000 (+0000) Subject: [project @ 2003-10-06 13:14:36 by simonpj] X-Git-Tag: nhc98-1-18-release~484 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=e1142d54fdf2561cf6fbb201c7e2db07f65a150e;p=haskell-directory.git [project @ 2003-10-06 13:14:36 by simonpj] MERGE TO STABLE Fix trivial lexing bug involving leading zeros 045.4 was lexing as an Int, with a trailing ".4" The test is lib/Lex/lexNum --- diff --git a/Text/Read/Lex.hs b/Text/Read/Lex.hs index 5273c4f..dda2859 100644 --- a/Text/Read/Lex.hs +++ b/Text/Read/Lex.hs @@ -188,7 +188,7 @@ lexCharE = _ -> pfail lexNumeric = - do base <- lexBaseChar + do base <- lexBaseChar <++ return 10 n <- lexInteger base guard (n <= toInteger (ord maxBound)) return (chr (fromInteger n)) @@ -319,12 +319,9 @@ lexHexOct return (Int (val (fromIntegral base) 0 digits)) lexBaseChar :: ReadP Int --- Lex a single character indicating the base, --- or return 10 if there isn't one -lexBaseChar = lex_base <++ return 10 - where - lex_base = do { c <- get; - case c of +-- Lex a single character indicating the base; fail if not there +lexBaseChar = do { c <- get; + case c of 'o' -> return 8 'O' -> return 8 'x' -> return 16