Commit 56e3805d authored by POTTIER Francois's avatar POTTIER Francois

--interpret-error now obeys --trace.

parent 7c8c5a62
......@@ -18,7 +18,7 @@
expansion of the parameterized non-terminals.)
This would allow some simplifications in CompCert's grammar.
* Document --list-errors --interpret-error --compile-errors --compare-errors --update-errors --echo-errors --on-error-reduce
* Document --list-errors --interpret-error --compile-errors --compare-errors --update-errors --echo-errors %on_error_reduce
explain that any production that contains [error] is ignored by --list-errors
document the .messages file format
likely pitfall: if Menhir says, "foo" is not a valid nonterminal symbol,
......@@ -29,8 +29,7 @@
and should remove any spaces in the names!
could also warn statically about out-of-range $i?
document the workflow
remove lr.csv when done
Could --interpret-error obey --trace?
--interpret-error obeys --trace
* Clear up the Windows path confusion. Can we use "/" in Menhir's
source code and in the Makefiles? Does OPAM work on Windows?
......
......@@ -1141,7 +1141,7 @@ let fail msg =
let validate nt s' w : ReferenceInterpreter.target =
let open ReferenceInterpreter in
match
check_error_path nt (W.elements w)
check_error_path false nt (W.elements w)
with
| OInputReadPastEnd ->
fail "input was read past its end"
......
......@@ -206,10 +206,10 @@ let interpret ((_, toks) as sentence) : unit =
(* [interpret_error_aux] interprets a sentence, expecting it to end in an
error. Failure or success is reported via two continuations. *)
let interpret_error_aux poss ((_, terminals) as sentence) fail succeed =
let interpret_error_aux log poss ((_, terminals) as sentence) fail succeed =
let nt = start poss sentence in
let open ReferenceInterpreter in
match check_error_path nt terminals with
match check_error_path log nt terminals with
| OInputReadPastEnd ->
fail "no syntax error occurs."
| OInputNotFullyConsumed ->
......@@ -329,7 +329,7 @@ let succeed nt terminals target =
exit 0
let interpret_error sentence =
interpret_error_aux [] sentence fail succeed
interpret_error_aux Settings.trace [] sentence fail succeed
(* --------------------------------------------------------------------------- *)
......@@ -342,7 +342,7 @@ let target_sentence
: located_sentence -> maybe_targeted_sentence =
fun (poss, sentence) ->
(poss, sentence),
interpret_error_aux poss sentence
interpret_error_aux false poss sentence
(* failure: *)
(fun msg ->
signal poss
......
......@@ -261,14 +261,14 @@ type check_error_path_outcome =
LR automaton. *)
| OK of target
let check_error_path nt input =
let check_error_path log nt input =
(* Instantiate the LR engine. *)
let module E =
MenhirLib.Engine.Make (struct
include T
let log = false
let log = log
end)
in
......
......@@ -47,6 +47,7 @@ type check_error_path_outcome =
| OK of target
val check_error_path:
bool -> (* --trace *)
Nonterminal.t -> (* initial non-terminal symbol *)
Terminal.t list -> (* input *)
check_error_path_outcome
......
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