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
1e42fca1
Commit
1e42fca1
authored
Oct 05, 2007
by
Pietro Abate
Browse files
[r2003-05-21 22:09:48 by cvscast] Manual
Original author: cvscast Date: 2003-05-21 22:09:49+00:00
parent
6a3e3df5
Changes
6
Hide whitespace changes
Inline
Side-by-side
web/index.xml
View file @
1e42fca1
...
...
@@ -16,11 +16,9 @@
<external
href=
"/cgi-bin/cduce"
title=
"Online demo"
name=
"proto"
/>
<include
file=
"bench.xml"
/>
<include
file=
"memento.xml"
/>
<include
file=
"papers.xml"
/>
<include
file=
"examples.xml"
/>
<include
file=
"team.xml"
/>
<include
file=
"tutorial.xml"
/>
<include
file=
"manual.xml"
/>
<include
file=
"sitemap.xml"
/>
...
...
web/manual.xml
View file @
1e42fca1
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<page
name=
"manual"
>
<title>
CDuce u
ser's manual
</title>
<title>
U
ser's manual
</title>
<include
file=
"tutorial.xml"
/>
<include
file=
"memento.xml"
/>
<include
file=
"manual/types_patterns.xml"
/>
<include
file=
"manual/expressions.xml"
/>
<box
title=
"Table of Contents"
link=
"toc"
>
<p><b>
This manual is under construction !
</b></p>
<p>
Sections:
</p>
...
...
web/manual/expressions.xml
View file @
1e42fca1
...
...
@@ -400,6 +400,44 @@ better localization in the program, and more informative messages.
<box
title=
"XML-specific constructions"
link=
"xml"
>
<section
title=
"Loading XML documents"
>
<p>
The
<code>
load_xml
</code>
operator parse an XML document on the local
file system; the argument gives the filename:
</p>
<sample>
<![CDATA[
load_xml %%e%%
]]>
</sample>
</section>
<section
title=
"Pretty-printing XML documents"
>
<p>
Two operators can be used to produce a string from an XML document:
</p>
<sample>
<![CDATA[
print_xml %%e%%
print_xml_utf8 %%e%%
]]>
</sample>
<p>
They fail if the argument is not an XML document (this isn't checked
statically). The first operator
<code>
print_xml
</code>
prepares the document to be dumped to
a ISO-8859-1 encoded XML file: Unicode characters outside Latin1
are escaped accordingly, and the operator fails if the document
contains tag or attribute names which cannot be represented
in ISO-8859-1. The second operator
<code>
print_xml_utf8
</code>
always succeed but produces a string suitable for being dumped
in an UTF-8 encoded file. See the variants of the
<code>
dump_to_file
</code>
operator
in the section on
<a
href=
"#io"
>
Input/output
</a>
.
</p>
<p>
In both cases, the resulting string does
<em>
not
</em>
contain
the XML prefix "
<
?xml ...>".
</p>
</section>
<section
title=
"Projection"
>
<p>
The projection takes a sequence of XML elements and returns
the concatenation of all their children with a given type.
...
...
@@ -425,6 +463,10 @@ evaluates to
]]>
</code>
.
</p>
</section>
<section
title=
"Iteration over XML trees"
>
<p>
Another XML-specific construction is
<code>
xtransform
</code>
which is a generalization of
<code>
transform
</code>
to XML trees:
...
...
@@ -442,6 +484,46 @@ is applied recursively to its content. Elements in the input sequence
which are not matched and are not XML elements are copied verbatim.
</p>
</section>
</box>
<box
title=
"Input-output"
link=
"io"
>
<section
title=
"Loading files"
>
<p>
There are two operators available to load a file into a CDuce string:
</p>
<sample>
<![CDATA[
load_file %%e%%
load_file_utf8 %%e%%
]]>
</sample>
<p>
The first one loads an ISO-8859-1 encoded file, whereas the second
one loads a UTF-8 encoded file.
</p>
</section>
<section
title=
"Dumping to files"
>
<p>
There are two operators available to dump a CDuce string to a file:
</p>
<sample>
<![CDATA[
dump_to_file %%e1%% %%e2%%
load_file_utf8 %%e1%% %%e2%%
]]>
</sample>
<p>
The first one creates an ISO-8859-1 encoded file (it fails
when the CDuce string contains non Latin1 characters), whereas the second
one creates a UTF-8 encoded file. In both cases, the first
argument is the filename and the second one is the string to dump.
</p>
</section>
</box>
</page>
web/memento.xml
View file @
1e42fca1
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<page
name=
"memento"
>
<title>
CDuce m
emento
</title>
<title>
M
emento
</title>
<left>
<p>
This page briefly presents the syntax of the CDuce language.
</p>
...
...
@@ -50,7 +50,7 @@ _" character, starting by a capitalized letter or underscore.</li>
<box
title=
"Operators"
link=
"op"
>
<ul>
<li>
Infix:
<br/>
<code>
@
</code>
:
String,String -> String
<br/>
<code>
@
</code>
:
concatenation of sequences
<br/>
<code>
+,*,-,div,mod
</code>
: Integer,Integer -> Integer
<br/>
<code>
=,
<<
,
<
=,
>>
,
>
=
</code>
:
Integer,Integer -> Bool =
<code>
`true | `false
</code>
...
...
@@ -63,9 +63,6 @@ Integer,Integer -> Bool = <code>`true | `false</code>
<br/><code>
int_of
</code>
: [('0'--'9')+] -> Integer
<br/><code>
string_of
</code>
: Integer -> String
</li>
<li>
Postfix:
<br/><code>
?,*,+,??,*?,+?
</code>
: for regexp
</li>
</ul>
</box>
...
...
web/site.cd
View file @
1e42fca1
...
...
@@ -70,7 +70,7 @@ let fun load_include (String -> [Any*])
(* let _ = print [ 'Loading ' !name '... \n' ] in *)
xtransform [ (load_xml name) ] with
|
<include
file=
(s
&
String
)
>
[] -> load_include s
|
<include-verbatim
file=
(s
&
String
)
>
[] ->
let [] = print s in
load_file s;;
|
<include-verbatim
file=
(s
&
String
)
>
[] -> load_file s;;
(* Highlighting text between {{...}} *)
...
...
web/tutorial.xml
View file @
1e42fca1
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<page
name=
"tutorial"
>
<title>
CDuce t
utorial
</title>
<title>
T
utorial
</title>
<include
file=
"tutorial/getting_started.xml"
/>
...
...
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