ocaml-ppx / ocaml-migrate-parsetree

DEPRECATED. See https://ocaml.org/changelog/2023-10-23-omp-deprecation. Convert OCaml parsetrees between different major versions
Other
87 stars 43 forks source link

Infer file kind for binary ASTs #80

Closed aantron closed 5 years ago

aantron commented 5 years ago

Relaxes the driver command line parser so that if an input file is not specified with --intf or --impl, but as an anonymous argument, and turns out to be a binary AST, the file kind is loaded from the file contents. Previously, the parser tried to guess the file kind from the extension. The extension is ignored completely now.

This helps with BuckleScript integration, because current BuckleScript produces temporary binary AST files with no extension.

aantron commented 5 years ago

I also merged master into this branch to resolve the merge conflict, assuming that you would merge by squash anyway. I'm happy to rewrite the history in any way, if not.

ghost commented 5 years ago

I've made guess_file_kind return Kind_unknown when the extension is unknown, this way the assert false disappears.

ghost commented 5 years ago

Thanks, that seems like a nice improvement. BTW, you might want to reproduce this change to ocaml-ppx/ppx at some point. The plan is that eventually it will replace the ocaml-migrate-parsetree driver entirely.