Fix #line pragmas in nested comments
ClosedPublic

Authored by bsklaroff on Jul 5 2018, 4:44 AM.

Details

Summary

When parsing a nested comment or nested doc comment in the lexer, if we
see a line starting with '#' we attempt to parse a #line pragma. This
fixes how ghc handles output of the C preproccesor (-cpp flag) when the
original source has C comments or pragmas inside haskell comments.

Test Plan

./validate

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bsklaroff created this revision.Jul 5 2018, 4:44 AM
bsklaroff updated this revision to Diff 17194.Jul 5 2018, 4:49 AM

Updated submodule

bsklaroff updated this revision to Diff 17195.Jul 5 2018, 4:58 AM

Fix tests

bsklaroff updated this revision to Diff 17247.Jul 9 2018, 1:02 PM

Improve comment

bgamari updated the Trac tickets for this revision.Jul 12 2018, 10:07 AM

@bgamari I know this is low priority, but can you take a quick look at this? I'd love to get some feedback, especially if there's a cleaner way to fix this bug

Thanks for the ping, @bsklaroff and sorry for the latency.

Where can the haddock changes be found?

compiler/parser/Lexer.x
1176

Thanks for the note!

2325

Perhaps add a reference to the Note here.

bsklaroff updated this revision to Diff 17594.Aug 6 2018, 12:28 PM
  • add reference to note
bsklaroff updated this revision to Diff 17595.Aug 6 2018, 12:30 PM

squash "add reference to note" commit

bgamari retitled this revision from Fix #line pragmas in nested comments (fix #314) to Fix #line pragmas in nested comments.Aug 6 2018, 2:00 PM
thomie added a comment.Aug 6 2018, 4:43 PM

Cool!

A patch for the second-oldest still open bug!

Major kudos!

bgamari accepted this revision.Aug 21 2018, 11:02 AM

Alright, I'm happy with this. Let's merge it!

Thanks @bsklaroff!

This revision is now accepted and ready to land.Aug 21 2018, 11:02 AM
This revision was automatically updated to reflect the committed changes.