From c03c4ea72e920bf69f29b9ef48c7be64c504d293 Mon Sep 17 00:00:00 2001 From: Pierre-Marie Pédrot Date: Sat, 24 Nov 2018 17:49:36 +0100 Subject: Remove the grammar-entry correspondence dynamic check in camlp5. Due to the fact we only export the functorial API, this property is ensured statically. There is thus no point in checking it. --- gramlib/gramext.ml | 34 ---------------------------------- 1 file changed, 34 deletions(-) (limited to 'gramlib') diff --git a/gramlib/gramext.ml b/gramlib/gramext.ml index 24dc9b865d..f8259b4570 100644 --- a/gramlib/gramext.ml +++ b/gramlib/gramext.ml @@ -284,39 +284,6 @@ let get_level ~warning entry position levs = lev :: levs -> [], change_lev ~warning lev "", levs | [] -> [], empty_lev, [] -let rec check_gram entry = - function - Snterm e -> - if e.egram != entry.egram then - begin - eprintf "\ -Error: entries \"%s\" and \"%s\" do not belong to the same grammar.\n" - entry.ename e.ename; - flush stderr; - failwith "Grammar.extend error" - end - | Snterml (e, _) -> - if e.egram != entry.egram then - begin - eprintf "\ -Error: entries \"%s\" and \"%s\" do not belong to the same grammar.\n" - entry.ename e.ename; - flush stderr; - failwith "Grammar.extend error" - end - | Slist0sep (s, t, _) -> check_gram entry t; check_gram entry s - | Slist1sep (s, t, _) -> check_gram entry t; check_gram entry s - | Slist0 s -> check_gram entry s - | Slist1 s -> check_gram entry s - | Sopt s -> check_gram entry s - | Stree t -> tree_check_gram entry t - | Snext | Sself | Stoken _ -> () -and tree_check_gram entry = - function - Node {node = n; brother = bro; son = son} -> - check_gram entry n; tree_check_gram entry bro; tree_check_gram entry son - | LocAct (_, _) | DeadEnd -> () - let change_to_self entry = function Snterm e when e == entry -> Sself @@ -373,7 +340,6 @@ let levels_of_rules ~warning entry position rules = List.fold_left (fun lev (symbols, action) -> let symbols = List.map (change_to_self entry) symbols in - List.iter (check_gram entry) symbols; let (e1, symbols) = get_initial entry symbols in insert_tokens entry.egram symbols; insert_level ~warning entry.ename e1 symbols action lev) -- cgit v1.2.3