Commit 05faa567 authored by POTTIER Francois's avatar POTTIER Francois

New function [error_state].

parent 5071feb7
......@@ -718,6 +718,13 @@ module Make (T : TABLE) = struct
env1.stack == env2.stack &&
number env1.current = number env2.current
let error_state checkpoint =
match checkpoint with
| HandlingError env ->
number env.current
| _ ->
invalid_arg "error_state expects HandlingError"
(* ------------------------------------------------------------------------ *)
(* Access to the position of the lookahead token. *)
......
......@@ -267,6 +267,15 @@ module type INCREMENTAL_ENGINE = sig
val top: 'a env -> element option
(* [error_state checkpoint] requires [checkpoint] to be of the form
[HandlingError env]. Out of [env], it extracts the automaton's current
state, and returns this state, as an integer number. (This works even if
the automaton's stack is empty, in which case the current state is an
initial state.) This number can then be used as an argument to a
[message] function that was generated by [menhir --compile-errors]. *)
val error_state: 'a checkpoint -> int
(* [equal env1 env2] tells whether the parser configurations [env1] and
[env2] are equal in the sense that the automaton's current state is
the same in [env1] and [env2] and the stack is *physically* the same
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment