Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
d5664653
Commit
d5664653
authored
Oct 05, 2007
by
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
Changes
6
Hide whitespace changes
Inline
Side-by-side
CHANGES
View file @
d5664653
...
...
@@ -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
...
...
compile/compile.ml
View file @
d5664653
...
...
@@ -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
->
...
...
parser/ast.ml
View file @
d5664653
...
...
@@ -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
...
...
parser/parser.ml
View file @
d5664653
...
...
@@ -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"
->
...
...
typing/typer.ml
View file @
d5664653
...
...
@@ -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
...
...
typing/typer.mli
View file @
d5664653
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment