Skip to content

Bug: crash when backslash is in mld file #2679

@emillon

Description

@emillon

Hi,
When a mld file contains a backslash, ocamlformat crashes with a lexing error.

For example, add {m \Gamma} to test/passing/tests/doc.mld and it will crash.

The error is:

ocamlformat: ignoring "doc.mld" (syntax error)
File "doc.mld", line 166, characters 3-4:
166 | {m \Gamma}
         ^
Error: Illegal character (\\)

This is the error from parser-extended/lexer.mll, which is unexpected because this shouldn't be lexed as ocaml code.
(the same comment in a docstring works)

Thanks

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions