Commit 67f064fb authored by Florent Terrones's avatar Florent Terrones
Browse files

2006-06-16 Florent Terrones <terron_f@lrde.epita.fr>

	* include/vaucanson/xml/node.hxx: Do not fill the alphabet with the
	default range anymore if an empty alphabet is clearly defined.
	Add the support for the alphabet ranges of the xsd file.
	* data/vaucanson.xsd: Change the default range from `ascii' to
	`implicit_alphabet', add a restriction for the range attribute.
	* doc/xml/xml_proposal.tex: Change the default range accordingly.
parent ee827845
2006-06-16 Florent Terrones <terron_f@lrde.epita.fr>
* include/vaucanson/xml/node.hxx: Do not fill the alphabet with the
default range anymore if an empty alphabet is clearly defined.
Add the support for the alphabet ranges of the xsd file.
* data/vaucanson.xsd: Change the default range from `ascii' to
`implicit_alphabet', add a restriction for the range attribute.
* doc/xml/xml_proposal.tex: Change the default range accordingly.
2006-06-16 Akim Demaille <akim@lrde.epita.fr>
More dev guide.
......
......@@ -262,15 +262,21 @@ of the automaton / transducer.
A monoid expects <generator> tags to define its generators, when available.
The <monoid> tag can be recursively constructed to build n-product of monoid.
For automata, default is free monoid, on the ASCII alphabet.
For transducers, default is product of free monoid, both on the ASCII alphabet
For automata, default is free monoid, with the alphabet letters.
For transducers, default is product of free monoid, both the alphabet letters.
-->
<!--
The monoid type is broken in two parts, for automata and transducers.
-->
<xs:complexType name="generator">
<xs:attribute name="value" type="xs:string"/>
<xs:attribute name="range" type="xs:string" default="ascii"/>
<xs:attribute name="range" default="implicit_alphabet">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="implicit_alphabet|digits|ascii"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="monoid_automaton">
......
......@@ -405,8 +405,8 @@ The XSD description of the \generatortag{} tag is:
alphabets.
\item \xattr{range}\\
This allows to set a fixed range without being obliged to add all
the symbols one by one. For instance, the range \textsc{ascii} sets
the alphabet on the \textsc{ascii} characters.
the symbols one by one. For instance, the range \textsc{implicit_alphabet}
sets the alphabet on the lowercase and uppercase alphabet characters.
\end{itemize}
\subsubsection{The \semiringtag{} tag}
......@@ -692,7 +692,7 @@ $\mathbb{B}$ shall be applied.
\begin{alltt}
<label_type>
<monoid type="free" generators="letters">
<generator range="ascii"/>
<generator range="implicit_alphabet"/>
</monoid>
<semiring set="B" operations="numerical"/>
</label_type>
......@@ -710,10 +710,10 @@ $\mathbb{B}$ shall be applied.
<label_type>
<monoid type="product">
<monoid type="free" generators="letters">
<generator range="ascii"/>
<generator range="implicit_alphabet"/>
</monoid>
<monoid type="free" generators="letters">
<generator range="ascii"/>
<generator range="implicit_alphabet"/>
</monoid>
</monoid>
<semiring set="B" operations="numerical"/>
......
......@@ -416,12 +416,13 @@ namespace vcsn
tools::ensure_monoid_type(node, param);
// Fill monoid with letters.
if (! node || ! node->getFirstChild())
// Default case, if there is no label tag.
// Here, implicit_alphabet range case is the default.
if (! node)
{
for (unsigned int i = 'a'; i < 'z'; ++i)
for (unsigned int i = 'a'; i <= 'z'; ++i)
param.alphabet().insert(i);
for (unsigned int i = 'A'; i < 'Z'; ++i)
for (unsigned int i = 'A'; i <= 'Z'; ++i)
param.alphabet().insert(i);
}
else
......@@ -429,9 +430,31 @@ namespace vcsn
if (n->getNodeType() == DOMNode::ELEMENT_NODE)
{
DOMElement* elt = static_cast<DOMElement*>(n);
generatorNode<T>* nd = static_cast<generatorNode<T>*>
(f.create_object(xml2str(elt->getNodeName())));
nd->process(elt, aut, param.alphabet(), m, f);
// Fill the alphabet if a range attribute exists.
if (elt->hasAttribute(STR2XML("range")))
{
if (xml2str(elt->getAttribute(STR2XML("range"))) == "implicit_alphabet")
{
for (unsigned int i = 'a'; i <= 'z'; ++i)
param.alphabet().insert(i);
for (unsigned int i = 'A'; i <= 'Z'; ++i)
param.alphabet().insert(i);
}
if (xml2str(elt->getAttribute(STR2XML("range"))) == "digits")
for (unsigned int i = '0'; i <= '9'; ++i)
param.alphabet().insert(i);
if (xml2str(elt->getAttribute(STR2XML("range"))) == "ascii")
for (unsigned char c = 0; c <= 127; ++c)
param.alphabet().insert(c);
}
// Else, add single letters.
else
{
generatorNode<T>* nd = static_cast<generatorNode<T>*>
(f.create_object(xml2str(elt->getNodeName())));
nd->process(elt, aut, param.alphabet(), m, f);
}
}
}
......
Supports Markdown
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