Alan Zimmerman pushed to branch wip/az/ghc-cpp at Glasgow Haskell Compiler / GHC

Commits:

3 changed files:

Changes:

  • compiler/GHC/Parser/Lexer.x
    ... ... @@ -328,7 +328,7 @@ $unigraphic / { isSmartQuote } { smart_quote_error }
    328 328
     <bol> {
    
    329 329
       \n                                    ;
    
    330 330
       -- Ghc CPP symbols, see https://timsong-cpp.github.io/cppwp/n4140/cpp#1
    
    331
    -  ^\ * \# \ * @cppkeyword  .* \n / { ifExtensionGhcCppNotComment } { cppToken cpp_prag }
    
    331
    +  ^\# \ * @cppkeyword  .* \n / { ifExtensionGhcCppNotComment } { cppToken cpp_prag }
    
    332 332
     
    
    333 333
       ^\# line                              { begin line_prag1 }
    
    334 334
       ^\# / { followedByDigit }             { begin line_prag1 }
    
    ... ... @@ -350,7 +350,7 @@ $unigraphic / { isSmartQuote } { smart_quote_error }
    350 350
     -- GhcCppBit is set.
    
    351 351
     <skipping> {
    
    352 352
       -- Ghc CPP symbols
    
    353
    -  ^\ * \# \ * @cppkeyword  .* \n  { cppToken cpp_prag }
    
    353
    +  ^\# \ * @cppkeyword  .* \n  { cppToken cpp_prag }
    
    354 354
       ^.*\n                           { cppSkip }
    
    355 355
     }
    
    356 356
     
    
    ... ... @@ -361,7 +361,7 @@ $unigraphic / { isSmartQuote } { smart_quote_error }
    361 361
       \{ / { notFollowedBy '-' }            { hopefully_open_brace }
    
    362 362
             -- we might encounter {-# here, but {- has been handled already
    
    363 363
       \n                                    ;
    
    364
    -  ^\ * \# \ * @cppkeyword  .* \n / { ifExtension GhcCppBit } { cppToken cpp_prag }
    
    364
    +  ^\# \ * @cppkeyword  .* \n / { ifExtension GhcCppBit } { cppToken cpp_prag }
    
    365 365
     
    
    366 366
       ^\# (line)?                           { begin line_prag1 }
    
    367 367
       ^\#.*\n                      / { ifExtension GhcCppBit } { cppSkip }
    
    ... ... @@ -436,7 +436,7 @@ $unigraphic / { isSmartQuote } { smart_quote_error }
    436 436
     
    
    437 437
       -- This one does not check for GhcCpp being set, we use it to
    
    438 438
       -- terminate normal pragma processing
    
    439
    -  ^\ * \# \ * @cppkeyword  .* \n   { cppToken cpp_prag }
    
    439
    +  ^\# \ * @cppkeyword  .* \n   { cppToken cpp_prag }
    
    440 440
       -- ^\# .*\n                      { cppSkip }
    
    441 441
     }
    
    442 442
     
    

  • testsuite/tests/ghc-cpp/GhcCpp01.hs
    ... ... @@ -3,7 +3,7 @@
    3 3
     module GhcCpp01 where
    
    4 4
     
    
    5 5
     -- Check leading whitespace on a directive
    
    6
    -   # define FOO(A,B) A + B
    
    6
    +#     define FOO(A,B) A + B
    
    7 7
     #define FOO(A,B,C) A + B + C
    
    8 8
     #if FOO(1,FOO(3,4)) == 8
    
    9 9
     
    

  • testsuite/tests/ghc-cpp/GhcCpp01.stderr
    ... ... @@ -202,7 +202,7 @@
    202 202
       |module GhcCpp01 where
    
    203 203
     
    
    204 204
     - |-- Check leading whitespace on a directive
    
    205
    -- |   # define FOO(A,B) A + B
    
    205
    +- |#     define FOO(A,B) A + B
    
    206 206
     - |#define FOO(A,B,C) A + B + C
    
    207 207
     - |#if FOO(1,FOO(3,4)) == 8
    
    208 208