Lexical error in string continuation

Hi devs, I am making a change in runghc on the ghc master branch. When compiling the following code (edited/new code in utils/runghc): 208 splitGhcNonGhcArgs :: [String] -> IO ([String], [String]) 209 splitGhcNonGhcArgs args = do 210 let (ghc, other) = break notAFlag args 211 when (hasUnescapedGhcArgs ghc) $ 212 hPutStrLn stderr "yy\ 213 \ xx" I get an error because of the string continuation at line 212. If I put the backslashes on the same line I do not get any error. I have more string continuations in the same file and they all work fine. This snippet works fine with ghc-7.10.3/ghc-8.0.1 when compiled separately. Here is the error message that I get: utils/runghc/Main.hs:212:56: error: lexical error in string/character literal at character 'x' | 212 | hPutStrLn stderr "yy\ | ^ utils/runghc/ghc.mk:30: recipe for target 'utils/runghc/dist-install/build/Main.dyn_o' failed make[2]: *** [utils/runghc/dist-install/build/Main.dyn_o] Error 1 Makefile:122: recipe for target 'all_utils/runghc' failed make[1]: *** [all_utils/runghc] Error 2 make[1]: Leaving directory '/vol/hosts/cueball/workspace/play/ghc' ../../mk/sub-makefile.mk:50: recipe for target 'all' failed make: *** [all] Error 2 Any help will be appreciated. I can send the modified file if anyone wants to reproduce/debug. -harendra

Ah, it looks like it is because of the pre-processor. This file has CPP
enabled:
{-# LANGUAGE CPP #-}
-harendra
On 8 January 2017 at 03:52, Harendra Kumar
Hi devs,
I am making a change in runghc on the ghc master branch. When compiling the following code (edited/new code in utils/runghc):
208 splitGhcNonGhcArgs :: [String] -> IO ([String], [String]) 209 splitGhcNonGhcArgs args = do 210 let (ghc, other) = break notAFlag args 211 when (hasUnescapedGhcArgs ghc) $ 212 hPutStrLn stderr "yy\ 213 \ xx"
I get an error because of the string continuation at line 212. If I put the backslashes on the same line I do not get any error. I have more string continuations in the same file and they all work fine. This snippet works fine with ghc-7.10.3/ghc-8.0.1 when compiled separately. Here is the error message that I get:
utils/runghc/Main.hs:212:56: error:
lexical error in string/character literal at character 'x'
|
212 | hPutStrLn stderr "yy\
| ^
utils/runghc/ghc.mk:30: recipe for target 'utils/runghc/dist-install/build/Main.dyn_o' failed
make[2]: *** [utils/runghc/dist-install/build/Main.dyn_o] Error 1
Makefile:122: recipe for target 'all_utils/runghc' failed
make[1]: *** [all_utils/runghc] Error 2
make[1]: Leaving directory '/vol/hosts/cueball/workspace/play/ghc'
../../mk/sub-makefile.mk:50: recipe for target 'all' failed
make: *** [all] Error 2
Any help will be appreciated. I can send the modified file if anyone wants to reproduce/debug.
-harendra
participants (1)
-
Harendra Kumar