Small refactoring.

This commit is contained in:
Christian Rinderknecht 2019-03-07 12:24:57 +01:00
parent c0f541a803
commit ee8ff6ce41
No known key found for this signature in database
GPG Key ID: 9446816CFD267040
3 changed files with 501 additions and 506 deletions

975
AST.ml

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,8 @@
%{
(* START HEADER *)
[@@@warning "-42"]
open Region
open AST
@ -288,7 +290,7 @@ const_decl:
var_decl:
Var var COLON type_expr ASGNMNT expr {
let region = cover $1 (expr_to_region $6) in
let value = {
let value = {
kwd_var = $1;
name = $2;
colon = $3;

28
dune
View File

@ -4,24 +4,14 @@
(menhir
(merge_into Parser)
(modules ParToken Parser)
(flags -la 1 --explain --external-tokens LexToken)
)
(flags -la 1 --explain --external-tokens LexToken))
(executables
(names LexerMain ParserMain)
(public_names ligo-lexer ligo-parser)
(package ligo-parser)
(modules_without_implementation
Error
)
(libraries
hex
zarith
getopt
uutf
str
)
)
(modules_without_implementation Error)
(libraries getopt hex str uutf zarith))
;; Les deux directives (rule) qui suivent sont pour le dev local.
;; Il suffit de faire "dune build Parser.exe" pour avoir un Parser.exe dans le dossier.
@ -30,15 +20,13 @@
(targets Parser.exe)
(deps ParserMain.exe)
(action (copy ParserMain.exe Parser.exe))
(mode promote-until-clean)
)
(mode promote-until-clean))
(rule
(targets Lexer.exe)
(deps LexerMain.exe)
(action (copy LexerMain.exe Lexer.exe))
(mode promote-until-clean)
)
(mode promote-until-clean))
(rule
(targets .git_main_dir)
@ -60,12 +48,10 @@
(targets Version.gitHEAD)
(deps .gitHEAD)
;; TODO: re-compute .git_main_dir, just in case (since it does not have a dependency on .git)
(action (run "sh" "-c" "if git symbolic-ref HEAD >/dev/null 2>&1; then ln -s \"$(cat .git_main_dir)/$(git symbolic-ref HEAD)\" Version.gitHEAD; else ln -s \"$(cat .git_worktree_dir)/HEAD\" Version.gitHEAD; fi"))
)
(action (run "sh" "-c" "if git symbolic-ref HEAD >/dev/null 2>&1; then ln -s \"$(cat .git_main_dir)/$(git symbolic-ref HEAD)\" Version.gitHEAD; else ln -s \"$(cat .git_worktree_dir)/HEAD\" Version.gitHEAD; fi")))
(rule
(targets Version.ml)
(deps Version.gitHEAD)
(action (run "sh" "-c" "printf 'let version = \"%s\"'\\\\n \"$(cat Version.gitHEAD)\" > Version.ml"))
(mode promote-until-clean)
)
(mode promote-until-clean))