From ada7875e95cba2f08902c55cfd3f69d6cc80cac3 Mon Sep 17 00:00:00 2001 From: Hugo Herbelin Date: Mon, 26 Jun 2017 18:40:11 +0200 Subject: Adding support for recursive notations of the form "x , .. , y , z". Since camlp5 parses from left, the last ", z" was parsed as part of an arbitrary long list of "x1 , .. , xn" and a syntax error was raised since an extra ", z" was still expected. We support this by translating "x , .. , y , z" into "x , y , .. , z" and reassembling the arguments appropriately after parsing. --- intf/notation_term.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'intf/notation_term.ml') diff --git a/intf/notation_term.ml b/intf/notation_term.ml index 0fa0afdad7..cee96040bd 100644 --- a/intf/notation_term.ml +++ b/intf/notation_term.ml @@ -83,9 +83,10 @@ type notation_interp_env = { type grammar_constr_prod_item = | GramConstrTerminal of Tok.t | GramConstrNonTerminal of Extend.constr_prod_entry_key * Id.t option - | GramConstrListMark of int * bool + | GramConstrListMark of int * bool * int (* tells action rule to make a list of the n previous parsed items; - concat with last parsed list if true *) + concat with last parsed list when true; additionally release + the p last items as if they were parsed autonomously *) type notation_grammar = { notgram_level : int; -- cgit v1.2.3