package lrgrep

  1. Overview
  2. Docs
Detailed error messages for Menhir-generated parsers

Install

dune-project
 Dependency

Authors

Maintainers

Sources

lrgrep-0.9.tbz
sha256=e53de12e4c5cbe6bca00643593266b4f9fa2e3f6a138195eeff7a4329f5c1c75
sha512=7fd7c4d11506fea7cc11c9bbf5aea9142d905643553c0c90e1bb16b794106b0c14a266acf89ae91b6929008dc0ba6515f788642873e2e4ba6c3d49bd45d25127

doc/utils/Utils/Code_printer/index.html

Module Utils.Code_printerSource

Module for printing text with line tracking and location output. This is useful for compilers and preprocessors that need to generate code that refers to locations in external files. The module allows tracking of code positions and can output directives indicating where the code was originally located in the source files.

Sourcetype t

Opaque type representing the state of the code printer.

Sourceval create : filename:string -> ?line:int -> (string -> unit) -> t

create ~filename ?line output_function creates a new code printer. filename is the name of the output file. line is the line number at which output starts to be appended (defaults to 1). output_function is called to append a string to the output file.

Sourceval print : ?loc:Stdlib.Lexing.position -> t -> string -> unit

print t ?loc text appends text to t. If loc is provided, a directive # <loc.start_line> <loc.loc_file> is emitted to indicate that text was extracted from loc. If loc is not provided, a directive # <output filename> <output current line number> is emitted if necessary to indicate that text is code specific to the printed file.

Sourceval fmt : ?loc:Stdlib.Lexing.position -> t -> ('a, unit, string, unit) Stdlib.format4 -> 'a

fmt is a variant of print that supports Printf-like format strings.