| 1 |
abate |
4 |
(* Abstract syntax as produced by the parsed *)
|
| 2 |
|
|
|
| 3 |
|
|
open Location
|
| 4 |
abate |
225 |
open Ident
|
| 5 |
abate |
4 |
|
| 6 |
abate |
501 |
type schema_item_kind = [ `Type | `Element | `Attribute | `Any ]
|
| 7 |
|
|
|
| 8 |
abate |
4 |
type pprog = pmodule_item list
|
| 9 |
|
|
|
| 10 |
|
|
and pmodule_item = pmodule_item' located
|
| 11 |
|
|
and pmodule_item' =
|
| 12 |
abate |
529 |
| TypeDecl of U.t * ppat
|
| 13 |
abate |
501 |
| SchemaDecl of string * Schema_types.schema (* name, schema *)
|
| 14 |
abate |
4 |
| LetDecl of ppat * pexpr
|
| 15 |
abate |
431 |
| FunDecl of pexpr
|
| 16 |
abate |
542 |
| Namespace of U.t * Ns.t
|
| 17 |
abate |
4 |
| EvalStatement of pexpr
|
| 18 |
abate |
43 |
| Debug of debug_directive
|
| 19 |
abate |
446 |
| Directive of toplevel_directive
|
| 20 |
abate |
43 |
and debug_directive =
|
| 21 |
|
|
[ `Filter of ppat * ppat
|
| 22 |
abate |
407 |
| `Sample of ppat
|
| 23 |
abate |
43 |
| `Accept of ppat
|
| 24 |
abate |
75 |
| `Compile of ppat * ppat list
|
| 25 |
abate |
224 |
| `Subtype of ppat * ppat
|
| 26 |
abate |
75 |
]
|
| 27 |
abate |
446 |
and toplevel_directive =
|
| 28 |
|
|
[ `Quit
|
| 29 |
|
|
| `Env
|
| 30 |
abate |
553 |
| `Reinit_ns
|
| 31 |
abate |
446 |
]
|
| 32 |
abate |
4 |
|
| 33 |
abate |
43 |
|
| 34 |
abate |
529 |
and pconst =
|
| 35 |
|
|
| Const_internal of Types.const
|
| 36 |
abate |
542 |
| Const_atom of U.t
|
| 37 |
abate |
529 |
|
| 38 |
abate |
316 |
and pexpr =
|
| 39 |
|
|
| LocatedExpr of loc * pexpr
|
| 40 |
|
|
|
| 41 |
abate |
4 |
(* CDuce is a Lambda-calculus ... *)
|
| 42 |
abate |
225 |
| Var of id
|
| 43 |
abate |
4 |
| Apply of pexpr * pexpr
|
| 44 |
|
|
| Abstraction of abstr
|
| 45 |
|
|
|
| 46 |
|
|
(* Data constructors *)
|
| 47 |
abate |
529 |
| Cst of pconst
|
| 48 |
abate |
4 |
| Pair of pexpr * pexpr
|
| 49 |
abate |
110 |
| Xml of pexpr * pexpr
|
| 50 |
abate |
549 |
| RecordLitt of (label * pexpr) list
|
| 51 |
abate |
522 |
| String of U.uindex * U.uindex * U.t * pexpr
|
| 52 |
abate |
4 |
|
| 53 |
|
|
(* Data destructors *)
|
| 54 |
|
|
| Match of pexpr * branches
|
| 55 |
abate |
421 |
| Map of pexpr * branches
|
| 56 |
|
|
| Transform of pexpr * branches
|
| 57 |
abate |
331 |
| Xtrans of pexpr * branches
|
| 58 |
abate |
501 |
| Validate of pexpr * string * string (* exp, schema name, element name *)
|
| 59 |
|
|
| Dot of pexpr * label
|
| 60 |
abate |
240 |
| RemoveField of pexpr * label
|
| 61 |
abate |
64 |
|
| 62 |
|
|
(* Exceptions *)
|
| 63 |
|
|
| Try of pexpr * branches
|
| 64 |
|
|
|
| 65 |
abate |
530 |
(* Other *)
|
| 66 |
abate |
542 |
| NamespaceIn of U.t * Ns.t * pexpr
|
| 67 |
abate |
623 |
| Forget of pexpr * ppat
|
| 68 |
|
|
| Op of string * pexpr list
|
| 69 |
|
|
| Ref of pexpr * ppat
|
| 70 |
abate |
530 |
|
| 71 |
abate |
623 |
|
| 72 |
|
|
|
| 73 |
abate |
549 |
and label = U.t
|
| 74 |
|
|
|
| 75 |
abate |
4 |
and abstr = {
|
| 76 |
abate |
225 |
fun_name : id option;
|
| 77 |
abate |
4 |
fun_iface : (ppat * ppat) list;
|
| 78 |
|
|
fun_body : branches
|
| 79 |
|
|
}
|
| 80 |
|
|
|
| 81 |
|
|
and branches = (ppat * pexpr) list
|
| 82 |
|
|
|
| 83 |
|
|
(* A common syntactic class for patterns and types *)
|
| 84 |
|
|
|
| 85 |
|
|
and ppat = ppat' located
|
| 86 |
|
|
and ppat' =
|
| 87 |
abate |
529 |
| PatVar of U.t
|
| 88 |
abate |
501 |
| SchemaVar of (* type/pattern schema variable *)
|
| 89 |
|
|
schema_item_kind * string * string
|
| 90 |
abate |
542 |
| AtomT of U.t
|
| 91 |
|
|
| NsT of U.t
|
| 92 |
abate |
529 |
| Recurs of ppat * (U.t * ppat) list
|
| 93 |
abate |
4 |
| Internal of Types.descr
|
| 94 |
|
|
| Or of ppat * ppat
|
| 95 |
abate |
121 |
| And of ppat * ppat
|
| 96 |
abate |
4 |
| Diff of ppat * ppat
|
| 97 |
|
|
| Prod of ppat * ppat
|
| 98 |
abate |
110 |
| XmlT of ppat * ppat
|
| 99 |
abate |
4 |
| Arrow of ppat * ppat
|
| 100 |
abate |
229 |
| Optional of ppat
|
| 101 |
abate |
549 |
| Record of bool * (label * ppat) list
|
| 102 |
abate |
225 |
| Capture of id
|
| 103 |
abate |
529 |
| Constant of id * pconst
|
| 104 |
abate |
4 |
| Regexp of regexp * ppat
|
| 105 |
abate |
501 |
(* regular expression, continuation: [ re ; cont ], e.g: [ re ; nil ] *)
|
| 106 |
abate |
4 |
|
| 107 |
|
|
and regexp =
|
| 108 |
|
|
| Epsilon
|
| 109 |
|
|
| Elem of ppat
|
| 110 |
|
|
| Seq of regexp * regexp
|
| 111 |
|
|
| Alt of regexp * regexp
|
| 112 |
|
|
| Star of regexp
|
| 113 |
|
|
| WeakStar of regexp
|
| 114 |
abate |
225 |
| SeqCapture of id * regexp
|
| 115 |
abate |
501 |
|
| 116 |
|
|
open Printf
|