Module Jsont.Meta

Abstract syntax tree node metadata.

This type keeps information about source text locations and whitespace.

type t

The type for node metadata.

val make : ?ws_before:string -> ?ws_after:string -> Textloc.t -> t

make textloc ~ws_before ~ws_after is metadata with text location textloc whitespace ws_before before the node and ws_after after the node. Both default to "".

val none : t

none is metadata for when there is none. Its textloc is Textloc.none and its whitespace is empty.

val is_none : t -> bool

is_none m is true iff m is none.

val textloc : t -> Textloc.t

textloc m is the text location of m.

val ws_before : t -> string

ws_before m is source whitespace before the node.

val ws_after : t -> string

ws_after m is source whitespace after the node.

val with_textloc : t -> Textloc.t -> t

with_textloc m l is m with text location l

val clear_ws : t -> t

clear_ws m is m with ws_before and ws_after set to "".

val clear_textloc : t -> t

clear_textloc m is m with textloc set to Textloc.none.

val copy_ws : t -> dst:t -> t

copy_ws src ~dst copies ws_before and ws_after of src to dst.