Merge branch 'rinderknecht@cover' into 'dev'

cover.sh --messages ....

See merge request ligolang/ligo!312
This commit is contained in:
Rémi Lesenechal 2020-01-07 23:16:00 +00:00
commit 3fecff3a60

View File

@ -87,6 +87,15 @@ while : ; do
no_eq=$1 no_eq=$1
break break
;; ;;
--messages=*)
if test -n "$messages"; then
fatal_error "Repeated option --messages."; fi
messages=$(expr "$1" : "[^=]*=\(.*\)")
;;
--messages)
no_eq=$1
break
;;
-h | --help | -help) -h | --help | -help)
help=yes help=yes
;; ;;
@ -113,6 +122,7 @@ usage () {
Usage: $(basename $0) [-h|--help] Usage: $(basename $0) [-h|--help]
--par-tokens=<par_tokens>.mly --par-tokens=<par_tokens>.mly
--lex-tokens=<lex_tokens>.mli --lex-tokens=<lex_tokens>.mli
--messages=<parser>.msg
--unlexer=<binary> --unlexer=<binary>
--ext=<extension> --ext=<extension>
--dir=<path> --dir=<path>
@ -135,6 +145,7 @@ Display control:
Mandatory options: Mandatory options:
--lex-tokens=<name>.mli the lexical tokens --lex-tokens=<name>.mli the lexical tokens
--par-tokens=<name>.mly the syntactical tokens --par-tokens=<name>.mly the syntactical tokens
--messages=<parser>.msg the complete errors messages
--ext=EXT Unix file extension for the --ext=EXT Unix file extension for the
generated LIGO files generated LIGO files
(no starting period) (no starting period)
@ -160,6 +171,9 @@ fi
# Checking options # Checking options
if test -z "$messages"; then
fatal_error "Messages not found (use --messages)."; fi
if test -z "$unlexer"; then if test -z "$unlexer"; then
fatal_error "Unlexer binary not found (use --unlexer)."; fi fatal_error "Unlexer binary not found (use --unlexer)."; fi
@ -172,6 +186,9 @@ if test -z "$par_tokens"; then
if test -z "$lex_tokens"; then if test -z "$lex_tokens"; then
fatal_error "No lexical tokens specification (use --lex-tokens)."; fi fatal_error "No lexical tokens specification (use --lex-tokens)."; fi
if test ! -e "$messages"; then
fatal_error "Error messages \"$messages\" not found (use messages.sh)."; fi
if test ! -e "$parser"; then if test ! -e "$parser"; then
fatal_error "Parser specification \"$parser\" not found."; fi fatal_error "Parser specification \"$parser\" not found."; fi
@ -218,12 +235,6 @@ if test "$ext_start" != "0"
then fatal_error "LIGO extensions must not start with a period." then fatal_error "LIGO extensions must not start with a period."
fi fi
# Checking the presence of the messages
msg=$parser_base.msg
if test ! -e $msg; then
fatal_error "File $msg not found."; fi
# ==================================================================== # ====================================================================
# Menhir's flags # Menhir's flags
@ -233,7 +244,7 @@ flags="--table --strict --external-tokens $lex_tokens_base \
# ==================================================================== # ====================================================================
# Producing erroneous sentences from Menhir's error messages # Producing erroneous sentences from Menhir's error messages
msg=$parser_base.msg msg=$messages
raw=$parser_base.msg.raw raw=$parser_base.msg.raw
printf "Making $raw from $msg... " printf "Making $raw from $msg... "
menhir --echo-errors $parser_base.msg $flags $mly > $raw 2>/dev/null menhir --echo-errors $parser_base.msg $flags $mly > $raw 2>/dev/null