diff options
author | Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr> | 2016-05-10 11:11:39 +0200 |
---|---|---|
committer | Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr> | 2016-05-10 19:28:24 +0200 |
commit | 61f79019be6082c3ebabd503c322fb2edb05a99a (patch) | |
tree | 646aaa9d5fbf289354f86f2b912a234fca7b6c20 | |
parent | 946a3d4a800ae1f459cb67cc15c9e6ec44fb3f94 (diff) |
AlistNsep token now accepts an arbitrary separator.
-rw-r--r-- | grammar/q_util.ml4 | 6 | ||||
-rw-r--r-- | intf/extend.mli | 4 | ||||
-rw-r--r-- | ltac/tacentries.ml | 4 | ||||
-rw-r--r-- | parsing/pcoq.ml | 4 |
4 files changed, 10 insertions, 8 deletions
diff --git a/grammar/q_util.ml4 b/grammar/q_util.ml4 index 05c94394d..53330429d 100644 --- a/grammar/q_util.ml4 +++ b/grammar/q_util.ml4 @@ -61,11 +61,13 @@ let mlexpr_of_option f = function let mlexpr_of_ident id = <:expr< Names.Id.of_string $str:id$ >> +let symbol_of_string s = <:expr< Extend.Atoken (CLexer.terminal $str:s$) >> + let rec mlexpr_of_prod_entry_key f = function | Ulist1 s -> <:expr< Extend.Alist1 $mlexpr_of_prod_entry_key f s$ >> - | Ulist1sep (s,sep) -> <:expr< Extend.Alist1sep $mlexpr_of_prod_entry_key f s$ $str:sep$ >> + | Ulist1sep (s,sep) -> <:expr< Extend.Alist1sep $mlexpr_of_prod_entry_key f s$ $symbol_of_string sep$ >> | Ulist0 s -> <:expr< Extend.Alist0 $mlexpr_of_prod_entry_key f s$ >> - | Ulist0sep (s,sep) -> <:expr< Extend.Alist0sep $mlexpr_of_prod_entry_key f s$ $str:sep$ >> + | Ulist0sep (s,sep) -> <:expr< Extend.Alist0sep $mlexpr_of_prod_entry_key f s$ $symbol_of_string sep$ >> | Uopt s -> <:expr< Extend.Aopt $mlexpr_of_prod_entry_key f s$ >> | Uentry e -> <:expr< Extend.Aentry $f e$ >> | Uentryl (e, l) -> diff --git a/intf/extend.mli b/intf/extend.mli index bf5a18c47..7ba332f70 100644 --- a/intf/extend.mli +++ b/intf/extend.mli @@ -69,9 +69,9 @@ type 'a user_symbol = type ('self, 'a) symbol = | Atoken : Tok.t -> ('self, string) symbol | Alist1 : ('self, 'a) symbol -> ('self, 'a list) symbol -| Alist1sep : ('self, 'a) symbol * string -> ('self, 'a list) symbol +| Alist1sep : ('self, 'a) symbol * ('self, _) symbol -> ('self, 'a list) symbol | Alist0 : ('self, 'a) symbol -> ('self, 'a list) symbol -| Alist0sep : ('self, 'a) symbol * string -> ('self, 'a list) symbol +| Alist0sep : ('self, 'a) symbol * ('self, _) symbol -> ('self, 'a list) symbol | Aopt : ('self, 'a) symbol -> ('self, 'a option) symbol | Aself : ('self, 'self) symbol | Anext : ('self, 'self) symbol diff --git a/ltac/tacentries.ml b/ltac/tacentries.ml index d0383ffbc..f829ae4f5 100644 --- a/ltac/tacentries.ml +++ b/ltac/tacentries.ml @@ -139,10 +139,10 @@ let rec prod_item_of_symbol lev = function EntryName (Rawwit (ListArg typ), Alist0 e) | Extend.Ulist1sep (s, sep) -> let EntryName (Rawwit typ, e) = prod_item_of_symbol lev s in - EntryName (Rawwit (ListArg typ), Alist1sep (e, sep)) + EntryName (Rawwit (ListArg typ), Alist1sep (e, Atoken (CLexer.terminal sep))) | Extend.Ulist0sep (s, sep) -> let EntryName (Rawwit typ, e) = prod_item_of_symbol lev s in - EntryName (Rawwit (ListArg typ), Alist0sep (e, sep)) + EntryName (Rawwit (ListArg typ), Alist0sep (e, Atoken (CLexer.terminal sep))) | Extend.Uopt s -> let EntryName (Rawwit typ, e) = prod_item_of_symbol lev s in EntryName (Rawwit (OptArg typ), Aopt e) diff --git a/parsing/pcoq.ml b/parsing/pcoq.ml index b06362dc3..2790063e6 100644 --- a/parsing/pcoq.ml +++ b/parsing/pcoq.ml @@ -683,10 +683,10 @@ let rec symbol_of_prod_entry_key : type s a. (s, a) symbol -> _ = function | Atoken t -> Symbols.stoken t | Alist1 s -> Symbols.slist1 (symbol_of_prod_entry_key s) | Alist1sep (s,sep) -> - Symbols.slist1sep (symbol_of_prod_entry_key s, gram_token_of_string sep) + Symbols.slist1sep (symbol_of_prod_entry_key s, symbol_of_prod_entry_key sep) | Alist0 s -> Symbols.slist0 (symbol_of_prod_entry_key s) | Alist0sep (s,sep) -> - Symbols.slist0sep (symbol_of_prod_entry_key s, gram_token_of_string sep) + Symbols.slist0sep (symbol_of_prod_entry_key s, symbol_of_prod_entry_key sep) | Aopt s -> Symbols.sopt (symbol_of_prod_entry_key s) | Aself -> Symbols.sself | Anext -> Symbols.snext |