Cmarkit.Meta
Node metadata.
Holds text locations and custom, client-defined metadata.
val none : t
none
is metadata for when there is none, its textloc
is Textloc.none
.
make textloc
is metadata with text location textloc
(defaults to Textloc.none
) and a fresh identifier (see id
).
id m
is an identifier for the metadata. Depending on how you process the abstract syntax tree this may become non-unique but the metadata values in an abstract syntax tree returned by Doc.of_string
with locs:true
have distinct identifiers.
textloc m
is the source location of the syntactic construct m
is attached to.
with_textloc ~keep_id m textloc
is metadata m
with text location textloc
and a fresh id, unless keep_id
is true
.
val is_none : t -> bool
is_none m
is equal none m
.
Warning. Operating on custom metadata never changes id
. It is possible for two meta values to have the same id and different metadata.
val key : unit -> 'a key
key ()
is a new metadata key.