Module Parsexp__.Parser_automaton

Parser automaton

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

include module type of Parsexp__.Parser_automaton_internal.Public
type ('user_state, 'stack) state

Internal state of the automaton

type ('u, 's) mode =
| Single

(** Parse a single s-expression *)

| Many

(** Parse a list of s-expressions *)

| Eager of {
got_sexp : ('u'sstate ‑> '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. *)

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 =
| Positions : (Parsexp.Positions.Builder.tBase.unitkind
| Sexp : (Base.unitstackkind
| Sexp_with_positions : (Parsexp.Positions.Builder.tstackkind
| Cst : (state_cststack_cstkind
val new_state : ?⁠initial_pos:Parsexp.Positions.pos ‑> ('u'smode ‑> ('u'skind ‑> ('u'sstate
val reset : ?⁠pos:Parsexp.Positions.pos ‑> (__state ‑> Base.unit
val mode : ('u'sstate ‑> ('u'smode
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'sstate ‑> 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 ‑> Parsexp.Cst.t_or_comment Base.list
exception Parse_error of Error.t
val feed : ('u'sstate ‑> Base.char ‑> 's ‑> 's
val feed_eoi : ('u'sstate ‑> 's ‑> 's