Module Private.Parser_automaton

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 =
| Single(*

Parse a single s-expression

*)
| Many(*

Parse a list of s-expressions

*)
| Eager of {
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.

*)
mutable no_sexp_is_error : bool;
}
(*

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

*)
type state_cst
type ('u, 's) kind =
| Positions : (Positions.Builder.t, unit) kind
| Sexp : (unit, Parsexp__Automaton_stack.t) kind
| Sexp_with_positions : (Positions.Builder.tParsexp__Automaton_stack.t) kind
| Cst : (state_cstParsexp__Automaton_stack.For_cst.t) kind
val new_state : ?initial_pos:Positions.pos -> ('u's) mode -> ('u's) kind -> ('u's) state
val reset : ?pos:Positions.pos -> (__) state -> unit
val positions : (Positions.Builder.t_) state -> Positions.t
val mode : ('u's) state -> ('u's) mode
val offset : (__) state -> int

Number of characters fed to the parser

val line : (__) state -> int

Position in the text

val column : (__) state -> int
val has_unclosed_paren : ('u's) state -> bool

Whether there are some unclosed parentheses

val set_error_state : (__) state -> unit
val feed : ('u's) state -> char -> 's -> 's
val feed_eoi : ('u's) state -> 's -> 's