From: sof Date: Fri, 25 Jul 1997 22:47:18 +0000 (+0000) Subject: [project @ 1997-07-25 22:47:18 by sof] X-Git-Tag: Approximately_1000_patches_recorded~229 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=c2dcbe1695b5e3dcbe7de26162ae0e17ea8ec73f;p=ghc-hetmet.git [project @ 1997-07-25 22:47:18 by sof] read scc labels to de-escape them --- 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' ->