package parsexp

  1. Overview
  2. Docs

Parser automaton

Warning: the API of this module is not fixed and might change! Use Sexp_parsing for the stable version.

type ('user_state, 'stack) state

Internal state of the automaton

type ('u, 's) mode =
  1. | Single
    (*

    Parse a single s-expression

    *)
  2. | Many
    (*

    Parse a list of s-expressions

    *)
  3. | Eager of {
    1. got_sexp : ('u, 's) state -> 's -> 's;
      (*

      Whether to consider no s-expression in the input as an error or not.

      The mutability is used in Parsexp.Eager*.Lexbuf_consumer.

      *)
    2. mutable no_sexp_is_error : Base.bool;
    }
    (*

    Gives back s-expressions as soon as they are found.

    *)
type stack
val empty_stack : stack
type state_cst
type stack_cst
val empty_stack_cst : stack_cst
type ('u, 's) kind =
  1. | Positions : (Positions.Builder.t, Base.unit) kind
  2. | Sexp : (Base.unit, stack) kind
  3. | Sexp_with_positions : (Positions.Builder.t, stack) kind
  4. | Cst : (state_cst, stack_cst) kind
val new_state : ?initial_pos:Positions.pos -> ('u, 's) mode -> ('u, 's) kind -> ('u, 's) state
val reset : ?pos:Positions.pos -> (_, _) state -> Base.unit
val positions : (Positions.Builder.t, _) state -> Positions.t
val mode : ('u, 's) state -> ('u, 's) mode
val offset : (_, _) state -> Base.int

Number of characters fed to the parser

val line : (_, _) state -> Base.int

Position in the text

val column : (_, _) state -> Base.int
val has_unclosed_paren : ('u, 's) state -> Base.bool

Whether there are some unclosed parentheses

val set_error_state : (_, _) state -> Base.unit
val sexp_of_stack : stack -> Base.Sexp.t
val sexps_of_stack : stack -> Base.Sexp.t Base.list
val sexps_cst_of_stack : stack_cst -> Cst.t_or_comment Base.list
module Error : sig ... end
exception Parse_error of Error.t
val feed : ('u, 's) state -> Base.char -> 's -> 's
val feed_eoi : ('u, 's) state -> 's -> 's
OCaml

Innovation. Community. Security.