From 6497f27021fec4e01f2182014f2bb1989b4707f9 Mon Sep 17 00:00:00 2001 From: Samuel Mimram Date: Mon, 31 Jan 2005 14:34:14 +0000 Subject: Imported Upstream version 8.0pl2 --- parsing/egrammar.ml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'parsing/egrammar.ml') diff --git a/parsing/egrammar.ml b/parsing/egrammar.ml index 9886bbf1..7a151c1a 100644 --- a/parsing/egrammar.ml +++ b/parsing/egrammar.ml @@ -6,10 +6,11 @@ (* * GNU Lesser General Public License Version 2.1 *) (************************************************************************) -(* $Id: egrammar.ml,v 1.48.2.1 2004/07/16 19:30:37 herbelin Exp $ *) +(* $Id: egrammar.ml,v 1.48.2.3 2004/11/26 19:37:59 herbelin Exp $ *) open Pp open Util +open Ppextend open Extend open Pcoq open Topconstr @@ -20,10 +21,11 @@ open Nameops (* State of the grammar extensions *) +type notation_grammar = + int * Gramext.g_assoc option * notation * prod_item list * int list option + type all_grammar_command = - | Notation of - (int * Gramext.g_assoc option * notation * prod_item list * - int list option) + | Notation of (precedence * tolerability list) * notation_grammar | Grammar of grammar_command | TacticGrammar of (string * (string * grammar_production list) * @@ -415,7 +417,7 @@ let add_tactic_entries gl = let extend_grammar gram = (match gram with - | Notation a -> extend_constr_notation a + | Notation (_,a) -> extend_constr_notation a | Grammar g -> extend_grammar_rules g | TacticGrammar l -> add_tactic_entries l); grammar_state := gram :: !grammar_state @@ -428,6 +430,12 @@ let reset_extend_grammars_v8 () = List.iter (fun (s,gl) -> extend_tactic_grammar s gl) te; List.iter (fun (s,gl) -> extend_vernac_command_grammar s gl) tv +let recover_notation_grammar ntn prec = + let l = map_succeed (function + | Notation (prec',(_,_,ntn',_,_ as x)) when prec = prec' & ntn = ntn' -> x + | _ -> failwith "") !grammar_state in + assert (List.length l = 1); + List.hd l (* Summary functions: the state of the lexer is included in that of the parser. Because the grammar affects the set of keywords when adding or removing -- cgit v1.2.3