Commit d5664653 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2005-03-04 13:13:40 by afrisch] Removed namespace/schema binding

Original author: afrisch
Date: 2005-03-04 13:13:41+00:00
parent aa9a844e
......@@ -5,6 +5,9 @@ Since 0.2.2
- Bug fixes when printing location in source code.
- Major rewrite of the support for XML Schema
* removed print_schema directive
* removed the "kind" selector (e.g. S # t as element)
* include,import implemented
*
- removed the syntax "external {...}", replaced with
"unit.val with { ty1 ty2 ... }"
- removed the syntax H:val, replaced with H.val
......
......@@ -245,8 +245,8 @@ let namespace (tenv,cenv,codes) pr ns =
let tenv = Typer.enter_ns pr ns tenv in
(tenv,cenv,codes)
let schema (tenv,cenv,codes) x sch prefix =
let tenv = Typer.enter_schema ?prefix x sch tenv in
let schema (tenv,cenv,codes) x sch =
let tenv = Typer.enter_schema x sch tenv in
(tenv,cenv,codes)
let find_cu (tenv,_,_) cu =
......@@ -274,8 +274,8 @@ let rec phrases ~run ~show ~loading ~directive =
| { descr = Ast.TypeDecl (_,_) } :: _ ->
let (typs,rest) = collect_types [] phs in
loop (type_defs accu typs) rest
| { descr = Ast.SchemaDecl (name, uri, p) } :: rest ->
loop (schema accu name uri p) rest
| { descr = Ast.SchemaDecl (name, uri) } :: rest ->
loop (schema accu name uri) rest
| { descr = Ast.Namespace (pr,ns) } :: rest ->
loop (namespace accu pr ns) rest
| { descr = Ast.Using (x,cu) } :: rest ->
......
......@@ -8,7 +8,7 @@ type pprog = pmodule_item list
and pmodule_item = pmodule_item' located
and pmodule_item' =
| TypeDecl of (Location.loc * U.t) * ppat
| SchemaDecl of U.t * string * U.t option (* name, uri, ns prefix *)
| SchemaDecl of U.t * string
| LetDecl of ppat * pexpr
| FunDecl of pexpr
| Namespace of U.t * Ns.t
......
......@@ -138,11 +138,9 @@ EXTEND
| "type"; x = located_ident; "="; t = pat -> [ mk loc (TypeDecl (x,t)) ]
| "using"; name = IDENT; "="; cu = [ IDENT | STRING2 ] ->
[ mk loc (Using (U.mk name, U.mk cu)) ]
| "schema"; name = IDENT;
p = OPT [ "("; name = [ IDENT | keyword ]; ")" -> ident name ];
"="; uri = STRING2 ->
| "schema"; name = IDENT; "="; uri = STRING2 ->
protect_op "schema";
[ mk loc (SchemaDecl (U.mk name, uri, p)) ]
[ mk loc (SchemaDecl (U.mk name, uri)) ]
| (name,ns) = namespace_binding ->
[ mk loc (Namespace (name, ns)) ]
| (name,ns) = namespace_binding; "in"; e2 = expr LEVEL "top" ->
......
......@@ -65,15 +65,9 @@ let check _ = failwith "Typer.check"
let load_schema_fwd = ref (fun x uri -> assert false)
let enter_schema ?prefix x uri env =
let enter_schema x uri env =
let sch = !load_schema_fwd x uri in
{ env with
cu = UEnv.add x (ESchema uri) env.cu;
ns = (match prefix with
| Some p ->
Ns.add_prefix p sch.Schema_types.targetNamespace env.ns
| None -> env.ns) }
{ env with cu = UEnv.add x (ESchema uri) env.cu }
(* TODO: filter out builtin defs ? *)
let serialize_item s = function
......
......@@ -29,7 +29,7 @@ val get_ns_table : t -> Ns.table
val register_types : Types.CompUnit.t -> t -> unit
val enter_ns : U.t -> Ns.t -> t -> t
val enter_schema: ?prefix:U.t -> U.t -> string -> t -> t
val enter_schema: U.t -> string -> t -> t
val find_schema: U.t -> t -> string
val enter_cu : U.t -> Types.CompUnit.t -> t -> t
val find_cu : U.t -> t -> Types.CompUnit.t
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment