package parsexp

  1. Overview
  2. Docs

Concrete syntax tree of s-expressions

This module exposes a type that describe the full contents of a source file containing s-expressions.

One can use this type to do low-level rewriting of s-expression files.

type t =
  1. | Atom of {
    1. loc : Positions.range;
    2. atom : string;
      (*

      Source syntax of atom. The parser only fills this for atoms that are quoted in the source, but it makes sense for unquoted atoms too (to ensure they get printed unquoted).

      *)
    3. unescaped : string option;
    }
  2. | List of {
    1. loc : Positions.range;
    2. elements : t_or_comment list;
    }
and t_or_comment =
  1. | Sexp of t
  2. | Comment of comment
and comment =
  1. | Plain_comment of {
    1. loc : Positions.range;
    2. comment : string;
    }
    (*

    Line or block comment

    *)
  2. | Sexp_comment of {
    1. hash_semi_pos : Positions.pos;
    2. comments : comment list;
    3. sexp : t;
    }
val sexp_of_t : t -> Sexplib0.Sexp.t
val sexp_of_t_or_comment : t_or_comment -> Sexplib0.Sexp.t
val sexp_of_comment : comment -> Sexplib0.Sexp.t
val compare : t -> t -> int
val compare_t_or_comment : t_or_comment -> t_or_comment -> int
val compare_comment : comment -> comment -> int
module Forget : sig ... end