Fixed builds of ParserMain.exe. Fixed parser (code_inj).

This commit is contained in:
Christian Rinderknecht 2020-06-23 00:37:57 +02:00
parent e42381fb84
commit c379d1078e
5 changed files with 44 additions and 83 deletions

View File

@ -56,7 +56,6 @@ type c_Some = Region.t
type arrow = Region.t (* "->" *) type arrow = Region.t (* "->" *)
type cons = Region.t (* "::" *) type cons = Region.t (* "::" *)
type percent = Region.t (* "%" *)
type cat = Region.t (* "^" *) type cat = Region.t (* "^" *)
type append = Region.t (* "@" *) type append = Region.t (* "@" *)
type dot = Region.t (* "." *) type dot = Region.t (* "." *)

View File

@ -586,15 +586,10 @@ core_expr:
| par(expr) { EPar $1 } | par(expr) { EPar $1 }
| par(annot_expr) { EAnnot $1 } | par(annot_expr) { EAnnot $1 }
code_insert: code_inj:
"[" "%" Constr expr "]" { "<lang>" expr "]" {
let region = cover $1 $5 in let region = cover $1.region $3
let value = { and value = {language=$1; code=$2; rbracket=$3}
lbracket =$1;
percent =$2;
language =$3;
code =$4;
rbracket =$5}
in {region; value} } in {region; value} }
annot_expr: annot_expr:
@ -709,9 +704,3 @@ let_in_sequence:
seq_expr: seq_expr:
disj_expr_level | if_then_else (seq_expr) { $1 } disj_expr_level | if_then_else (seq_expr) { $1 }
code_inj:
"<lang>" expr "]" {
let region = cover $1.region $3
and value = {language=$1; code=$2; rbracket=$3}
in {region; value} }

View File

@ -53,7 +53,7 @@
(executable (executable
(name ParserMain) (name ParserMain)
(libraries parser_cameligo) (libraries parser_cameligo)
(modules ParserMain) (modules ParserMain Parser_msg)
(preprocess (preprocess
(pps bisect_ppx --conditional)) (pps bisect_ppx --conditional))
(flags (:standard -open Simple_utils -open Parser_shared -open Parser_cameligo))) (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) (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))) (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 ;; Build of all the LIGO source file that cover all error states
(rule (rule
@ -74,27 +87,6 @@
;; Error messages ;; 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 (rule
(targets error.messages) (targets error.messages)
(mode (promote (until-clean) (only *))) (mode (promote (until-clean) (only *)))

View File

@ -66,6 +66,19 @@
(deps (:script_messages ../../../../vendors/ligo-utils/simple-utils/messages.sh) Parser.mly LexToken.mli ParToken.mly) (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))) (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 ;; Build of all the LIGO source file that cover all error states
(rule (rule
@ -75,27 +88,6 @@
;; Error messages ;; 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 (rule
(targets error.messages) (targets error.messages)
(mode (promote (until-clean) (only *))) (mode (promote (until-clean) (only *)))
@ -155,8 +147,6 @@
) )
) )
(rule (rule
(targets ParErr.ml) (targets ParErr.ml)
(mode (promote (until-clean) (only *))) (mode (promote (until-clean) (only *)))

View File

@ -65,6 +65,19 @@
(deps (:script_messages ../../../../vendors/ligo-utils/simple-utils/messages.sh) Parser.mly LexToken.mli ParToken.mly) (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 ))) (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 ;; Build of all the LIGO source file that cover all error states
(rule (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) (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 ))) (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 (rule
(targets error.messages) (targets error.messages)
(mode (promote (until-clean) (only *))) (mode (promote (until-clean) (only *)))