From 6a1939553e05c1b58baff86a1d5e28331f8481d2 Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Tue, 7 Jan 2020 16:58:41 +0100 Subject: [PATCH] Added --messages. --- vendors/ligo-utils/simple-utils/cover.sh | 25 +++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/vendors/ligo-utils/simple-utils/cover.sh b/vendors/ligo-utils/simple-utils/cover.sh index b7331dd37..da8f25894 100755 --- a/vendors/ligo-utils/simple-utils/cover.sh +++ b/vendors/ligo-utils/simple-utils/cover.sh @@ -87,6 +87,15 @@ while : ; do no_eq=$1 break ;; + --messages=*) + if test -n "$messages"; then + fatal_error "Repeated option --messages."; fi + messages=$(expr "$1" : "[^=]*=\(.*\)") + ;; + --messages) + no_eq=$1 + break + ;; -h | --help | -help) help=yes ;; @@ -113,6 +122,7 @@ usage () { Usage: $(basename $0) [-h|--help] --par-tokens=.mly --lex-tokens=.mli + --messages=.msg --unlexer= --ext= --dir= @@ -135,6 +145,7 @@ Display control: Mandatory options: --lex-tokens=.mli the lexical tokens --par-tokens=.mly the syntactical tokens + --messages=.msg the complete errors messages --ext=EXT Unix file extension for the generated LIGO files (no starting period) @@ -160,6 +171,9 @@ fi # Checking options +if test -z "$messages"; then + fatal_error "Messages not found (use --messages)."; fi + if test -z "$unlexer"; then 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 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 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." 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 @@ -233,7 +244,7 @@ flags="--table --strict --external-tokens $lex_tokens_base \ # ==================================================================== # Producing erroneous sentences from Menhir's error messages -msg=$parser_base.msg +msg=$messages raw=$parser_base.msg.raw printf "Making $raw from $msg... " menhir --echo-errors $parser_base.msg $flags $mly > $raw 2>/dev/null