aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/compat5.mlp
blob: c3c7e9995f90b76b27493f5e0318f7f0a494282d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(************************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
(*   \VV/  **************************************************************)
(*    //   *      This file is distributed under the terms of the       *)
(*         *       GNU Lesser General Public License Version 2.1        *)
(************************************************************************)

(** Adding a bit of camlp5 syntax to camlp4 for compatibility:
    - GEXTEND ... becomes EXTEND ...
*)

open Camlp4.PreCast

let rec my_token_filter = parser
  | [< '(KEYWORD "GEXTEND", loc); s >] ->
    [< '(KEYWORD "EXTEND", loc); my_token_filter s >]
  | [< 'tokloc; s >] -> [< 'tokloc; my_token_filter s >]
  | [< >] -> [< >]

let _ =
  Token.Filter.define_filter (Gram.get_filter())
    (fun prev strm -> prev (my_token_filter strm))