package lrgrep

  1. Overview
  2. Docs
Analyse the stack of a Menhir-generated LR parser using regular expressions

Install

dune-project
 Dependency

Authors

Maintainers

Sources

lrgrep-0.3.tbz
sha256=84a1874d0c063da371e19c84243aac7c40bfcb9aaf204251e0eb0d1f077f2cde
sha512=5a16ff42a196fd741bc64a1bdd45b4dca0098633e73aa665829a44625ec15382891c3643fa210dbe3704336eab095d4024e093e37ae5313810f6754de6119d55

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.