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

Problem with ocamllex syntax #218

Open
correnson opened this issue Mar 22, 2016 · 3 comments
Open

Problem with ocamllex syntax #218

correnson opened this issue Mar 22, 2016 · 3 comments

Comments

@correnson
Copy link

It seems that ocp-indent works badly with parsing rules in .mll files.
However, it is automatically activated by the tuareg hook.

  • should it work with?
  • is there any workaround?
@correnson correnson changed the title Problem with ocamllex Problem with ocamllex syntax Mar 22, 2016
@william3
Copy link

+1, I am having a really bad time with .mll and .mly files

@AltGr
Copy link
Member

AltGr commented Apr 29, 2016

Indeed, syntax for .mll and .mly files is quite different.

  • there is very basic support for .mll, that can be enabled with --syntax=mll (it indents rule _ = parse better, but let _ = regexp+ for example needs additional parentheses or ocp-indent will consider + as the binary operator it normally is). The emacs mode should automatically enable this on .mll files but doesn't at the moment. You can do this manually for all ocaml files by customising ocp-indent-syntax, or to temporarily do it just on the current buffer:
M-: (setq-local ocp-indent-syntax '("mll"))
  • there is no support for .mly at the moment ; latest ocp-indent should not load when it detects that the file matches *.mly, but tuareg doesn't do much better.

In any case, you can locally disable ocp-indent while in tuareg-mode using

M-: (progn (kill-local-variable 'indent-line-function) (kill-local-variable 'indent-region-function) (tuareg--common-mode-setup))

@correnson
Copy link
Author

Thanks for those tips!

It would be great to have ocp-indent automatically disabled from tuareg on mll and mly files until a better support for them. I'd share some workaround as soon as I have some.

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

No branches or pull requests

3 participants