2006-06-29 01:12:46 -07:00
|
|
|
(****************************************************************************)
|
|
|
|
(* *)
|
2011-07-27 07:17:02 -07:00
|
|
|
(* OCaml *)
|
2006-06-29 01:12:46 -07:00
|
|
|
(* *)
|
|
|
|
(* INRIA Rocquencourt *)
|
|
|
|
(* *)
|
|
|
|
(* Copyright 1998-2006 Institut National de Recherche en Informatique et *)
|
|
|
|
(* en Automatique. All rights reserved. This file is distributed under *)
|
|
|
|
(* the terms of the GNU Library General Public License, with the special *)
|
2011-07-27 07:17:02 -07:00
|
|
|
(* exception on linking described in LICENSE at the top of the OCaml *)
|
|
|
|
(* source tree. *)
|
2006-06-29 01:12:46 -07:00
|
|
|
(* *)
|
|
|
|
(****************************************************************************)
|
|
|
|
|
|
|
|
(* Authors:
|
|
|
|
* - Daniel de Rauglaudre: initial version
|
|
|
|
* - Nicolas Pouillard: refactoring
|
|
|
|
*)
|
|
|
|
|
|
|
|
|
|
|
|
open Camlp4;
|
|
|
|
|
2007-02-07 02:09:29 -08:00
|
|
|
module Id : Sig.Id = struct
|
|
|
|
value name = "Camlp4OCamlParserParser";
|
2008-10-27 07:03:57 -07:00
|
|
|
value version = Sys.ocaml_version;
|
2006-06-29 01:12:46 -07:00
|
|
|
end;
|
|
|
|
|
2007-02-07 02:09:29 -08:00
|
|
|
module Make (Syntax : Sig.Camlp4Syntax) = struct
|
|
|
|
open Sig;
|
2006-06-29 01:12:46 -07:00
|
|
|
include Syntax;
|
|
|
|
|
2007-02-07 02:09:29 -08:00
|
|
|
module M = Camlp4OCamlRevisedParserParser.Make Syntax;
|
2006-06-29 01:12:46 -07:00
|
|
|
open M;
|
|
|
|
|
|
|
|
Gram.Entry.clear stream_expr;
|
|
|
|
Gram.Entry.clear stream_begin;
|
|
|
|
Gram.Entry.clear stream_end;
|
|
|
|
Gram.Entry.clear stream_quot;
|
|
|
|
Gram.Entry.clear parser_case_list;
|
|
|
|
|
|
|
|
EXTEND Gram
|
|
|
|
stream_expr:
|
|
|
|
[ [ e = expr LEVEL "top" -> e ] ]
|
|
|
|
;
|
|
|
|
stream_begin:
|
|
|
|
[ [ "[<" -> () ] ]
|
|
|
|
;
|
|
|
|
stream_end:
|
|
|
|
[ [ ">]" -> () ] ]
|
|
|
|
;
|
|
|
|
stream_quot:
|
|
|
|
[ [ "'" -> () ] ]
|
|
|
|
;
|
|
|
|
parser_case_list:
|
|
|
|
[ [ OPT "|"; pcl = LIST1 parser_case SEP "|" -> pcl ] ]
|
|
|
|
;
|
|
|
|
END;
|
|
|
|
end;
|
|
|
|
|
|
|
|
let module M = Register.OCamlSyntaxExtension Id Make in ();
|