package atdgen

  1. Overview
  2. Docs

Source file ag_indent.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

(*
  Atd_indent extended with annnotations allowing some postprocessing.
*)

type t =
    [
    | `Line of string        (* single line (not indented) *)
    | `Block of t list       (* indented sequence *)
    | `Inline of t list      (* in-line sequence (not indented) *)
    | `Annot of (string * t) (* arbitrary annotation *)
    ]

let rec strip : t -> Atd_indent.t = function
    `Line _ as x -> x
  | `Block l -> `Block (List.map strip l)
  | `Inline l -> `Inline (List.map strip l)
  | `Annot (_, x) -> strip x