简体   繁体   中英

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

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM