Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cduce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
19
Issues
19
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cduce
cduce
Commits
d6b0ea92
Commit
d6b0ea92
authored
Oct 05, 2007
by
Pietro Abate
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[r2006-07-04 09:25:21 by afrisch] Empty log message
Original author: afrisch Date: 2006-07-04 09:25:21+00:00
parent
e507700a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
15 deletions
+35
-15
runtime/print_xml.ml
runtime/print_xml.ml
+16
-13
runtime/print_xml.mli
runtime/print_xml.mli
+1
-0
types/builtin.ml
types/builtin.ml
+9
-0
web/ocaml.xml
web/ocaml.xml
+9
-2
No files found.
runtime/print_xml.ml
View file @
d6b0ea92
...
...
@@ -13,13 +13,13 @@ let write_markup_string ~to_enc buf s =
failwith
(
"Cannot represent code point "
^
string_of_int
n
))
s
in
Buffer
.
add_string
buf
s'
buf
s'
let
write_data_string
~
to_enc
buf
s
=
let
write_part
i
len
=
if
(
len
>
0
)
then
if
to_enc
=
`Enc_utf8
then
Buffer
.
add_substring
buf
s
i
len
then
buf
(
String
.
sub
s
i
len
)
else
let
s'
=
convert
...
...
@@ -28,7 +28,7 @@ let write_data_string ~to_enc buf s =
~
subst
:
(
fun
n
->
"&#"
^
string_of_int
n
^
";"
)
~
range_pos
:
i
~
range_len
:
len
s
in
Buffer
.
add_string
buf
s'
buf
s'
in
let
i
=
ref
0
in
for
k
=
0
to
String
.
length
s
-
1
do
...
...
@@ -36,11 +36,11 @@ let write_data_string ~to_enc buf s =
|
(
'
&
'
|
'
<
'
|
'
>
'
|
'
"' | '%') as c ->
write_part !i (k - !i);
begin match c with
'&' ->
Buffer.add_string
buf "
&
amp
;
"
| '<' ->
Buffer.add_string
buf "
&
lt
;
"
| '>' ->
Buffer.add_string
buf "
&
gt
;
"
| '"
'
->
Buffer
.
add_string
buf
"""
|
'
%
'
->
Buffer
.
add_string
buf
"%"
(* reserved in DTDs *)
'&' -> buf "
&
amp
;
"
| '<' -> buf "
&
lt
;
"
| '>' -> buf "
&
gt
;
"
| '"
'
->
buf
"""
|
'
%
'
->
buf
"%"
(* reserved in DTDs *)
|
_
->
assert
false
end
;
i
:=
k
+
1
...
...
@@ -90,10 +90,9 @@ and schema_values ~wds v =
schema_values
~
wds
tl
|
_
->
raise
exn_print_xml
let
string_of_xml
~
utf8
ns_table
v
=
let
to_buf
~
utf8
buffer
ns_table
v
=
let
to_enc
=
if
utf8
then
`Enc_utf8
else
`Enc_iso88591
in
let
buffer
=
Buffer
.
create
127
in
let
printer
=
Ns
.
Printer
.
printer
ns_table
in
let
wms
=
write_markup_string
~
to_enc
buffer
...
...
@@ -181,10 +180,14 @@ let string_of_xml ~utf8 ns_table v =
|
v
->
schema_value
~
wds
v
in
document_start
()
;
print_elt
(
Ns
.
Printer
.
prefixes
printer
)
v
;
Buffer
.
contents
buffer
print_elt
(
Ns
.
Printer
.
prefixes
printer
)
v
let
print_xml
~
utf8
ns_table
s
=
let
s
=
string_of_xml
~
utf8
ns_table
s
in
let
buf
=
Buffer
.
create
32
in
to_buf
~
utf8
(
Buffer
.
add_string
buf
)
ns_table
s
;
let
s
=
Buffer
.
contents
buf
in
if
utf8
then
string_utf8
(
U
.
mk
s
)
else
string_latin1
s
let
dump_xml
~
utf8
ns_table
s
=
to_buf
~
utf8
print_string
ns_table
s
;
Value
.
nil
runtime/print_xml.mli
View file @
d6b0ea92
val
print_xml
:
utf8
:
bool
->
Ns
.
table
->
Value
.
t
->
Value
.
t
val
dump_xml
:
utf8
:
bool
->
Ns
.
table
->
Value
.
t
->
Value
.
t
types/builtin.ml
View file @
d6b0ea92
...
...
@@ -214,6 +214,15 @@ register_fun "print_xml_utf8"
(
fun
v
->
Print_xml
.
print_xml
~
utf8
:
true
!
Eval
.
ns_table
v
);;
register_fun
"dump_xml"
Types
.
any
string_latin1
(
fun
v
->
Print_xml
.
dump_xml
~
utf8
:
false
!
Eval
.
ns_table
v
);;
register_fun
"dump_xml_utf8"
Types
.
any
string
(
fun
v
->
Print_xml
.
dump_xml
~
utf8
:
true
!
Eval
.
ns_table
v
);;
register_fun
"print"
string_latin1
nil
(
fun
v
->
...
...
web/ocaml.xml
View file @
d6b0ea92
...
...
@@ -634,7 +634,8 @@ this case, the transformation is applied recursively to its content.
<p>
As a convenience, some of the OCaml expression constructors
are allowed as x-expressions (without a need to go back to OCaml
with double curly braces): (unqualified) value identifiers and
with double curly braces): (unqualified) value identifiers
<b>
without
apostrophes
</b>
and
function calls.
</p>
...
...
@@ -702,13 +703,19 @@ X-patterns can have:
</p>
<ul>
<li>
capture variables (lowercase OCaml identifiers);
</li>
<li>
capture variables (lowercase OCaml identifiers
<b>
without apostrophes
</b>
);
</li>
<li>
constant bindings
<code>
(x := c)
</code>
where x is a capture
variable and c is
a literal x-constant (this pattern always succeeds and returns the
binding x->c).
</li>
</ul>
<p>
An identifier in an X-pattern can be either a reference
to a named X-type (if such a type declaration is in scope)
or a capture variable (otherwise).
</p>
<p>
Here is a brief description of the semantics of patterns. Given
an input value, a pattern can either succeed or fail. If it succeeds,
...
...
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