From 4c75051e43db1dd893f2e24bbf88813b9ca12e22 Mon Sep 17 00:00:00 2001 From: bguillaum Date: Fri, 3 Feb 2012 12:45:18 +0000 Subject: [PATCH] remove bad_labels + improve Makefiles git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/libcaml-grew/trunk@6889 7838e531-6607-4d57-9587-6c381814729c --- emacs/grew.el | 2 +- src/HTMLer/HTMLer.ml | 16 ++-------------- src/Makefile.in | 7 ++----- src/grew_ast.ml | 1 - src/grew_ast.mli | 1 - src/grew_grs.ml | 2 -- src/parser/Makefile.in | 18 ++++++++---------- src/parser/gr_grs_parser.mly | 12 +----------- src/parser/lexer.mll | 1 - 9 files changed, 14 insertions(+), 46 deletions(-) diff --git a/emacs/grew.el b/emacs/grew.el index d23527c..0055edf 100644 --- a/emacs/grew.el +++ b/emacs/grew.el @@ -6,7 +6,7 @@ (require 'generic-x) ;;pour Emacs OK, mais semble ne pas marcher avec XEmacs (define-generic-mode 'grew-mode '("%");;comments - '("features" "module" "rule" "lex_rule" "match" "without" "labels" "bad_labels" "sequences" "commands" "graph" "confluent" "include" "filter");;keywords + '("features" "module" "rule" "lex_rule" "match" "without" "labels" "sequences" "commands" "graph" "confluent" "include" "filter");;keywords '( ;; ("class\\s (\*\*)* +\\(\\sw[a-zA-Z0-9_.-]*\\)" 1 'font-lock-type-face);noms de classes ;; ("\?[a-zA-Z0-9]+" . font-lock-variable-name-face) diff --git a/src/HTMLer/HTMLer.ml b/src/HTMLer/HTMLer.ml index e8716e8..a0bd5ea 100644 --- a/src/HTMLer/HTMLer.ml +++ b/src/HTMLer/HTMLer.ml @@ -109,18 +109,6 @@ let rule_page_text previous next rule m ast file = " "" ) else ( ""))^ - (if (List.length m.Ast.bad_labels > 0) then ( - "
Prohibited
- "^ - ( - let rec tab_to_html tab = match tab with - | [] -> "" - | h::[] -> h - | h::t -> h^", "^(tab_to_html t) - in tab_to_html m.Ast.bad_labels - )^ - "" - ) else ( ""))^ *) (* @@ -339,8 +327,8 @@ in let rules_array = Array.of_list modules_array.(i).Ast.rules in for j = 0 to (Array.length rules_array -1) do - let pattern_commands_view = Filename.concat output_dir (modules_array.(i).Ast.module_id^"_"^rules_array.(j).Ast.rule_id^"_pattern_commands") in - let antipattern_view = Filename.concat output_dir (modules_array.(i).Ast.module_id^"_"^rules_array.(j).Ast.rule_id^"antipattern_") in + (* let pattern_commands_view = Filename.concat output_dir (modules_array.(i).Ast.module_id^"_"^rules_array.(j).Ast.rule_id^"_pattern_commands") in *) + (* let antipattern_view = Filename.concat output_dir (modules_array.(i).Ast.module_id^"_"^rules_array.(j).Ast.rule_id^"antipattern_") in *) (* let (patterns,antis) = (Ast.Grew_dot.to_dot_rule rules_array.(j)) in*) (* let i2 = ref 0 in*) diff --git a/src/Makefile.in b/src/Makefile.in index 669e8c9..7a01845 100755 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -61,7 +61,7 @@ HTMLer_byte: # librairie -libgrew.mli : grew_types.mli +libgrew.mli : grew_types.mli libgrew_.mli rm -rf libgrew.mli touch libgrew.mli echo "(** Grew Library" > libgrew.mli @@ -76,8 +76,6 @@ libgrew.mli : grew_types.mli cat libgrew_.mli >> libgrew.mli libgrew.cma : $(FILES_CMO) parser_byte HTMLer_byte libgrew.mli libgrew.ml - rm libgrew.mli - @make libgrew.mli ifeq (@DEP2PICT@,no) ocamlc -c -pp 'camlp4o pa_macro.cmo' $(BYPE_FLAGS) $(FILES_CMO) str.cma -I parser $(PARSER_CMO) -I HTMLer HTMLer.cmo libgrew.mli ocamlc -a -o libgrew.cma $(BYPE_FLAGS) -pp 'camlp4o pa_macro.cmo -DDATA_DIR=\"$(DATA_DIR)\"' -linkall $(FILES_CMO) -I parser $(PARSER_CMO) -I HTMLer HTMLer.cmo libgrew.ml @@ -87,8 +85,6 @@ else endif libgrew.cmxa : $(FILES_CMX) parser_opt HTMLer_opt libgrew.mli libgrew.ml - rm libgrew.mli - @make libgrew.mli ifeq (@DEP2PICT@,no) ocamlopt -c -pp 'camlp4o pa_macro.cmo' $(OPT_FLAGS) $(FILES_CMX) str.cmxa -I parser $(PARSER_CMX) -I HTMLer HTMLer.cmx libgrew.mli ocamlopt -a -o libgrew.cmxa $(OPT_FLAGS) -pp 'camlp4o pa_macro.cmo -DDATA_DIR=\"$(DATA_DIR)\"' -linkall $(FILES_CMX) -I parser $(PARSER_CMX) -I HTMLer HTMLer.cmx libgrew.ml @@ -322,6 +318,7 @@ clean: rm -f grew grew.byte rm -f test test.byte rm -f *.nf *.png *.html + rm -f libgrew.mli purge_makefile: @make -C HTMLer purge diff --git a/src/grew_ast.ml b/src/grew_ast.ml index 98b55e1..44e5d69 100644 --- a/src/grew_ast.ml +++ b/src/grew_ast.ml @@ -101,7 +101,6 @@ module Ast = struct type modul = { module_id:Id.name; local_labels: (string * string option) list; - bad_labels: string list; rules: rule list; confluent: bool; module_doc:string; diff --git a/src/grew_ast.mli b/src/grew_ast.mli index f8a92f5..59a2a95 100644 --- a/src/grew_ast.mli +++ b/src/grew_ast.mli @@ -89,7 +89,6 @@ module Ast : sig type modul = { module_id:Id.name; local_labels: (string * string option) list; - bad_labels: string list; rules: rule list; confluent: bool; module_doc:string; diff --git a/src/grew_grs.ml b/src/grew_grs.ml index 37c4820..33082d8 100644 --- a/src/grew_grs.ml +++ b/src/grew_grs.ml @@ -152,7 +152,6 @@ module Modul = struct type t = { name: string; local_labels: (string * string option) array; - bad_labels: Label.t list; rules: Rule.t list; filters: Rule.t list; confluent: bool; @@ -177,7 +176,6 @@ module Modul = struct { name = ast_module.Ast.module_id; local_labels = locals; - bad_labels = List.map Label.from_string ast_module.Ast.bad_labels; rules = rules; filters = filters; confluent = ast_module.Ast.confluent; diff --git a/src/parser/Makefile.in b/src/parser/Makefile.in index 466342b..6f659fe 100644 --- a/src/parser/Makefile.in +++ b/src/parser/Makefile.in @@ -10,22 +10,24 @@ parser_global.cmo: parser_global.ml parser_global.cmx: parser_global.ml ocamlopt -c $(OPT_FLAGS) parser_global.ml -gr_grs_parser.cmx: gr_grs_parser.mly ../grew_utils.cmx ../grew_ast.cmx parser_global.cmo +gr_grs_parser.ml: gr_grs_parser.mly menhir --infer --ocamlc "ocamlc -c -I .. grew_utils.cmo grew_ast.cmo parser_global.cmo" gr_grs_parser.mly + +gr_grs_parser.cmx: gr_grs_parser.ml ../grew_utils.cmx ../grew_ast.cmx parser_global.cmo ocamlopt -c $(OPT_FLAGS) -I .. grew_utils.cmx grew_ast.cmx gr_grs_parser.mli ocamlopt -c $(OPT_FLAGS) -I .. grew_utils.cmx grew_ast.cmx gr_grs_parser.ml -gr_grs_parser.cmo: gr_grs_parser.mly ../grew_utils.cmo ../grew_ast.cmx parser_global.cmo - menhir --infer --ocamlc "ocamlc -c -I .. grew_utils.cmo grew_ast.cmo parser_global.cmo" gr_grs_parser.mly +gr_grs_parser.cmo: gr_grs_parser.ml ../grew_utils.cmo ../grew_ast.cmx parser_global.cmo ocamlc -c $(BYTE_FLAGS) -I .. grew_utils.cmo grew_ast.cmo gr_grs_parser.mli ocamlc -c $(BYTE_FLAGS) -I .. grew_utils.cmo grew_ast.cmo gr_grs_parser.ml -lexer.cmx: gr_grs_parser.cmx lexer.mll ../grew_ast.cmx +lexer.ml: lexer.mll ocamllex lexer.mll + +lexer.cmx: gr_grs_parser.cmx lexer.ml ../grew_ast.cmx ocamlopt -c $(OPT_FLAGS) -I .. grew_ast.cmx lexer.ml -lexer.cmo: gr_grs_parser.cmo lexer.mll ../grew_ast.cmo - ocamllex lexer.mll +lexer.cmo: gr_grs_parser.cmo lexer.ml ../grew_ast.cmo ocamlc -c $(BYTE_FLAGS) -I .. grew_ast.cmo lexer.ml grew_parser.cmx: gr_grs_parser.cmx lexer.cmx grew_parser.ml ../grew_ast.cmx @@ -36,7 +38,3 @@ grew_parser.cmo: gr_grs_parser.cmo lexer.cmo grew_parser.ml ../grew_ast.cmo clean: rm -rf *.cmi *.cmx *.cmo lexer.ml gr_grs_parser.ml *.o *.mli *.annot - - -# ocamlopt -c rules_to_html.ml -# ocamlopt -o main str.cmxa grew_ast.cmx rules_to_html.cmx lexer.cmx gr_grs_parser.cmx main.ml diff --git a/src/parser/gr_grs_parser.mly b/src/parser/gr_grs_parser.mly index 28bcbd6..7ef27b3 100644 --- a/src/parser/gr_grs_parser.mly +++ b/src/parser/gr_grs_parser.mly @@ -44,7 +44,6 @@ let localize t = (t,get_loc ()) %token FEATURE /* feature */ %token FILE /* file */ %token LABELS /* labels */ -%token BAD_LABELS /* bad_labels */ %token MATCH /* match */ %token WITHOUT /* without */ %token COMMANDS /* commands */ @@ -239,11 +238,10 @@ modules: | x = list(grew_module) { x } grew_module: - | doc = option(module_doc) MODULE conf = boption(CONFLUENT) id = module_id LACC l = option(local_labels) b = option(local_bad_labels) r = rules RACC + | doc = option(module_doc) MODULE conf = boption(CONFLUENT) id = module_id LACC l = option(local_labels) r = rules RACC { { Ast.module_id = fst id; local_labels = (match l with None -> [] | Some x -> x); - bad_labels = (match b with None -> [] | Some x -> x); rules = r; confluent = conf; module_doc = (match doc with Some d -> d | None -> ""); @@ -264,7 +262,6 @@ module_doc: /* */ /* labels {ANT_TMP} */ /* */ -/* bad_labels { SUJ, OBJ } */ /*=============================================================================================*/ @@ -272,13 +269,6 @@ module_doc: local_labels: | LABELS x = labels { x } -local_bad_labels: - | BAD_LABELS x = bad_labels { x } - -%inline bad_labels: - | x = delimited(LACC,separated_nonempty_list(COMA,IDENT),RACC) { x } - - /*=============================================================================================*/ /* */ diff --git a/src/parser/lexer.mll b/src/parser/lexer.mll index 6f312bb..ed88fa5 100644 --- a/src/parser/lexer.mll +++ b/src/parser/lexer.mll @@ -64,7 +64,6 @@ and global = parse | "feature" { FEATURE } | "file" { FILE } | "labels" { LABELS } -| "bad_labels" { BAD_LABELS } | "match" { MATCH } | "without" { WITHOUT } | "commands" { COMMANDS } -- GitLab