Lexical error in string continuation

Harendra Kumar harendra.kumar at gmail.com
Sat Jan 7 22:45:52 UTC 2017


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 <harendra.kumar at gmail.com> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20170108/3c967b63/attachment.html>


More information about the ghc-devs mailing list