From c379d1078e0d4627b3351acf08e3be8be0d1a62d Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Tue, 23 Jun 2020 00:37:57 +0200 Subject: [PATCH] Fixed builds of ParserMain.exe. Fixed parser (code_inj). --- src/passes/01-parser/cameligo/AST.ml | 1 - src/passes/01-parser/cameligo/Parser.mly | 19 +++---------- src/passes/01-parser/cameligo/dune | 36 +++++++++--------------- src/passes/01-parser/pascaligo/dune | 36 +++++++++--------------- src/passes/01-parser/reasonligo/dune | 35 +++++++++-------------- 5 files changed, 44 insertions(+), 83 deletions(-) diff --git a/src/passes/01-parser/cameligo/AST.ml b/src/passes/01-parser/cameligo/AST.ml index 76654aac3..a6002e729 100644 --- a/src/passes/01-parser/cameligo/AST.ml +++ b/src/passes/01-parser/cameligo/AST.ml @@ -56,7 +56,6 @@ type c_Some = Region.t type arrow = Region.t (* "->" *) type cons = Region.t (* "::" *) -type percent = Region.t (* "%" *) type cat = Region.t (* "^" *) type append = Region.t (* "@" *) type dot = Region.t (* "." *) diff --git a/src/passes/01-parser/cameligo/Parser.mly b/src/passes/01-parser/cameligo/Parser.mly index 6c0e0f2da..85ad87f3c 100644 --- a/src/passes/01-parser/cameligo/Parser.mly +++ b/src/passes/01-parser/cameligo/Parser.mly @@ -586,15 +586,10 @@ core_expr: | par(expr) { EPar $1 } | par(annot_expr) { EAnnot $1 } -code_insert: - "[" "%" Constr expr "]" { - let region = cover $1 $5 in - let value = { - lbracket =$1; - percent =$2; - language =$3; - code =$4; - rbracket =$5} +code_inj: + "" expr "]" { + let region = cover $1.region $3 + and value = {language=$1; code=$2; rbracket=$3} in {region; value} } annot_expr: @@ -709,9 +704,3 @@ let_in_sequence: seq_expr: disj_expr_level | if_then_else (seq_expr) { $1 } - -code_inj: - "" expr "]" { - let region = cover $1.region $3 - and value = {language=$1; code=$2; rbracket=$3} - in {region; value} } diff --git a/src/passes/01-parser/cameligo/dune b/src/passes/01-parser/cameligo/dune index ff5896de8..6c5257688 100644 --- a/src/passes/01-parser/cameligo/dune +++ b/src/passes/01-parser/cameligo/dune @@ -53,7 +53,7 @@ (executable (name ParserMain) (libraries parser_cameligo) - (modules ParserMain) + (modules ParserMain Parser_msg) (preprocess (pps bisect_ppx --conditional)) (flags (:standard -open Simple_utils -open Parser_shared -open Parser_cameligo))) @@ -65,6 +65,19 @@ (deps (:script_messages ../../../../vendors/ligo-utils/simple-utils/messages.sh) Parser.mly LexToken.mli ParToken.mly) (action (run %{script_messages} --lex-tokens=LexToken.mli --par-tokens=ParToken.mly Parser.mly))) +(rule + (targets Parser_msg.ml) + (deps Parser.mly ParToken.mly Parser.msg) + (action + (with-stdout-to %{targets} + (bash + "menhir \ + --compile-errors Parser.msg \ + --external-tokens LexToken \ + --base Parser \ + ParToken.mly \ + Parser.mly")))) + ;; Build of all the LIGO source file that cover all error states (rule @@ -74,27 +87,6 @@ ;; Error messages -;; Generate error messages from scratch -; (rule -; (targets error.messages) -; (deps Parser.mly ParToken.mly error.messages.checked-in) -; (action -; (with-stdout-to %{targets} -; (bash -; "menhir \ -; --unused-tokens \ -; --list-errors \ -; --table \ -; --strict \ -; --external-tokens LexToken.mli \ -; --base Parser.mly \ -; ParToken.mly \ -; Parser.mly -; " -; ) -; )) -; ) - (rule (targets error.messages) (mode (promote (until-clean) (only *))) diff --git a/src/passes/01-parser/pascaligo/dune b/src/passes/01-parser/pascaligo/dune index 5b2f099ca..855fb0da9 100644 --- a/src/passes/01-parser/pascaligo/dune +++ b/src/passes/01-parser/pascaligo/dune @@ -66,6 +66,19 @@ (deps (:script_messages ../../../../vendors/ligo-utils/simple-utils/messages.sh) Parser.mly LexToken.mli ParToken.mly) (action (run %{script_messages} --lex-tokens=LexToken.mli --par-tokens=ParToken.mly Parser.mly))) +(rule + (targets Parser_msg.ml) + (deps Parser.mly ParToken.mly Parser.msg) + (action + (with-stdout-to %{targets} + (bash + "menhir \ + --compile-errors Parser.msg \ + --external-tokens LexToken \ + --base Parser \ + ParToken.mly \ + Parser.mly")))) + ;; Build of all the LIGO source file that cover all error states (rule @@ -75,27 +88,6 @@ ;; Error messages -;; Generate error messages from scratch -; (rule -; (targets error.messages) -; (deps Parser.mly ParToken.mly error.messages.checked-in) -; (action -; (with-stdout-to %{targets} -; (bash -; "menhir \ -; --unused-tokens \ -; --list-errors \ -; --table \ -; --strict \ -; --external-tokens LexToken.mli \ -; --base Parser.mly \ -; ParToken.mly \ -; Parser.mly -; " -; ) -; )) -; ) - (rule (targets error.messages) (mode (promote (until-clean) (only *))) @@ -155,8 +147,6 @@ ) ) - - (rule (targets ParErr.ml) (mode (promote (until-clean) (only *))) diff --git a/src/passes/01-parser/reasonligo/dune b/src/passes/01-parser/reasonligo/dune index f41445b7d..38170a812 100644 --- a/src/passes/01-parser/reasonligo/dune +++ b/src/passes/01-parser/reasonligo/dune @@ -65,6 +65,19 @@ (deps (:script_messages ../../../../vendors/ligo-utils/simple-utils/messages.sh) Parser.mly LexToken.mli ParToken.mly) (action (run %{script_messages} --lex-tokens=LexToken.mli --par-tokens=ParToken.mly Parser.mly ))) +(rule + (targets Parser_msg.ml) + (deps Parser.mly ParToken.mly Parser.msg) + (action + (with-stdout-to %{targets} + (bash + "menhir \ + --compile-errors Parser.msg \ + --external-tokens LexToken \ + --base Parser \ + ParToken.mly \ + Parser.mly")))) + ;; Build of all the LIGO source file that cover all error states (rule @@ -72,28 +85,6 @@ (deps (:script_cover ../../../../vendors/ligo-utils/simple-utils/cover.sh) Parser.mly LexToken.mli ParToken.mly Parser.msg Unlexer.exe) (action (run %{script_cover} --lex-tokens=LexToken.mli --par-tokens=ParToken.mly --ext=religo --unlexer=./Unlexer.exe --messages=Parser.msg --dir=. --concatenate Parser.mly ))) -;; Error messages -;; Generate error messages from scratch -; (rule -; (targets error.messages) -; (deps Parser.mly ParToken.mly error.messages.checked-in) -; (action -; (with-stdout-to %{targets} -; (bash -; "menhir \ -; --unused-tokens \ -; --list-errors \ -; --table \ -; --strict \ -; --external-tokens LexToken.mli \ -; --base Parser.mly \ -; ParToken.mly \ -; Parser.mly -; " -; ) -; )) -; ) - (rule (targets error.messages) (mode (promote (until-clean) (only *)))