package dune

  1. Overview
  2. Docs
include module type of struct include Usexp end with module Loc := Usexp.Loc
type syntax = Usexp.syntax =
  1. | Jbuild
  2. | Dune
module Atom = Usexp.Atom
module Template = Usexp.Template
type t = Usexp.t =
  1. | Atom of Atom.t
  2. | Quoted_string of string
  3. | List of t list
  4. | Template of Template.t

The S-expression type

val atom : string -> t

atom s convert the string s to an Atom.

  • raises Invalid_argument

    if s does not satisfy Atom.is_valid s.

val atom_or_quoted_string : string -> t
val unsafe_atom_of_string : string -> t
val to_string : t -> syntax:syntax -> string

Serialize a S-expression

val pp : syntax -> Format.formatter -> t -> unit

Serialize a S-expression using indentation to improve readability

val pp_quoted : Format.formatter -> t -> unit

Serialization that never fails because it quotes atoms when necessary TODO remove this once we have a proper sexp type

val pp_split_strings : Format.formatter -> t -> unit

Same as pp ~syntax:Dune, but split long strings. The formatter must have been prepared with prepare_formatter.

val prepare_formatter : Format.formatter -> unit

Prepare a formatter for pp_split_strings. Additionaly the formatter escape newlines when the tags "makefile-action" or "makefile-stuff" are active.

module Ast = Usexp.Ast

Abstract syntax tree

val add_loc : t -> loc:Usexp.Loc.t -> Ast.t
module Parse_error = Usexp.Parse_error
exception Parse_error of Parse_error.t

Exception raised in case of a parsing error

module Lexer = Usexp.Lexer
module Parser = Usexp.Parser
val parse_string : fname:string -> mode:'a Parser.Mode.t -> ?lexer:Lexer.t -> string -> 'a
module type Combinators = sig ... end
module To_sexp : sig ... end
module Loc = Usexp.Loc
module Of_sexp : sig ... end
module type Sexpable = sig ... end
OCaml

Innovation. Community. Security.