From e1142d54fdf2561cf6fbb201c7e2db07f65a150e Mon Sep 17 00:00:00 2001 From: simonpj Date: Mon, 6 Oct 2003 13:14:36 +0000 Subject: [PATCH] [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 --- Text/Read/Lex.hs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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 -- 1.7.10.4