let return_term loc term = Ast.AttributedTerm (`Loc loc, term)
-let _ = (* create empty precedence level for "term" *)
+ (* create empty precedence level for "term" *)
+let _ =
+ let dummy_action =
+ Gramext.action (fun _ ->
+ failwith "internal error, lexer generated a dummy token")
+ in
+ (* Needed since campl4 on "delete_rule" remove the precedence level if it gets
+ * empty after the deletion. The lexer never generate the Stoken below. *)
+ let dummy_prod = [ [ Gramext.Stoken ("DUMMY", "") ], dummy_action ] in
let mk_level_list first last =
let rec aux acc = function
| i when i < first -> acc
| i ->
aux
- ((Some (string_of_int i ^ "N"), Some Gramext.NonA, [])
- :: (Some (string_of_int i ^ "L"), Some Gramext.LeftA, [])
- :: (Some (string_of_int i ^ "R"), Some Gramext.RightA, [])
+ ((Some (string_of_int i ^ "N"), Some Gramext.NonA, dummy_prod)
+ :: (Some (string_of_int i ^ "L"), Some Gramext.LeftA, dummy_prod)
+ :: (Some (string_of_int i ^ "R"), Some Gramext.RightA, dummy_prod)
:: acc)
(i - 1)
in