language-haskell
language-haskell copied to clipboard
Repeated Haskell-style comments in Happy quotations are treated as comments
To take a few lines out of GHC's Parser.y
(because it's where I'm facing this error), consider the following code:
'{-# INLINE' { L _ (ITinline_prag _ _ _) } -- INLINE or INLINABLE
'{-# SPECIALISE' { L _ (ITspec_prag _) }
'{-# SPECIALISE_INLINE' { L _ (ITspec_inline_prag _ _) }
While the syntax highlighting continues correctly for the line containing '{-# INLINE'
, the subsequent opening comment is interpreted as an actual comment, rather than as the use of the syntax within a literal token, and leads to the rest of the file being treated as a comment.
I don't think this is (easily) fixable, because this is not Haskell syntax, but Happy syntax. It is outside the scope of the Haskell syntax highlighting to also fully support Happy. It probably is possible but it probably makes more sense to create an own Happy parser file that parses the Happy part of the syntax and embeds the Haskell highlighting for the contents of the Haskell blocks.
I do not have time to work on this but I'd be happy to merge a PR that adds this feature.
Actually I just realized that someone added support for Happy that is unreleased. I will try to get a new release out as soon as possible, please let me know if the update fixes this issue for you.
I don't think the current Happy grammar handles the lines in the OP, unfortunately.