Skip to content
GitLab
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
34c8f889
Commit
34c8f889
authored
Oct 05, 2007
by
Pietro Abate
Browse files
[r2003-11-26 16:20:56 by szach] compute FIRST while parsing schemas
Original author: szach Date: 2003-11-26 16:20:56+00:00
parent
b586e223
Changes
1
Hide whitespace changes
Inline
Side-by-side
schema/schema_parser.ml
View file @
34c8f889
...
...
@@ -22,6 +22,7 @@ let debug_print ?(n: pxp_node option) s =
let
space_RE
=
pcre_regexp
" "
let
split
s
=
pcre_split
~
rex
:
space_RE
s
let
unqualify
s
=
snd
(
Ns
.
split_qname
s
)
let
hashtbl_deref
tbl
=
(* ASSUMPTION: no multiple bindings *)
let
tbl'
=
Hashtbl
.
create
1024
in
...
...
@@ -384,7 +385,8 @@ let rec parse_complex_type (resolver: resolver) n =
let
particle
=
parse_particle
resolver
p_node
in
CT_model
(
particle
,
mixed
))
|
`Extension
->
let
base_ct
=
content_type_of_type
!
base
in
let
base_ct
=
content_type_of_type
!
base
in
(* TODO BUG HERE if base =
AnyType *)
(
match
particle_node
with
|
None
->
base_ct
|
Some
pnode
->
...
...
@@ -392,10 +394,11 @@ let rec parse_complex_type (resolver: resolver) n =
(
match
base_ct
with
|
CT_empty
->
CT_model
(
particle
,
mixed
)
|
CT_model
(
p
,
_
)
->
let
model
=
Sequence
(
p
::
[
particle
])
in
CT_model
((
Intervals
.
V
.
one
,
Some
(
Intervals
.
V
.
one
)
,
Model
(
Sequence
(
p
::
[
particle
])))
,
mixed
)
((
Intervals
.
V
.
one
,
Some
(
Intervals
.
V
.
one
)
,
Model
model
,
first_of_model_group
model
)
,
mixed
)
|
CT_simple
_
->
assert
false
))
in
complex
name
!
base
derivation_type
uses
content_type
...
...
@@ -441,21 +444,23 @@ and parse_particle (resolver: resolver) n =
let
min
,
max
=
parse_min_max
n
in
match
n
#
node_type
with
|
T_element
"xsd:element"
->
let
elt_decl
=
let
elt_decl
,
first
=
if
_has_attribute
"ref"
n
then
resolver
#
resolve_elt
~
now
:
false
(
_attribute
"ref"
n
)
let
ref
=
_attribute
"ref"
n
in
(
resolver
#
resolve_elt
~
now
:
false
ref
,
[
Some
ref
])
else
(* no "ref" attribute *)
ref
(
parse_elt_decl
resolver
n
)
let
decl
=
parse_elt_decl
resolver
n
in
(
ref
decl
,
[
Some
(
name_of_element_declaration
decl
)
])
in
min
,
max
,
Elt
elt_decl
(
min
,
max
,
Elt
elt_decl
,
first
)
|
T_element
"xsd:group"
->
let
model_group
=
snd
(
resolver
#
resolve_model_group
(
_attribute
"ref"
n
))
in
min
,
max
,
Model
model_group
(
min
,
max
,
Model
model_group
,
first_of_model_group
model_group
)
|
T_element
"xsd:all"
|
T_element
"xsd:sequence"
|
T_element
"xsd:choice"
->
let
model_group
=
parse_model_group
resolver
n
in
min
,
max
,
Model
model_group
(
min
,
max
,
Model
model_group
,
first_of_model_group
model_group
)
|
_
->
assert
false
and
parse_model_group
(
resolver
:
resolver
)
n
=
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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