merlin icon indicating copy to clipboard operation
merlin copied to clipboard

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

Open hnrgrgr opened this issue 4 years ago • 1 comments

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 avatar Apr 23 '20 15:04 hnrgrgr

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.

hnrgrgr avatar Apr 23 '20 17:04 hnrgrgr