Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
POTTIER Francois
menhir
Commits
29bd0ce7
Commit
29bd0ce7
authored
Oct 20, 2015
by
POTTIER Francois
Browse files
Added --echo-errors.
parent
050831fd
Changes
5
Hide whitespace changes
Inline
Side-by-side
TODO
View file @
29bd0ce7
* If we keep --on-error-reduce, document it.
* Is it true that the warning "this production is never reduced" is
sound but incomplete? i.e. certain states could be unreachable and
we do not know it (but LRijkstra can tell us).
...
...
@@ -15,29 +13,17 @@
* Error.signal should call error_message?
* Document --list-errors --interpret-error --compile-errors --compare-errors --update-errors
* 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
Should --list-errors also print the sentence in concrete form? (as a comment)
requires knowing the concrete form of every token
document the .messages file format
likely pitfall: if Menhir says, "foo" is not a valid nonterminal symbol,
then look for a blank line, higher up, between two sentences.
explain the meaning of the spurious reductions warning
explain the meaning of the spurious reductions warning
(sometimes missing!)
--compile-errors could warn about messages wider than 80 columns
could also warn statically about out-of-range $i?
document the workflow
collect performance data
correlate with star size and alphabet size, etc.
create separate graphs for 3 modes: --lalr, pager, --canonical
remove lr.csv when done
Could --interpret-error obey --trace?
Auto-comment: show the shape of the stack (invariant).
Idea: allow the user to make assertions about
the known shape of the stack,
the known lhs of all items in the state,
the possible continuations...?
Idea: investigate the use of placeholders (in the message)
that could be filled with dynamic information!
* Clear up the Windows path confusion. Can we use "/" in Menhir's
source code and in the Makefiles? Does OPAM work on Windows?
...
...
src/interpret.ml
View file @
29bd0ce7
(* This module is in charge of handling the [--interpret] option,
if it is present. *)
module
I
=
Invariant
(* artificial dependency; ensures that [Invariant] runs first *)
(* --------------------------------------------------------------------------- *)
...
...
@@ -739,3 +736,24 @@ let () =
exit
0
)
(* --------------------------------------------------------------------------- *)
(* If [--echo-errors <filename>] is set, echo the error sentences found in file
[filename]. Do not echo the error messages or the comments. *)
let
()
=
Settings
.
echo_errors
|>
Option
.
iter
(
fun
filename
->
(* Read the file. *)
let
runs
:
run
or_comment
list
=
read_messages
filename
in
(* Echo. *)
List
.
iter
(
or_comment_iter
(
fun
run
->
let
(
sentences
:
located_sentence
or_comment
list
)
,
_
,
_
=
run
in
List
.
iter
(
or_comment_iter
(
fun
(
_
,
sentence
)
->
print_string
(
print_sentence
sentence
)
))
sentences
))
runs
)
src/sentenceParserAux.ml
View file @
29bd0ce7
...
...
@@ -16,6 +16,12 @@ type 'a or_comment =
|
Thing
of
'
a
|
Comment
of
comment
let
or_comment_iter
f
=
function
|
Thing
s
->
f
s
|
Comment
_
->
()
let
or_comment_map
f
=
function
|
Thing
s
->
Thing
(
f
s
)
...
...
src/settings.ml
View file @
29bd0ce7
...
...
@@ -191,6 +191,12 @@ let update_errors =
let
set_update_errors
filename
=
update_errors
:=
Some
filename
let
echo_errors
=
ref
None
let
set_echo_errors
filename
=
echo_errors
:=
Some
filename
let
on_error_reduce_symbols
=
ref
StringSet
.
empty
...
...
@@ -208,6 +214,7 @@ let options = Arg.align [
"--coq-no-actions"
,
Arg
.
Set
coq_no_actions
,
" Ignore semantic actions in the Coq output"
;
"--depend"
,
Arg
.
Unit
(
fun
()
->
depend
:=
OMPostprocess
)
,
" Invoke ocamldep and display dependencies"
;
"--dump"
,
Arg
.
Set
dump
,
" Describe the automaton in <basename>.automaton"
;
"--echo-errors"
,
Arg
.
String
set_echo_errors
,
"<filename> Echo the sentences in a .messages file"
;
"--error-recovery"
,
Arg
.
Set
recovery
,
" (no longer supported)"
;
"--explain"
,
Arg
.
Set
explain
,
" Explain conflicts in <basename>.conflicts"
;
"--external-tokens"
,
Arg
.
String
codeonly
,
"<module> Import token type definition from <module>"
;
...
...
@@ -465,6 +472,9 @@ let compare_errors =
let
update_errors
=
!
update_errors
let
echo_errors
=
!
echo_errors
let
on_error_reduce
nt
=
StringSet
.
mem
nt
!
on_error_reduce_symbols
src/settings.mli
View file @
29bd0ce7
...
...
@@ -202,6 +202,12 @@ val compare_errors: (string * string) option
val
update_errors
:
string
option
(* This flag causes Menhir to read the error message descriptions stored in
[filename] and echo the error sentences (and nothing else; no messages,
no comments). *)
val
echo_errors
:
string
option
(* This function takes a non-terminal symbol and tells whether it appears
in a command line switch of the form [--on-error-reduce]. This switch
indicates that extra reductions are desired when an error is detected. *)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment