Up

module Merlin_parser

: sig
#
module Values : module type of Raw_parser_values
#
type t

Initialization

#
type state = Raw_parser.state
#
val implementation : state
#
val interface : state
#
val from : state -> Std.Lexing.position * Raw_parser.token * Std.Lexing.position -> t

Manipulation

#
val feed : Std.Lexing.position * Raw_parser.token * Std.Lexing.position -> t -> [
| `Accept of Raw_parser.symbol
| `Step of t
| `Reject of t
]
#
val get_location : ?pop:int -> t -> Location.t
#
val get_guide : ?pop:int -> t -> Std.Lexing.position
#
val get_lr0_state : t -> int
#
val get_lr1_state : t -> int
#
val get_lr0_states : t -> int Std.List.Lazy.t
#
val get_lr1_states : t -> int Std.List.Lazy.t
#
val last_token : t -> Raw_parser.token Location.loc
#
val pop : t -> t option
#
type termination
#
val termination : termination
#
val recover : ?endp:Std.Lexing.position -> termination -> t -> (termination * (int * t Location.loc)) option
#
type frame

Stack inspection

#
val stack : t -> frame
#
module Frame : sig
#
val value : frame -> Raw_parser.symbol
#
val location : ?pop:int -> frame -> Location.t
#
val eq : frame -> frame -> bool
#
val next : ?n:int -> frame -> frame option
#
val lr1_state : frame -> int
#
val lr0_state : frame -> int
end
#
val dump : t -> Std.json
#
val dump_frame : frame -> Std.json
#
val find_marker : t -> frame option

find_marker return the first frame that might be unsafe for the parser

#
val has_marker : ?diff:t * bool -> t -> frame -> bool

has_marker ?diff t f returns true iff f is still in t stack. If provided, diff is used to speed-up the search (amortized constant time), assuming that diff is the same parser as t with one more or one less token fed.

#
val root_frame : frame -> frame -> frame

Raise Not_found if no frame match

#
val unroll_stack : from:frame -> root:frame -> frame list
end