aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2006-05-24 15:43:10 +0000
committerSimon Marlow <simonmar@microsoft.com>2006-05-24 15:43:10 +0000
commit11252ea11c1d2af6a261fb8610cc4420c58c07fb (patch)
tree9fb2201121735c6987f034ca03c4e8ee6e0ecfb2
parent748b707883060c25e25c4d7e0f8a21c796b851fb (diff)
replace a fatal error in lexChar with a parseError
-rw-r--r--src/HsLexer.lhs6
1 files 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