From 11252ea11c1d2af6a261fb8610cc4420c58c07fb Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 24 May 2006 15:43:10 +0000 Subject: replace a fatal error in lexChar with a parseError --- src/HsLexer.lhs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/HsLexer.lhs b/src/HsLexer.lhs index 35eccb81..d7cd62a6 100644 --- a/src/HsLexer.lhs +++ b/src/HsLexer.lhs @@ -513,11 +513,13 @@ lexChar cont s0 loc0 y x f = case s0 of '\\':s1 -> (escapeChar s1 `thenP` \(e,s,i) _ _ _ _ _ -> charEnd e s loc0 y (x+i) f) s1 loc0 y x f c:s -> charEnd c s loc0 y (x+1) f - [] -> error "Internal error: lexChar" + [] -> char_err [] loc0 y x f where charEnd c ('\'':'#':s) = \loc y0 x0 f0 -> cont (PrimChar c) s loc y0 (x0+2) f0 charEnd c ('\'':s) = \loc y0 x0 f0 -> cont (Character c) s loc y0 (x0+1) f0 - charEnd _ s = parseError "Improperly terminated character constant" s + charEnd c s = char_err s + + char_err s = parseError "Improperly terminated character constant" s lexString :: (Token -> P a) -> P a lexString cont s0 loc y0 x0 f0 = loop "" s0 x0 y0 f0 -- cgit v1.2.3