From c2dcbe1695b5e3dcbe7de26162ae0e17ea8ec73f Mon Sep 17 00:00:00 2001 From: sof Date: Fri, 25 Jul 1997 22:47:18 +0000 Subject: [PATCH] [project @ 1997-07-25 22:47:18 by sof] read scc labels to de-escape them --- ghc/compiler/reader/Lex.lhs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/ghc/compiler/reader/Lex.lhs b/ghc/compiler/reader/Lex.lhs index e70cbbf..c0ce67e 100644 --- a/ghc/compiler/reader/Lex.lhs +++ b/ghc/compiler/reader/Lex.lhs @@ -411,9 +411,21 @@ lex_scc buf = -- let grp_name = lexemeToFastString buf'' in case untilChar# (stepOn (stepOverLexeme buf')) '\"'# of buf'' -> - let cc_name = lexemeToFastString buf'' in - (mkUserCC cc_name mod_name _NIL_{-grp_name-}, - stepOn (stepOverLexeme buf'')) + -- The label may contain arbitrary characters, so it + -- may have been escaped etc., hence we `read' it in to get + -- rid of these meta-chars in the string and then pack it (again.) + -- ToDo: do the same for module name (single quotes allowed in m-names). + -- BTW, the code in this module is totally gruesome.. + let upk_label = _UNPK_ (lexemeToFastString buf'') in + case reads ('"':upk_label++"\"") of + ((cc_label,_):_) -> + let cc_name = _PK_ cc_label in + (mkUserCC cc_name mod_name _NIL_{-grp_name-}, + stepOn (stepOverLexeme buf'')) + _ -> + trace ("trouble lexing scc label: " ++ upk_label ++ " , ignoring") + (mkUserCC _NIL_ mod_name _NIL_{-grp_name-}, + stepOn (stepOverLexeme buf'')) in case prefixMatch (stepOn buf) "CAF:" of Just buf' -> -- 1.7.10.4