What are these comment-like lines in ocamllex generated .ml?

31 Views Asked by At

When I generate an .ml file with ocamllex it has a bunch of lines like:

# 21 "lib/myproj/example.ml"

These look like comments, except AFAIK comments in OCaml are like (* this is a comment *)

VS Code doesn't seem to treat them as comments either.

What syntax is this? What do they do?

1

There are 1 best solutions below

0
Anentropic On

These are "line number directives":

https://ocaml.org/manual/lex.html#sss:lex-linedir

Preprocessors that generate OCaml source code can insert line number directives in their output so that error messages produced by the compiler contain line numbers and file names referring to the source file before preprocessing, instead of after preprocessing.