-
Notifications
You must be signed in to change notification settings - Fork 182
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
Feature request: support BER MetaOCaml #1211
Comments
The problem is that we would need a way to tell the OCaml parser (that we rely on) that |
@gpetiot BER MetaOCaml is a fork of OCaml. Building OCamlformat with it automatically allows to parse BER syntax, since there is no new AST nodes. I would be in favor of this feature :) |
This will at least make the test suite more complicated since we'll emit code that's invalid for the vanilla compiler, as @gpetiot said. So it would have to be gated behind a flag at least. In any case, extensions are low priority at the moment. It would be easier to support than extensions like cppo or camlp4, but the focus for ocamlformat is vanilla ocaml code for now. |
I have a small (~50 line) patch that adds MetaOCaml dialect support here, which may be useful to anyone who just wants a quick solution. I have no comment on whether it's worth trying to maintain this upstream. |
x-link ocaml/ocaml#11871 |
We will be happy to support this once it is merged in the compiler, we regularly rebase our vendored parser to catch up on the latest syntax. |
Is your feature request related to a problem? Please describe.
When using ocamlformat with BER MetaOCaml sources, the bracket syntax is expanded to the corresponding attributes. For example:
expands to
Describe the solution you'd like
I guess we could argue that BER MetaOCaml is a "dialect" of OCaml and the fix doesn't belong in ocamlformat. However, it would be great if it was supported. Concretely, the bracket syntax (both bracket
.<expr>.
and escape.~(expr)
) should be kept as is.Additional context
none
The text was updated successfully, but these errors were encountered: