Skip to content
This repository
Newer
Older
100644 51 lines (38 sloc) 1.751 kb
fccc6851 » MLstate
2011-06-21 Initial open-source release
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 read default.trx
19 read ocaml_types.trx
20 read ocaml_keywords.trx
21 read ocaml_parser.trx
22
23 types:{{
24 open Ocaml
25 open Tgrammar
26
27 type idl =
28 | IDLLet of Ocaml.expr
29 | IDLType of string * Ocaml.type_expr * string option
30 | IDLSar of string * string * string
31 }}
32
33 spc <- (Default.sharpcomment $ / Default.space $ / Default.mlcomment $)* $
34 delimitor <- ";;" $ / Default.eol $
35
36 let <- Ocaml_parser.Let spc delimitor? spc {{ IDLLet __1 }}
37
38 typident <- Ocaml_types.typevars? Ocaml_types.typeIdent $_
39 type <- Ocaml_types.typedeflist
40
41 deftype <- Ocaml_keywords.TYPE spc typident spc '=' spc type spc delimitor? spc
42 {{ IDLType (__3, __7, None) }}
43
44 sar <- Ocaml_keywords.VAL Ocaml_parser.mlIdent spc ":" spc typident spc "->" spc typident spc delimitor? spc
45 {{ IDLSar (__2,__6,__10) }}
46 / Ocaml_keywords.VAL Ocaml_parser.mlIdent spc ":" spc typident spc delimitor? spc
47 {{ IDLSar (__2,__6,"") }}
48
49 ext <- "external" spc typident spc ":" spc type spc "=" spc Default.string spc delimitor? spc {{ IDLType (__3,__7,Some __11) }}
50
51 +idls : {idl list} <- spc (sar / deftype / let / ext)* {{ __2 }}
Something went wrong with that request. Please try again.