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

RFC: don't fail on directives when the file starts with #! #1134

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

hnrgrgr
Copy link

@hnrgrgr hnrgrgr commented Apr 23, 2020

This MR tries to fix #1023 .

When a file starts with #! it is now parsed with Parser_raw.Incremental.use_file instead of the usual Parser_raw.Incremental.implementation.

In the first patch, all the toplevel directives are ignored. The second patch adds handling of #require. The third and last patch drafts an implementation of #use and #mod_use.

@hnrgrgr
Copy link
Author

hnrgrgr commented Apr 23, 2020

Ok, I clearly missed the point on handling multiple compiler version. And I missed the tricks used until ocaml-4.07 to handle #require.

What's the policy about modifying parser_raw.mly ? Would it be best to modify recent parser versions or best ot try backporting some compatibility layer to old ones ? I suspect the latter is more future proof.

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

Successfully merging this pull request may close these issues.

Since 4.08 merlin no longer likes toplevel directives
1 participant