From 45ced1c1af3dbe7f81c8b928aeb76ebadfe709ea Mon Sep 17 00:00:00 2001 From: Hugo Herbelin Date: Mon, 10 Feb 2020 17:27:21 +0100 Subject: Reorganize type "production_level" along a more intuitive structure. NextLevel = at next level NumLevel n = at level n DefaultLevel = --- parsing/extend.ml | 3 ++- parsing/notgram_ops.ml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'parsing') diff --git a/parsing/extend.ml b/parsing/extend.ml index dcdaa25c33..848861238a 100644 --- a/parsing/extend.ml +++ b/parsing/extend.ml @@ -21,6 +21,7 @@ type production_position = type production_level = | NextLevel | NumLevel of int + | DefaultLevel (** Interpreted differently at the border or inside a rule *) (** User-level types used to tell how to parse or interpret of the non-terminal *) @@ -40,7 +41,7 @@ type constr_entry_key = (** Entries used in productions, vernac side (e.g. "x bigint" or "x ident") *) type simple_constr_prod_entry_key = - production_level option constr_entry_key_gen + production_level constr_entry_key_gen (** Entries used in productions (in right-hand-side of grammar rules), to parse non-terminals *) diff --git a/parsing/notgram_ops.ml b/parsing/notgram_ops.ml index 009dafdb13..a5ade43295 100644 --- a/parsing/notgram_ops.ml +++ b/parsing/notgram_ops.ml @@ -48,7 +48,8 @@ let production_position_eq pp1 pp2 = match (pp1,pp2) with let production_level_eq l1 l2 = match (l1,l2) with | NextLevel, NextLevel -> true | NumLevel n1, NumLevel n2 -> Int.equal n1 n2 -| (NextLevel | NumLevel _), _ -> false +| DefaultLevel, DefaultLevel -> true +| (NextLevel | NumLevel _ | DefaultLevel), _ -> false let constr_entry_key_eq eq v1 v2 = match v1, v2 with | ETIdent, ETIdent -> true -- cgit v1.2.3