Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeated Haskell-style comments in Happy quotations are treated as comments #207

Open
typedrat opened this issue Mar 5, 2022 · 3 comments

Comments

@typedrat
Copy link

typedrat commented Mar 5, 2022

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.

@JustusAdam
Copy link
Owner

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.

@JustusAdam
Copy link
Owner

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.

@sheaf
Copy link
Collaborator

sheaf commented Mar 14, 2022

I don't think the current Happy grammar handles the lines in the OP, unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants