Page
Library
Module
Module type
Parameter
Class
Class type
Source
Loc.TxtSourceWhen the symbol you want to decorate is not already an argument in a record, it may be convenient to use this type as a standard way to decorate a symbol with a position.
Using Loc.t or 'a Loc.Txt.t are two different styles to decorate a symbol, you may choose one depending on the context.
An example using Loc.t:
type t =
| T of { loc : Loc.t ; a : A.t; b : B.t; ... }An example using 'a Loc.Txt.t:
type t = A.t Loc.Txt.t listIt is possible to ignore the locations by setting Loc.equal_ignores_locs to true.
By default locations are not shown. To include the locations set Loc.include_sexp_of_locs to true.
To be called in the right hand side of a Menhir rule, using the $loc special keyword provided by Menhir. For example:
ident:
| ident=IDENT { Loc.Txt.create $loc ident }
;Build a new node where the symbol has been mapped, keeping the original location.