autodoc.git/
traditional_manual/
chapter_9.html
Branch:
Tag:
Non-build tags
All tags
No tags
2002-07-14
2002-07-14 23:24:33 by Martin Nilsson <mani@lysator.liu.se>
50af35eef7170ec7dc7c5e74eb64f084c3afac15 (
3397
lines) (+
904
/-
2493
)
[
Show
|
Annotate
]
Branch:
8.0
Build with hilfe documentation
Rev: refdoc/structure/traditional.xml:1.17
1:
<!doctype html><html><head><title>Pike Reference Manual</title> <meta charset='utf-8'></head>
-
<body><dl><dt><h1 class='header'>9.
Parsers
</h1></dt><dd><dl><dt><h2 class='header'>Module <b class='ms datatype'>
Parser.XML
</b></h2>
-
</dt><dd><dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.XML.Simple</b></h2>
+
<body><dl><dt><h1 class='header'>9.
Specific Datatype Modules
</h1></dt><dd><dl><dt><h2 class='header'>Module <b class='ms datatype'>
String
</b></h2>
</dt><dd> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
allow_rxml_entities
</b></span>
+
<span class='homogen--name'><b>
capitalize
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
void
</code> <b><span class='method'>
allow_rxml_entities
</span>(</b><code class='datatype'>
bool
</code> <code class='argument'>
yes_no
</code><b>)</b></code></p></dd>
-
</dl>
+
<dd><p><code><code class='datatype'>
string
</code> <b><span class='method'>
capitalize
</span>(</b><code class='datatype'>
string
</code> <code class='argument'>
str
</code><b>)</b></code></p></dd>
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>autoconvert</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>string</code> <b><span class='method'>autoconvert</span>(</b><code class='datatype'>string</code> <code class='argument'>xml</code><b>)</b></code></p></dd>
-
</dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>define_entity</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>void</code> <b><span class='method'>define_entity</span>(</b><code class='datatype'>string</code> <code class='argument'>entity</code>, <code class='datatype'>string</code> <code class='argument'>raw</code>, <code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>cb</code>, <code class='datatype'>mixed</code> ... <code class='argument'>extras</code><b>)</b></code></p></dd>
-
</dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>define_entity_raw</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>void</code> <b><span class='method'>define_entity_raw</span>(</b><code class='datatype'>string</code> <code class='argument'>entity</code>, <code class='datatype'>string</code> <code class='argument'>raw</code><b>)</b></code></p></dd>
-
</dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>parse_dtd</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>parse_dtd</span>(</b><code class='datatype'>string</code> <code class='argument'>dtd</code>, <code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>cb</code>, <code class='datatype'>mixed</code> ... <code class='argument'>extras</code><b>)</b></code></p></dd>
-
</dl>
-
</dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.XML.Validating</b></h2>
-
</dt><dd>
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Inherit</span>
-
<span class='homogen--name'><b>Simple</b></span>
-
</dt>
-
<dd><p><code><span class='datatype'>inherit Parser.XML.Simple</span> : <span class='inherit'>Simple</span></code></p></dd>
-
</dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>parse</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>array</code> <b><span class='method'>parse</span>(</b><code class='datatype'>string</code> <code class='argument'>data</code>, <code class='datatype'>function</code>(<code class='datatype'>string</code>, <code class='datatype'>string</code>, <code class='datatype'>mapping</code>, <code class='datatype'>array</code>|<code class='datatype'>string</code>, <code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>mixed</code>), <code class='datatype'>mixed</code> ... :<code class='datatype'>mixed</code>) <code class='argument'>callback</code>, <code class='datatype'>mixed</code> ... <code class='argument'>extra</code><b>)</b></code></p></dd>
-
<dt class='head--fixme'>FIXME</dt>
-
<dd class='body--fixme'><p>Document this function</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>parse_dtd</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>array</code> <b><span class='method'>parse_dtd</span>(</b><code class='datatype'>string</code> <code class='argument'>data</code>, <code class='datatype'>function</code>(<code class='datatype'>string</code>, <code class='datatype'>string</code>, <code class='datatype'>mapping</code>, <code class='datatype'>array</code>|<code class='datatype'>string</code>, <code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>mixed</code>), <code class='datatype'>mixed</code> ... :<code class='datatype'>mixed</code>) <code class='argument'>callback</code>, <code class='datatype'>mixed</code> ... <code class='argument'>extra</code><b>)</b></code></p></dd>
-
<dt class='head--fixme'>FIXME</dt>
-
<dd class='body--fixme'><p>Document this function</p>
-
</dd></dl>
-
</dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Parser.XML.NSTree</b></h2>
-
</dt><dd><dl class='group--doc'>
+
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
A
namespace
aware
version
of
Parser.XML.Tree. This implementation
-
does as little validation as possible, so e.g. you can call your
-
namespace xmlfoo without complaints.
<
/p>
-
</dd></dl>
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Inherit</span>
-
<span class='homogen--name'><b>Tree</b></span>
-
</dt>
-
<dd><p><
code><
span class='datatype'>inherit Parser.XML.Tree<
/
span> : <span class='inherit'>Tree</span></
code>
</p></dd>
-
</dl>
-
-
-
<hr
/>
-
<dl
class='group--doc'>
-
<dt
class='head--type'><span
class='homogen--type'>Method</span>
-
<span
class='homogen--name'><b>parse_input</b></span>
-
</dt>
-
<dd><p><code><code
class='object unresolved'>NSNode</code> <b><span class='method'>parse_input</span>(</b><code class='datatype'>string</code> <code class='argument'>data</code><b>)</b></code></p></dd>
-
-
<dt
class='head--doc'>Description</dt>
-
<dd
class='body--doc'><p>Takes a XML
string
<code>data</code> and produces a namespace node tree
.</p>
+
<dd class='body--doc'><p>
Convert
the
first
character
in
<code>
str
</code>
to
upper
case,
and
return
the
+
new
string.</p>
</dd>
-
<dt class='head--doc'>
Throws
</dt>
-
<dd class='body--doc'><p>
Throws an
<code>
error
</code>
when an error is encountered during XML
-
parsing.
</p>
+
<dt class='head--doc'>
See also
</dt>
+
<dd class='body--doc'><p><code>
lower_case()
</code>
,
<
code>upper_case()<
/
code></
p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
visualize
</b></span>
+
<span class='homogen--name'><b>
common_prefix
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>string</code> <b><span class='method'>
visualize
</span>(</b><code class='
object unresolved'>Node</code> <code class='argument'>n</code>, <code class='
datatype'>
void
</code>
|
<code class='datatype'>string</code> <code class='argument'>
indent
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>string</code> <b><span class='method'>
common_prefix
</span>(</b><code class='datatype'>
array
</code>
(
<code class='datatype'>string</code>
)
<code class='argument'>
strs
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Makes
a
visualization
of
a
node
graph
suitable
for
-
printing out on a terminal
.</p>
-
</dd>
-
<dt class='head--doc'>Example</dt>
-
<dd class='example'><pre><p>> object x = parse_input("<a><b><c/>d</b><b><e/><f>g</f></b></a>");
-
> write(visualize(x));
-
Node(ROOT)
-
NSNode(ELEMENT,"a")
-
NSNode(ELEMENT,"b")
-
NSNode(ELEMENT,"c")
-
NSNode(TEXT)
-
NSNode(ELEMENT,"b")
-
NSNode(ELEMENT,"e")
-
NSNode(ELEMENT,"f")
-
NSNode(TEXT)
-
Result 1: 201</p>
-
</pre></dd></dl>
-
<dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.XML.NSTree.NSNode</b></h2>
-
</dt><dd><dl class='group--doc'>
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Namespace aware node.</p>
+
<dd class='body--doc'><p>
Find
the
longest
common
prefix
from
an
array
of
strings
.</p>
</dd></dl>
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>diff_namespaces</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>string</code>) <b><span class='method'>diff_namespaces</span>(</b><b>)</b></code></p></dd>
+
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Returns the difference between this nodes and its parents namespaces.</p>
-
</dd></dl>
-
-
+
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get
_
default_ns
</b></span>
+
<span class='homogen--name'><b>
expand
_
tabs
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>string</code> <b><span class='method'>
get
_
default_ns
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>string</code> <b><span class='method'>
expand
_
tabs
</span>(</b><
code class='datatype'>string</code> <code class='argument'>s</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>tab_width</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>substitute_tab</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>substitute_space</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>substitute_newline</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
the
default
namespace
in
the
current
scope
.</p>
+
<dd class='body--doc'><p>
Expands
tabs
in
a
string
to
ordinary
spaces, according to common
+
tabulation rules
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get_defined_nss
</b></span>
+
<span class='homogen--name'><b>
fuzzymatch
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
mapping
</code>(<code class='datatype'>string</code>
:
<code class='
datatype
'>
string
</code>
)
<
b><span
class='
method
'>
get_defined_nss
</
span
>
(
<
/
b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
int(0..100)
</code>
<b><span class='method'>fuzzymatch</span>
(<
/b><
code class='datatype'>string</code>
<code class='
argument
'>
a
</code>
,
<
code
class='
datatype
'>
string
</
code
>
<
code class='argument'>b<
/
code
><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
a
mapping
with
all
the
namespaces
defined
in
the
current
-
scope
,
except
the
default
namespace
.</p>
+
<dd class='body--doc'><p>
This
function
compares
two
strings
using
a
fuzzy
matching
+
routine. The higher
the
resulting
value
,
the
better
the
strings
match
.</p>
</dd>
-
<dt class='head--doc'>
Note
</dt>
-
<dd class='body--doc'><p>
The return mapping is the same as the one in the node
,
so
-
destructive changes will affect the node
.</p>
+
<dt class='head--doc'>
See also
</dt>
+
<dd class='body--doc'><p>
<code>Array.diff()</code>
,
<code>Array.diff_compare_table()</code>
+
<code>Array
.
diff_longest_sequence()
</
code></
p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get
_
ns
</b></span>
+
<span class='homogen--name'><b>
implode
_
nicely
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>string</code> <b><span class='method'>
get
_
ns
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>string</code> <b><span class='method'>
implode
_
nicely
</span>(</b><
code class='datatype'>array</code>(<code class='datatype'>string</code>|<code class='datatype'>int</code>|<code class='datatype'>float</code>) <code class='argument'>foo</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>separator</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
the
namespace
in
which
the
current
element
is
defined
in
.</p>
+
<dd class='body--doc'><p>
This
function implodes a list of words to a readable string, e.g.
+
({"straw","berry","pie"}) becomes "straw, berry and pie".
+
If
the
separator
is
omitted,
the
default
is
<tt>"and"</tt>.
+
If the words are numbers they are converted to strings first
.</p>
+
</dd>
+
<dt class='head--doc'>See also</dt>
+
<dd class='body--doc'><p><code>`*()</code></p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get_ns_attributes
</b></span>
+
<span class='homogen--name'><b>
int2roman
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
mapping
</code>
(<code
class='datatype'>string
<
/code
>
:
<
code
class='
datatype
'>
mapping
</
code
>(<
code class='datatype'>string<
/
code
>
:
<code class='datatype'>
string
</code>
))
<
b><span
class='
method
'>
get_ns_attributes
</
span
>
(
<
/
b>
<b>
)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
string
</code> <
b
><
span
class='
method
'>
int2roman
</
span
>(</
b
><code class='datatype'>
int
</code> <
code
class='
argument
'>
m
</
code
><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
all
the
attributes
in
all
namespaces
that
is
associated
with
-
this node
.</p>
+
<dd class='body--doc'><p>
Converts
the
provided
integer
to
a
roman
integer
(i.e.
a
string)
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get_ns_attributes
</b></span>
+
<span class='homogen--name'><b>
int2size
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
mapping</code>(<code class='datatype'>
string</code>
:<code
class='datatype'>string
<
/code>) <
b><span class='method'>
get_ns_attributes
</span>(</b><code class='datatype'>
string
</code> <code class='argument'>
namespace
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>string</code> <b><span class='method'>
int2size
</span>(</b><code class='datatype'>
int
</code> <code class='argument'>
size
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Returns the
attributes
in
this
node
that
is
declared
in
the
provided
-
namespace
.</p>
+
<dd class='body--doc'><p>Returns the
size
as
a
memory
size
string with suffix,
+
e.g. 43210
is
converted
into
"42.2 kb". To be correct
+
to
the
latest standards it should really read "42.2 KiB",
+
but we have chosen to keep the old notation for a while
.
+
The function knows about the quantifiers kilo, mega, giga,
+
tera, peta, exa, zetta and yotta.
</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get_xml_name
</b></span>
+
<span class='homogen--name'><b>
sillycaps
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>string</code> <b><span class='method'>
get_xml_name
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>string</code> <b><span class='method'>
sillycaps
</span>(</b><
code class='datatype'>string</code> <code class='argument'>str</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
the
element
name
as it occurs
in
xml
files.
E.g.
-
"zonk:name"
for
the element "name" defined
in
a namespace
-
denoted
with
"zonk".
It
will
look
up a symbol for
the
namespace
-
in the symbol tables for the node and its parents. If none is
-
found a
new
label will be generated by hashing the namespace
.</p>
+
<dd class='body--doc'><p>
Convert
the
first
character
in
each
word
(separated
by
spaces)
in
+
<code>str</code>
to
upper
case,
and
return
the new
string
.</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Inherit</span>
-
<span class='homogen--name'><b>Node</b></span>
-
</dt>
-
<dd><p><code><span class='datatype'>inherit Node</span> : <span class='inherit'>Node</span></code></p></dd>
-
</dl>
-
-
-
<hr />
-
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
remove_child
</b></span>
+
<span class='homogen--name'><b>
soundex
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
void
</code> <b><span class='method'>
remove_child
</span>(</b><code class='
object unresolved
'>
NSNode
</code> <code class='argument'>
child
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
string
</code> <b><span class='method'>
soundex
</span>(</b><code class='
datatype
'>
string
</code> <code class='argument'>
word
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
The
remove_child
is
a
not
updated
to
take
care
of
name
-
space
issues
.
To
properly
remove
all
the
parents
name
spaces
-
from
the
chid,
call
<code>remove_node</code>
in
the
child
.</p>
+
<dd class='body--doc'><p>
Returns
the
soundex
value
of
<code>word</code>
according
to
+
the
original
Soundex
algorithm, patented by Margaret O´Dell
+
and
Robert C
.
Russel
in
1918.
The
method
is
based
on the phonetic
+
classification
of
sounds
by
how
they
are
made
.</p>
</dd></dl>
-
</dd></dl></dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Parser.XML.Tree</b></h2>
-
</dt><dd>
+
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Constant</span>
-
<span class='homogen--name'><b>STOP_WALK</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>constant</code> <code class='datatype'>int</code> Parser.XML.Tree.<code class='constant'>STOP_WALK</code></code></p></dd>
-
</dl>
+
-
+
<hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Constant</span>
-
<span class='homogen--name'><b>XML_ATTR</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>constant</code> <code class='datatype'>int</code> Parser.XML.Tree.<code class='constant'>XML_ATTR</code></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Attribute nodes are created on demand</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Constant</span>
-
<span class='homogen--name'><b>XML_COMMENT</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>constant</code> <code class='datatype'>int</code> Parser.XML.Tree.<code class='constant'>XML_COMMENT</code></code></p></dd>
-
</dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Constant</span>
-
<span class='homogen--name'><b>XML_DOCTYPE</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>constant</code> <code class='datatype'>int</code> Parser.XML.Tree.<code class='constant'>XML_DOCTYPE</code></code></p></dd>
-
</dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Constant</span>
-
<span class='homogen--name'><b>XML_ELEMENT</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>constant</code> <code class='datatype'>int</code> Parser.XML.Tree.<code class='constant'>XML_ELEMENT</code></code></p></dd>
-
</dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Constant</span>
-
<span class='homogen--name'><b>XML_HEADER</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>constant</code> <code class='datatype'>int</code> Parser.XML.Tree.<code class='constant'>XML_HEADER</code></code></p></dd>
-
</dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Constant</span>
-
<span class='homogen--name'><b>XML_NODE</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>constant</code> Parser.XML.Tree.<code class='constant'>XML_NODE</code></code></p></dd>
-
</dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Constant</span>
-
<span class='homogen--name'><b>XML_PI</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>constant</code> <code class='datatype'>int</code> Parser.XML.Tree.<code class='constant'>XML_PI</code></code></p></dd>
-
</dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Constant</span>
-
<span class='homogen--name'><b>XML_ROOT</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>constant</code> <code class='datatype'>int</code> Parser.XML.Tree.<code class='constant'>XML_ROOT</code></code></p></dd>
-
</dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Constant</span>
-
<span class='homogen--name'><b>XML_TEXT</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>constant</code> <code class='datatype'>int</code> Parser.XML.Tree.<code class='constant'>XML_TEXT</code></code></p></dd>
-
</dl>
-
-
-
<hr />
-
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
parse_file
</b></span>
+
<span class='homogen--name'><b>
strmult
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
Node
</code> <b><span class='method'>
parse_file
</span>(</b><code class='datatype'>string</code> <code class='argument'>
path
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
string
</code> <b><span class='method'>
strmult
</span>(</b><code class='datatype'>string</code> <code class='argument'>
str
</code>
,
<
code class='datatype'>int</code> <code class='argument'>num</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Loads
the
XML
file
<code>
path
</code>
,
creates
a node tree representation and
-
returns the root node.
<
/p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>parse_input</b></span>
-
</dt>
-
<dd><p><
code><
code class='object unresolved'>Node<
/code>
<b><span class='method'>parse_input</span>(</b><code class='datatype'>string</code> <code class='argument'>data</code>, <code class='datatype'>void</code>|<code class='datatype'>bool</code> <code class='argument'>no_fallback</code>, <code class='datatype'>void</code>|<code class='datatype'>bool</code> <code class='argument'>force_lowercase</code><b>)</b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Takes a XML string and produces a node tree
.
</p>
-
</dd></dl>
-
-
-
<hr
/>
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>parse_xml_callback</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>parse_xml_callback</span>(</b><code class='datatype'>string</code> <code class='argument'>type</code>, <code class='datatype'>string</code> <code class='argument'>name</code>, <code class='datatype'>mapping</code> <code class='argument'>attr</code>, <code class='datatype'>string</code>|<code class='datatype'>array</code> <code class='argument'>contents</code>, <code class='datatype'>mixed</code> <code class='argument'>location</code>, <code class='datatype'>mixed</code> ... <code class='argument'>extra</code><b>)</b></code></p></dd>
-
</dl>
-
<dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.XML.Tree.AbstractNode</b></h2>
-
</dt><dd>
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>`[]</b></span>
-
</dt>
-
<dd><p><code><code class='object unresolved'>AbstractNode</code> res = <code class='class'>Parser.XML.Tree.AbstractNode()</code>[ <code class='class'>pos</code> ]</code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
The
[]
operator
indexes
among
the
node
children,
so
-
<code
class='expr'
>
node[0]
</code>
returns
the
first
node
and
<code
class='expr'
>
node[-1]
</code>
the last
.</p>
+
<dd class='body--doc'><p>
This
function
multiplies
<code>
str
</code>
by
<code>
num
</code>. The
return
value
is
the
same
+
as
appending
<code>
str
</code>
to
an
empty
string
<code>
num
</code>
times
.</p>
</dd> <dt class='head--doc'>Note</dt>
-
<dd class='body--doc'><p>
The
[]
operator
will select a node from all the nodes children
,
-
not
just
its
element children.</p>
-
</dd></dl>
-
-
-
<hr
/>
-
<dl
class='group--doc'>
-
<
dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>add_child</b></span>
-
</dt>
-
<dd><p><
code>
<code class='object unresolved'>AbstractNode</code> <b><span class='method'>add_child</span>
(
</b><code class='object unresolved'>AbstractNode</code> <code class='argument'>c</code><b>
)</
b></
code>
</p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Adds a child node to this node
.
The child node is
-
added last in the child list and its parent reference
-
is updated.
</p>
+
<dd class='body--doc'><p>
This
function
is
obsolete
,
since
this
functionality
has
been
incorporated
+
into
<code>
`*
()</code>.</p>
</dd>
-
<dt class='head--doc'>
Returns
</dt>
-
<dd class='body--doc'><p>
The updated child node is returned.
</p>
+
<dt class='head--doc'>
See also
</dt>
+
<dd class='body--doc'><p><
code>`*()<
/
code></
p>
</dd></dl>
-
+
<dl><dt><h2 class='header'>Class <b class='ms datatype'>String.SplitIterator</b></h2>
+
</dt><dd>
-
+
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
clone
</b></span>
+
<span class='homogen--name'><b>
create
</b></span>
</dt>
-
<dd><p><code><
code
class='object
unresolved
'>
AbstractNode
</
code
> <
b><
span class='
method
'>
clone
</span>(</b><code class='datatype'>
void
</code>|<code class='datatype'>int(
-1..1
)</code> <code class='argument'>
direction
</code><b>)</b></code></p></dd>
+
<dd><p><code><
span
class='object'>
String.SplitIterator
</
span
> <span class='
class
'>
String.SplitIterator
</span>
<b>
(</b><code class='datatype'>
string
</code>
<code class='argument'>buffer</code>, <code class='datatype'>int</code>
|<code class='datatype'>
array</code>(<code class='datatype'>
int
</code>)|<code class='datatype'>multiset</code>
(
<code class='datatype'>int</code>
)
<
code class='argument'>split_set<
/code>
,
<code class='
datatype'>int</code>|<code class='datatype'>void</code> <code class='
argument'>
flags
</code>
,
<
code class='datatype'>function</code>(:<code class='datatype'>string</code>)|<code class='datatype'>void</code> <code class='argument'>feed</code><
b>)</b></code></p></dd>
+
</dl>
+
</dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>String.Elite</b></h2>
+
</dt><dd>
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Returns the corresponding node in a clone of the tree.</p>
-
</dd></dl>
-
-
+
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
count
_
children
</b></span>
+
<span class='homogen--name'><b>
elite
_
string
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
int
</code> <b><span class='method'>
count
_
children
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
string
</code> <b><span class='method'>
elite
_
string
</span>(</b><
code class='datatype'>string</code> <code class='argument'>in</code>, <code class='datatype'>void</code>|<code class='datatype'>int(0..100)</code> <code class='argument'>leetp</code>, <code class='datatype'>void</code>|<code class='datatype'>bool</code> <code class='argument'>eightbit</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
the
number
of
children
of
the
node
.</p>
+
<dd class='body--doc'><p>
Translates
a string to 1337. The optional
+
argument leetp is
the
maximum
percentage
of
+
leetness
(100=max
leet, 0=no leet).</p>
+
<p> The translation is performed in three steps,
+
first
the
neccesary elite translations (picture -> pic,
+
cool->kewl etc), then optional translations
+
(ok->k, dude->dood, -ers -> -orz), then
+
calls elite_word on the resulting words
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get
_
ancestors
</b></span>
+
<span class='homogen--name'><b>
elite
_
word
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
array
</code>(<code class='
object unresolved
'>
AbstractNode
</code>
)
<
b
><
span
class='
method
'>
get_ancestors
</
span
>(</
b
><code class='datatype'>
bool
</code> <code class='argument'>
include_self
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
string
</code>
<b><span class='method'>elite_word</span>
(<
/b><
code class='
datatype
'>
string
</code> <
code class='argument'
>
in
<
/code>,
<code
class='
datatype
'>
void
</
code
>
|<code class='datatype'>int
(
0..100)
</
code
>
<code class='
argument'>leetp</code>, <code class='
datatype'>
void
</code>
|<code
class='datatype'>int(0..2)
<
/
code
>
<code
class='argument'>
eightbit
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
a
list
of
all
ancestors,
with
the
top
node
last
.
-
The
list
will
start
with
this
node
if
<code>include_self</code>
is
set
.</p>
+
<dd class='body--doc'><p>
Translates
one
word
to
1337.
The
optional
+
argument leetp is
the
maximum
percentage
of
+
leetness (100=max leet, 0=no leet)
.
+
elite_word
only
do
character-based
translation,
+
for
instance
from
"k"
to
"|<", but no language
+
translation (no "cool" to "kewl")
.</p>
</dd></dl>
-
-
-
<
hr
/>
-
<dl
class='group--doc'
>
-
<dt
class='head--type'
><
span
class='
homogen--type
'>
Method
<
/span>
-
<span
class='
homogen--name
'><
b>get_children<
/b></
span
>
-
</dt>
-
<dd><
p><code><code
class='
datatype
'>
array</code>(<code class='object unresolved'>AbstractNode</code>) <b><span class='method'>get_children</span>(</b><b>)</b></code></p></dd>
-
+
</
dd
><
/
dl><
dl><
dt><
h2
class='
header
'>
Module
<
b
class='
ms datatype
'>
String.HTML
</b></
h2
>
+
</dt><dd><
dl
class='
group--doc
'>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
all
the
nodes
children
.</p>
+
<dd class='body--doc'><p>
Functions
that
helps
generating
HTML
.
All functions generates
+
HTML that is XHTML compliant as well as backwards compatible
+
with old HTML standards in what extent is possible.
</p>
</dd></dl>
-
+
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get
_
descendants
</b></span>
+
<span class='homogen--name'><b>
pad
_
rows
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>array</code>(<code class='
object
unresolved
'>
AbstractNode
</code>) <b><span class='method'>
get
_
descendants
</span>(</b><code class='datatype'>
bool
</code> <code class='argument'>
include_self
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>array</code>(<code class='
datatype'>array</code>(<code
class=
'
datatype'
>
string
</code>)
)
<b><span class='method'>
pad
_
rows
</span>(</b><code class='datatype'>
array
</code>
(<code
class='datatype'>array
<
/
code
>(<code
class='
datatype'>string</code>)) <code class='
argument'>
rows
</code>
,
<
code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>padding</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
a
list
of
all
descendants
in
document order
.
Includes
-
this
node
if
<code>
include_self
</code>
is
set
.</p>
+
<dd class='body--doc'><p>
Pads
out the rows in
a
array
of
rows
to
equal
length
.
The new elements in
+
the
rows
will
have the value provided in
<code>
padding
</code>
,
or
"&nbsp;"
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get_following
</b></span>
+
<span class='homogen--name'><b>
select
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
array
</code>(<code class='
object
unresolved
'>
AbstractNode
</code>) <
b
><
span
class='
method
'>
get_following
</
span
>(</
b
><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
string
</code>
<b><span class='method'>select</span>
(<
/b><
code class='
datatype'>string</code>
<code class=
'
argument'
>
name
</code>
, <code class='datatype'>array</code>(<code class='datatype'>string</code>
)
|<code
class='datatype'>array
<
/code
>
(
<
code
class='
datatype
'>
array
</
code
>(<
code class='datatype'>string<
/
code
>
))
<
code class='argument'>choices</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>selected</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
all
the
nodes
that
follows
after
the
current
one
.</p>
-
</dd></dl>
+
<dd class='body--doc'><p>
Creates
an
HTML select list.</p>
+
</dd>
+
<dt class='head--doc'><span id='p-name'></span>Parameter <code class='parameter'>name</code></dt>
+
<dd></dd><dd class='body--doc'><p>The name of
the
select
list.
Will
be
used in
the
name
attribute
+
of the select element
.</p>
+
</dd>
+
<
dt class='head--doc'><span id='p-choices'><
/
span>Parameter <code class='parameter'>choices</code></dt>
+
<dd></dd><dd class='body--doc'><p>May either be an array of strings, where each string is a choice,
+
or an array of pairs. A pair is an array with two strings. The
+
first string is the value of the choice while the second string
+
is the presentation text associated with the value.</p>
+
</dd>
+
<dt class='head--doc'><span id='p-selected'></span>Parameter <code class='parameter'>selected</code></dt>
+
<dd></dd><dd class='body--doc'><p>The value that should be selected by default, if any.</p>
+
</dd>
+
<dt class='head--doc'>Example</dt>
+
<dd class='example'><pre><p>select("language",
+
({ ({ "eng", "English" }),
+
({ "swe", "Swedish" }),
+
({ "nor", "Norwegian" }) }),
+
"swe");</p>
+
</pre></dd></
dl>
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get
_
following_siblings
</b></span>
+
<span class='homogen--name'><b>
simple
_
obox
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>array</code>(<code class='
object
unresolved
'>
AbstractNode
</code>) <
b
><
span
class='
method
'>
get
_
following
_
siblings
</
span
>(</
b
><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
string</code> <b><span class='method'>simple_obox</span>(</b><code class='datatype'>
array</code>(<code class='
datatype'>array</code>(<code
class=
'
datatype'
>
string
</code>)
)
<
code class='argument'
>
rows
<
/code>,
<code
class='
datatype
'>
void</code>|<code class='datatype'>string</code> <code class='argument'>frame
_
color</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>cell
_
color
</
code
>
, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>width</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>padding</code>, <code class='datatype'>void</code>|<code class='datatype'>function</code>
(<
code class='datatype'>int<
/
code
>
,
<
code class='datatype'>int</code>, <code class='datatype'>string</code>, <code class='datatype'>string</code>:<code class='datatype'>string</code>) <code class='argument'>cell_callback</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
all
following
siblings
,
i
.
e
.
all
siblings
present
after
this
node
-
in the
parents
children
list
.</p>
+
<dd class='body--doc'><p>
This
function should solve most of the obox needs that arises. It creates a table out
+
of the array of arrays of strings fed into it. The tables will (with default settings)
+
have a thin black outline around the table and between its cells. Much effort has gone
+
into finding a simple HTML reresentation of such obox that is rendered in a similar way
+
in
all
popular
browsers. The current implementation has been tested against IE
,
Netscape,
+
Mozilla, Opera and Konquest
.
</p>
+
</dd>
+
<dt class='head--doc'><span id='p-rows'></span>Parameter <code class='parameter'>rows</code></dt>
+
<dd></dd><dd class='body--doc'><p>Simply an array of arrays with strings
.
The
strings
are
the
values
that should appear
+
in the
table
cells.
All rows should have equal number of cells, otherwise the result
+
will not be very eye pleasing
.</p>
+
</dd>
+
<dt class='head--doc'><span id='p-frame_color'></span>Parameter <code class='parameter'>frame_color</code></dt>
+
<dd></dd><dd class='body--doc'><p>The color of the surrounding frame. Defaults to "#000000".</p>
+
</dd>
+
<dt class='head--doc'><span id='p-cell_color'></span>Parameter <code class='parameter'>cell_color</code></dt>
+
<dd></dd><dd class='body--doc'><p>The background color of the cells. Defaults to "#ffffff".</p>
+
</dd>
+
<dt class='head--doc'><span id='p-width'></span>Parameter <code class='parameter'>width</code></dt>
+
<dd></dd><dd class='body--doc'><p>The border width. Defaults to "1".</p>
+
</dd>
+
<dt class='head--doc'><span id='p-padding'></span>Parameter <code class='parameter'>padding</code></dt>
+
<dd></dd><dd class='body--doc'><p>The amount of padding in each cell. Defaults to "3".</p>
+
</dd>
+
<dt class='head--doc'><span id='p-cell_callback'></span>Parameter <code class='parameter'>cell_callback</code></dt>
+
<dd></dd><dd class='body--doc'><p>If provided, the cell callback will be called for each cell. As in parameters it
+
will get the current x and y coordinates in the table. The upper left cell is 0,0.
+
In addition to the coordinates it will also recieve the background color and the
+
contents of the current cell. It is expected to return a td-element.</p>
+
</dd>
+
<dt class='head--doc'>Example</dt>
+
<dd class='example'><pre><p>function cb = lambda(int x, int y, string bgcolor, string contents) {
+
if(y%2) return "<td bgcolor='#aaaaff'>"+contents+"</td>";
+
return "<td bgcolor='"+bgcolor+"'>"+contents+"</td>";
+
}
+
simple_obox(my_rows, "#0000a0", 0, "1", "3", cb);</p>
+
</pre></dd>
+
<dt class='head--doc'>See also</dt>
+
<dd class='body--doc'><p>pad_rows</p>
</dd></dl>
-
-
-
<
hr />
-
<
dl
class='group--doc'
>
-
<dt
class='head--type'
><
span
class='
homogen--type
'>
Method
<
/span>
-
<span
class='
homogen--name
'><
b>get_last_child<
/b></
span
>
-
</dt>
-
<dd><
p><code><code
class='
object unresolved
'>
AbstractNode</code> <b><span class='method'>get_last_child</span>(</b><b>)</b></code></p></dd>
-
+
<dl><dt><
h2
class='
header
'>
Class
<
b
class='
ms datatype
'>
String.HTML.OBox
</b></
h2
>
+
</dt><dd><
dl
class='
group--doc
'>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
the
last
childe
node
or
zero
.</p>
+
<dd class='body--doc'><p>
Provides
the
same
functionality
as
the
<code>simple_obox</code> function,
+
in a "streaming" way
.
The real gain is different addtition methods
+
as well as the possibility to change the cell callback at any time.
</p>
+
</dd>
+
<dt class='head--doc'>See also</dt>
+
<dd class='body--doc'><p>simple_obox</p>
</dd></dl>
-
+
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get
_
parent
</b></span>
+
<span class='homogen--name'><b>
add
_
cell
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
AbstractNode
</code> <b><span class='method'>
get
_
parent
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
void
</code> <b><span class='method'>
add
_
cell
</span>(</b><
code class='datatype'>string</code> <code class='argument'>contents</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
the
parent
node
.</p>
+
<dd class='body--doc'><p>
Adds
a cell with
the
provided
content
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get
_
preceding
</b></span>
+
<span class='homogen--name'><b>
add
_
raw_cell
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
array
</code>
(
<
code
class='
object unresolved
'>
AbstractNode
</
code
>
)
<b><
span
class='
method
'>
get_preceding
</
span
>
(
</
b
><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
void
</code>
<
b><span
class='
method
'>
add_raw_cell
</
span
>
(
<
/
b><
code
class='
datatype
'>
string
</
code
>
<
code class='argument'>cell<
/
code
><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
all
preceding
nodes
,
excluding
this
nodes
ancestors
.</p>
+
<dd class='body--doc'><p>
Adds
this
cell
to the table unmodified
,
e.g.
it
should
have an enclosing
+
td or th element
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get
_
preceding_siblings
</b></span>
+
<span class='homogen--name'><b>
add
_
row
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
array
</code>
(
<
code
class='
object unresolved
'>
AbstractNode
</
code
>
)
<b><
span
class='
method
'>
get_preceding_siblings
</
span
>(</
b
><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
void
</code>
<
b><span
class='
method
'>
add_row
</
span
>
(
<
/
b><
code
class='
datatype
'>
array
</
code
>(<
code class='datatype'>string<
/
code
>
)
<
code class='argument'>cells</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
all
preceding
siblings, i
.
e.
all
siblings
present
before
this
node
-
in
the
parents
children
list
.</p>
+
<dd class='body--doc'><p>
Adds
a
complete
row
.
If
the
current
row
is
nonempty a
+
new
row
will
be
started
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get
_
root
</b></span>
+
<span class='homogen--name'><b>
add
_
tagdata_cell
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
AbstractNode
</code> <b><span class='method'>
get
_
root
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
void
</code> <b><span class='method'>
add
_
tagdata_cell
</span>(</b><
code class='datatype'>string</code> <code class='argument'>tag</code>, <code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>string</code>) <code class='argument'>args</code>, <code class='datatype'>string</code> <code class='argument'>contents</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Follows
all
parent
pointers and returns the root node.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>get_siblings</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>array</code>(<code class='object unresolved'>AbstractNode</code>) <b><span class='method'>get_siblings</span>(</b><b>)</b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Returns all siblings, including this node.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>iterate_children</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>int</code>|<code class='datatype'>void</code> <b><span class='method'>iterate_children</span>(</b><code class='datatype'>function</code>(<code class='object unresolved'>AbstractNode</code>, <code class='datatype'>mixed</code> ... :<code class='datatype'>int</code>|<code class='datatype'>void</code>) <code class='argument'>callback</code>, <code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Iterates over the nodes children
from
left to right, calling
the
callback
-
function
for every node. If the callback function returns <code>STOP_WALK</code>
-
the iteration is promptly aborted
and
<code>STOP_WALK</code>
is
returned.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>remove_child</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>void</code> <b><span class='method'>remove_child</span>(</b><code class='object unresolved'>AbstractNode</code> <code class='argument'>c</code><b>)</b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Removes all occurences of the provided node from the called nodes
-
list of children. The removed nodes parent reference is set
to
null.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>remove_node</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>void</code> <b><span class='method'>remove_node</span>(</b><b>)</b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Removes this node from its parent. The parent reference is set to null.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>replace_child</b></span>
-
</dt>
-
<dd><p><code><code class='object unresolved'>AbstractNode</code> <b><span class='method'>replace_child</span>(</b><code class='object unresolved'>AbstractNode</code> <code class='argument'>old</code>, <code class='object unresolved'>AbstractNode</code> <code class='argument'>new</code><b>)</b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Replaces
the
first occurence of the old node child with
-
the new node child
.
All parent references are updated.
</p>
+
<dd class='body--doc'><p>
Creates
a
cell
from the
provided
arguments
and
adds
it
to the
table
.</p>
</dd>
-
<dt class='head--doc'>
Returns
<
/dt>
-
<dd
class
='
body--doc'><
p
>Returns the new child node.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group
-
-doc
'>
-
<
dt class='head--type'><span class='homogen--type'>Method<
/span>
-
<
span
class='
homogen--name
'><
b>replace_children<
/
b
></
span>
-
</
dt>
-
<dd><
p><code><code class='datatype'>void<
/
code> <b><span class='method'>replace_children</span>(</b><code class='datatype'>array</code>(<code class='object unresolved'>AbstractNode</code>) <code class='argument'>children</code><b>)</b></code></p></
dd>
-
-
<
dt class='head--doc'>Description</dt>
-
<
dd class='body--doc'><p>
Replaces
the
nodes
children with
the
provided
ones.
All
parent
-
references are updated
.
</p>
-
</dd></dl>
-
-
-
<hr
/>
-
<dl
class='group--doc'>
-
<dt
class='head--type'><span
class='homogen--type'>Method</span>
-
<span
class='homogen--name'><b>replace_node</b></span>
-
</dt>
-
<dd><p><code><code
class='object unresolved'>AbstractNode</code> <b><span class='method'>replace_node</span>(</b><code class='object unresolved'>AbstractNode</code> <code class='argument'>new</code><b>)</b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Replaces this node with the provided one
.</p>
+
<dt class='head--doc'><
span
id
='p-
tag
'></span>
Parameter
<
code
class='
parameter
'>
tag
</
code
></dt>
+
<dd></dd><dd class='body--doc'><p>
The
name
of
the
element
that
should
be
produces
.
Typically
+
"td"
or
"th"
.</p>
</dd>
-
<dt class='head--doc'>
Returns
</dt>
-
<dd class='body--doc'><p>
Returns
the
new
node
.</p>
+
<dt class='head--doc'><
span id='p-args'><
/
span>Parameter <code class='parameter'>args</code></
dt>
+
<dd
></dd><dd
class='body--doc'><p>
A
mapping with
the
elements
attributes
.</p>
+
</dd>
+
<dt class='head--doc'><span id='p-contents'></span>Parameter <code class='parameter'>contents</code></dt>
+
<dd></dd><dd class='body--doc'><p>The element contents.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>set_parent</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_parent</span>(</b><code class='object unresolved'>AbstractNode</code> <code class='argument'>parent</code><b>)</b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Sets the parent node to <code>parent</code>.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>walk_inorder</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>int</code>|<code class='datatype'>void</code> <b><span class='method'>walk_inorder</span>(</b><code class='datatype'>function</code>(<code class='object unresolved'>AbstractNode</code>, <code class='datatype'>mixed</code> ... :<code class='datatype'>int</code>|<code class='datatype'>void</code>) <code class='argument'>callback</code>, <code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Traverse the node subtree in inorder, left subtree first, then
-
root node, and finally the remaining subtrees, calling the callback
-
function for every node. If the callback function returns
-
<code>STOP_WALK</code> the traverse is promptly aborted and <code>STOP_WALK</code>
-
is returned.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>walk_postorder</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>int</code>|<code class='datatype'>void</code> <b><span class='method'>walk_postorder</span>(</b><code class='datatype'>function</code>(<code class='object unresolved'>AbstractNode</code>, <code class='datatype'>mixed</code> ... :<code class='datatype'>int</code>|<code class='datatype'>void</code>) <code class='argument'>callback</code>, <code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Traverse the node subtree in postorder, first subtrees from left to
-
right, then the root node, calling the callback function for every
-
node. If the callback function returns <code>STOP_WALK</code> the traverse
-
is promptly aborted and <code>STOP_WALK</code> is returned.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>walk_preorder</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>int</code>|<code class='datatype'>void</code> <b><span class='method'>walk_preorder</span>(</b><code class='datatype'>function</code>(<code class='object unresolved'>AbstractNode</code>, <code class='datatype'>mixed</code> ... :<code class='datatype'>int</code>|<code class='datatype'>void</code>) <code class='argument'>callback</code>, <code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Traverse the node subtree in preorder, root node first, then
-
subtrees from left to right, calling the callback function
-
for every node. If the callback function returns <code>STOP_WALK</code>
-
the traverse is promptly aborted and <code>STOP_WALK</code> is returned.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>walk_preorder_2</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>int</code>|<code class='datatype'>void</code> <b><span class='method'>walk_preorder_2</span>(</b><code class='datatype'>function</code>(<code class='object unresolved'>AbstractNode</code>, <code class='datatype'>mixed</code> ... :<code class='datatype'>int</code>|<code class='datatype'>void</code>) <code class='argument'>callback_1</code>, <code class='datatype'>function</code>(<code class='object unresolved'>AbstractNode</code>, <code class='datatype'>mixed</code> ... :<code class='datatype'>int</code>|<code class='datatype'>void</code>) <code class='argument'>callback_2</code>, <code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Traverse the node subtree in preorder, root node first, then
-
subtrees from left to right. For each node we call callback_1
-
before iterating through children, and then callback_2
-
(which always gets called even if the walk is aborted earlier).
-
If the callback function returns <code>STOP_WALK</code> the traverse
-
decend is aborted and <code>STOP_WALK</code> is returned once all waiting
-
callback_2 functions has been called.</p>
-
</dd></dl>
-
</dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.XML.Tree.Node</b></h2>
-
</dt><dd><dl class='group--doc'>
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Node in XML tree</p>
-
</dd></dl>
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
+
<span class='homogen--name'><b>cast</b></span> </dt>
-
<dd><p><code><b>(</b><span class='datatype'>int</span><b>)</b><span class='class'>
Parser
.
XML
.
Tree.Node
</span>()<br><b>(</b><span class='datatype'>float</span><b>)</b><span class='class'>
Parser
.
XML
.
Tree.Node
</span>()<br><b>(</b><span class='datatype'>string</span><b>)</b><span class='class'>
Parser
.
XML
.
Tree.Node
</span>()<br><b>(</b><span class='datatype'>array</span><b>)</b><span class='class'>
Parser
.
XML
.
Tree.Node
</span>()<br><b>(</b><span class='datatype'>mapping</span><b>)</b><span class='class'>
Parser
.
XML
.
Tree.Node
</span>()<br><b>(</b><span class='datatype'>multiset</span><b>)</b><span class='class'>
Parser
.
XML
.
Tree.Node
</span>()</code></p></dd>
+
<dd><p><code><b>(</b><span class='datatype'>int</span><b>)</b><span class='class'>
String
.
HTML
.
OBox
</span>()<br><b>(</b><span class='datatype'>float</span><b>)</b><span class='class'>
String
.
HTML
.
OBox
</span>()<br><b>(</b><span class='datatype'>string</span><b>)</b><span class='class'>
String
.
HTML
.
OBox
</span>()<br><b>(</b><span class='datatype'>array</span><b>)</b><span class='class'>
String
.
HTML
.
OBox
</span>()<br><b>(</b><span class='datatype'>mapping</span><b>)</b><span class='class'>
String
.
HTML
.
OBox
</span>()<br><b>(</b><span class='datatype'>multiset</span><b>)</b><span class='class'>
String
.
HTML
.
OBox
</span>()</code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>It is possible to
cast
a
node
to a string, which
will
return
-
<code>render
_xml()
</code>
for
that
node
.</p>
+
<dd class='body--doc'><p>It is possible to
case
this
object
to a string, which
does
the same
+
as calling
<code>render</code>
,
and
to
an array, which returns the cells in an
+
array of rows
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>clone</b></span>
-
</dt>
-
<dd><p><code><code class='object unresolved'>Node</code> <b><span class='method'>clone</span>(</b><code class='datatype'>void</code>|<code class='datatype'>int(-1..1)</code> <code class='argument'>direction</code><b>)</b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Clones the node, optionally connected to parts of the tree.
-
If direction is -1 the cloned nodes parent will be set, if
-
direction is 1 the clone nodes childen will be set.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
+
<span class='homogen--name'><b>create</b></span> </dt>
-
<dd><p><code><span class='object'>
Parser
.
XML
.
Tree.Node
</span> <span class='class'>
Parser
.
XML
.
Tree.Node
</span><b>(</b><code class='datatype'>
int
</code> <code class='argument'>
type
</code>, <code class='datatype'>string</code> <code class='argument'>
name
</code>, <code class='datatype'>
mapping
</code> <code class='argument'>
attr
</code>, <code class='datatype'>string</code> <code class='argument'>
text
</code><b>)</b></code></p></dd>
+
<dd><p><code><span class='object'>
String
.
HTML
.
OBox
</span> <span class='class'>
String
.
HTML
.
OBox
</span><b>(</b><code class='datatype'>
void
</code>
|<code
class='datatype'>string
<
/
code
>
<code
class='argument'>
frame_color
</code>, <code class='datatype'>
void</code>|<code class='datatype'>
string</code> <code class='argument'>
cell_color
</code>, <code class='datatype'>
void
</code>
|<code
class='datatype'>string
<
/
code
>
<code
class='argument'>
width
</code>, <code class='datatype'>
void</code>|<code class='datatype'>
string</code> <code class='argument'>
padding
</code>
,
<
code class='datatype'>void</code>|<code class='datatype'>function</code>(<code class='datatype'>int</code>, <code class='datatype'>int</code>, <code class='datatype'>string</code>, <code class='datatype'>string</code>:<code class='datatype'>string</code>) <code class='argument'>cell_callback</code><
b>)</b></code></p></dd>
</dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get
_
any_name
</b></span>
+
<span class='homogen--name'><b>
new
_
row
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
string
</code> <b><span class='method'>
get
_
any_name
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
void
</code> <b><span class='method'>
new
_
row
</span>(</b><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Return
name
of
tag
or
name
of
attribute
node
.</p>
+
<dd class='body--doc'><p>
Begin
a
new
row.
Succeeding
cells
will be added to this
+
row instead
of
the
current
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get
_
attr_name
</b></span>
+
<span class='homogen--name'><b>
pad
_
rows
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
string
</code> <b><span class='method'>
get
_
attr_name
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
void
</code> <b><span class='method'>
pad
_
rows
</span>(</b><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
the
name
of
the
attribute
node
.</p>
+
<dd class='body--doc'><p>
Ensures
that
all
rows
have
the
same
number of cells
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get_attribute_nodes
</b></span>
+
<span class='homogen--name'><b>
render
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
array
</code>
(<code
class='object unresolved'>Node
<
/code>) <
b><span class='method'>
get_attribute_nodes
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
string
</code> <b><span class='method'>
render
</span>(</b><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Creates
and returns an array of new nodes; they will not be
-
added as proper children to
the
parent node, but the parent
-
link in the nodes are set so that upwards traversal is made
-
possible
.</p>
+
<dd class='body--doc'><p>
Returns
the
result
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get
_
attributes
</b></span>
+
<span class='homogen--name'><b>
set
_
cell_callback
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
mapping
</code> <b><span class='method'>
get
_
attributes
</span>(</b><
b>)</b></
code
></p></dd>
-
-
<dt
class='
head--doc
'>
Description
</
dt
>
-
<
dd
class='
body--doc
'><
p
>
Returns this nodes attributes
,
which can be altered
-
destructivly to alter the nodes attributes.
<
/p>
-
</dd></dl>
-
-
-
<hr
/>
-
<dl
class='
group--doc
'>
-
<
dt class='head--type'
><
span
class='
homogen--type
'>
Method
</
span
>
-
<
span
class='
homogen--name
'><
b>get_doc_order<
/
b></span>
-
</dt>
-
<dd><p><
code><code class='datatype'>
int
</code> <
b><span
class='
method
'>
get
_
doc_order
</
span
>
(
<
/
b>
<b>
)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
void
</code> <b><span class='method'>
set
_
cell_callback
</span>(</b><code class='
datatype
'>
function
</
code
>
(
<
code
class='
datatype
'>
int
<
/code
>, <
code
class='
datatype
'>
int
<
/code>,
<
code
class='
datatype
'>
string
</
code
>
,
<
code
class='
datatype
'>
string
</code>
:
<code class='datatype'>
string
</code>
)
<
code
class='
argument
'>
cell
_
callback
</
code
><b>)</b></code></p></dd>
</dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get
_
elements
</b></span>
+
<span class='homogen--name'><b>
set
_
extra_args
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
array
</code>
(
<
code
class='
object unresolved
'>
AbstractNode
</
code
>
)
<b><
span
class='
method
'>
get_elements
</
span
>(</
b
><code class='datatype'>
void
</code>
|
<code class='datatype'>string</code> <code class='argument'>
name
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
void
</code>
<
b><span
class='
method
'>
set_extra_args
</
span
>
(
<
/
b><
code
class='
datatype
'>
array
</
code
>(<
code class='datatype'>mapping<
/
code
>
(
<code class='datatype'>
string
</code>
:
<code class='datatype'>string</code>
))
<code class='argument'>
extra_args
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
all
element
children
to
this
node.
If
a
<code>name</code>
-
is
provided,
only
elements
with
that
name
is returned
.</p>
+
<dd class='body--doc'><p>
The
argument
in
the
mappings
will
be
added
to
the
cell
in
the
+
cooresponding
column
of
the
table
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get
_
first
_
element
</b></span>
+
<span class='homogen--name'><b>
set
_
extra
_
args
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
AbstractNode
</code> <b><span class='method'>
get
_
first
_
element
</span>(</b><code class='datatype'>
void
</code>
|
<code class='datatype'>string</code> <code class='argument'>
name
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
void
</code> <b><span class='method'>
set
_
extra
_
args
</span>(</b><code class='datatype'>
mapping
</code>
(
<code class='datatype'>string</code>
:<code
class='datatype'>string
<
/
code
>)
<code
class='argument'>
extra_args
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
the
first
element child to this node. If a <code>name</code>
-
is provided,
the
first
element
child
with
that
name
is
-
returned.
Returns 0 if no matching node was found
.</p>
+
<dd class='body--doc'><p>
The
argument
in
the
mapping
will
be
added
to
all
created
table
cells
.</p>
</dd></dl>
-
+
</dd></dl></dd></dl></dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Array</b></h2>
+
</dt><dd>
-
+
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get_node_type
</b></span>
+
<span class='homogen--name'><b>
arrayify
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
int
</code> <b><span class='method'>
get_node_type
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
array
</code> <b><span class='method'>
arrayify
</span>(</b><
code class='datatype'>void</code>|<code class='datatype'>array</code>|<code class='datatype'>mixed</code> <code class='argument'>x</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
the
node
type.
See
defined
node
type
constants
.</p>
+
<dd class='body--doc'><p>
Make
an array of
the
argument,
if it isn't already. A zero_
type
+
argument gives the empty array
.
This
is
useful
when
something is
+
either an array or a basic datatype, for instance in headers from
+
the MIME module or Protocols
.
HTTP.Server.
</p>
+
</dd>
+
<dt class='head--doc'><span id='p-x'></span>Parameter <code class='parameter'>x</code></dt>
+
<dd></dd><dd class='body--doc'><p>Result depends of the argument type:</p>
+
<dl class='group--doc'><dt>arrayp(x)</dt>
+
<dd><p>arrayify(x) => x</p>
+
</dd>
+
<dt>zero_type(x)</dt>
+
<dd><p>arrayify(x) => ({})</p>
+
</dd>
+
<dt>otherwise</dt>
+
<dd><p>arrayify(x) => ({ x })</p>
+
</dd>
+
</dl>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get_tag_name
</b></span>
+
<span class='homogen--name'><b>
count
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
string
</code> <b><span class='method'>
get_tag_name
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
int
</code> <b><span class='method'>
count
</span>(</b><
code class='datatype'>array</code>|<code class='datatype'>mapping</code>|<code class='datatype'>multiset</code> <code class='argument'>haystack</code>, <code class='datatype'>mixed</code> <code class='argument'>needle</code><
b>)</b></code><
br>
+
<code><code class='datatype'>mapping<
/
code>(<code class='datatype'>mixed</code>:<code class='datatype'>int</code>) <b><span class='method'>count</span>(</b><code class='datatype'>array</code>|<code class='datatype'>mapping</code>|<code class='datatype'>multiset</code> <code class='argument'>haystack</code><b>)</b></code></
p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Returns the
name
of the
element
node
,
or
the
nearest
element
above
if
-
an
attribute
node
.</p>
+
<dd class='body--doc'><p>Returns the
number
of
occurrences of <code>needle</code> in <code>haystack</code>.
+
If
the
optional
<code>needle</code> argument is omitted
,
<code>count</code>
instead
+
works similar to
the
unix
command <tt>sort|uniq -c</tt>, returning
+
a mapping with the number of occurrences of each
element
in
+
<code>haystack</code>. For array or mapping <code>haystack</code>s, it's the values
+
that are counted, for multisets the indices, as you'd expect
.</p>
+
</dd>
+
<dt class='head--doc'>See also</dt>
+
<dd class='body--doc'><p><code>String.count</code>, <code>search</code>, <code>has_value</code></p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get
_
text
</b></span>
+
<span class='homogen--name'><b>
dwim
_
sort_func
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
string
</code> <b><span class='method'>
get
_
text
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
int
</code> <b><span class='method'>
dwim
_
sort_func
</span>(</b><
code class='datatype'>string</code> <code class='argument'>a</code>, <code class='datatype'>string</code> <code class='argument'>
b
</code
>
<b>
)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
text
content
in
node
.</p>
+
<dd class='body--doc'><p>
Sort
without
respect
to
number formatting (most notably leading
+
zeroes)
.</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Inherit</span>
-
<span class='homogen--name'><b>AbstractNode</b></span>
-
</dt>
-
<dd><p><code><span class='datatype'>inherit AbstractNode</span> : <span class='inherit'>AbstractNode</span></code></p></dd>
-
</dl>
-
-
-
<hr />
-
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
render_xml
</b></span>
+
<span class='homogen--name'><b>
flatten
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
string
</code> <b><span class='method'>
render_xml
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
array
</code> <b><span class='method'>
flatten
</span>(</b><
code class='datatype'>array</code> <code class='argument'>a</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Creates
an
XML
representation
of
the
nodes
sub tree
.</p>
+
<dd class='body--doc'><p>
Flatten
a
multi-dimensional
array
to
a
one-dimensional
array
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
set
_
doc_order
</b></span>
+
<span class='homogen--name'><b>
greedy
_
diff
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
void
</code> <b><span class='method'>
set
_
doc_order
</span>(</b><code class='datatype'>
int
</code> <code class='argument'>
o
</code><b>)</b></code></p></dd>
-
</dl>
+
<dd><p><code><code class='datatype'>
array
</code>
(<code
class='datatype'>array
<
/code>(<code class='datatype'>array</code>)) <
b><span class='method'>
greedy
_
diff
</span>(</b><code class='datatype'>
array
</code> <code class='argument'>
from
</code>
,
<
code class='datatype'>array</code> <code class='argument'>to</code><
b>)</b></code></p></dd>
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>value_of_node</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>string</code> <b><span class='method'>value_of_node</span>(</b><b>)</b></code></p></dd>
-
+
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
If
the
node
is
an
attribute
node
or
a
text
node
,
its
value
is
returned
.
-
Otherwise
the
child
text
nodes
are
concatenated
and
returned
.</p>
+
<dd class='body--doc'><p>
Like
<code>Array.diff</code>, but tries to generate bigger continuous chunks of
the
+
differences,
instead
of
maximizing
the
number
of
difference
chunks. More
+
specifically
,
<code>greedy_diff</code>
optimizes
the
cases where <code>Array
.
diff</code> returns
+
<code
class='expr'>({ ..., A, Z, B, ({}), C, ... })</code>
+
<code class='expr'>({ ..., A, X, B, Y+B, C, ... })</code>
+
into
the
somewhat
shorter
diff
arrays
+
<code
class='expr'>({ ..., A, Z, B+C, ... })</code>
+
<code class='expr'>({
.
.., A, X+B+Y, B+C, ... })
</
code></
p>
</dd></dl>
-
</dd></dl></dd></dl></dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.HTML</b></h2>
-
</dt><dd><dl class='group--doc'>
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p> This is a simple parser for SGML structured markups.
-
It's not really HTML, but it's useful for that
-
purpose.</p>
+
-
<p>
-
The simple way to use it is to give it some information
-
about available tags and containers, and what
-
callbacks those is to call.</p>
+
-
<p>
-
The object is easily reused, by calling the <code>clone</code>()
-
function.
-
</p>
-
</dd>
-
<dt class='head--doc'>See also</dt>
-
<dd class='body--doc'>
-
<p><code>add_tag</code>, <code>add_container</code>, <code>clone</code></p></dd></dl>
-
+
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>_
inspect
</b></span>
+
<span class='homogen--name'><b>
lyskom
_
sort_func
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
mapping
</code> <b><span class='method'>_
inspect
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
int
</code> <b><span class='method'>
lyskom
_
sort_func
</span>(</b><
code class='datatype'>string</code> <code class='argument'>a</code>, <code class='datatype'>string</code> <code class='argument'>
b
</code
>
<b>
)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p>
This
is
a
low-level
way
of debugging a parser.
-
This
gives a mapping
of the
internal
state
-
of the Parser.HTML object.
</p>
-
-
<p>
-
The
format
and
contents
of
this
mapping
may
-
change without further notice.
</p>
+
<dd class='body--doc'><p>
Sort
comparison
function
that
does
not
care
about
case,
nor
about
+
the
contents
of
any
parts
of the
string
enclosed
with
'()'
</p>
+
<p>
Example:
"Foo
(bar)"
is
given
the
same
weight
as
"foo
(really!)"
</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>_
set
_
tag_callback
</b></span>
<br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>_set_entity_callback</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>_set_data_callback</b></span><br>
+
<span class='homogen--name'><b>
oid
_
sort
_
func
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved'>Parser.HTML </code> <b><span class='method'>_set_tag_callback</span>(</b><code class='
datatype'>
function
</code>
(:<code
class='datatype void'>void
<
/code>) <code class='argument'>to_call</code><
b>
)
<
/b></code><br>
-
<code><code class='object unresolved'>Parser.HTML </code> <b><
span class='method'>_
set
_
entity_callback
</span>(</b><code class='datatype'>
function
</code>
(:<code
class='datatype void'>void
<
/
code
>)
<code
class='argument'>
to_call
</code>
<b>)</b></code><br>
-
<code><code
class='object unresolved'>Parser.HTML
<
/
code
>
<b><span
class='
method'>_set_data_callback</span>(</b><code class='
datatype'>
function
</code>
(:<code
class='datatype void'>void
<
/
code
>)
<code
class='argument'>
to_call
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
int
</code> <b><span class='method'>
oid
_
sort
_
func
</span>(</b><code class='datatype'>
string
</code> <code class='argument'>
a0
</code>
,
<code class='datatype'>
string
</code> <code class='argument'>
b0
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p>
These functions set up the parser object to
-
call the given callbacks upon tags, entities
-
and/or data.</p>
-
-
<p>
-
The callbacks will <i>only</i> be called if there isn't
-
another tag/container/entity handler for these.</p>
-
-
<p>
-
The function will be called
with
the
parser
-
object as first argument, and the active string
-
as second.</p>
-
-
<p>
-
Note that no parsing
of
the
contents
has
been
done.
-
Both endtags and normal tags are called, there is
-
no container parsing.</p>
-
-
<p>
-
The return
values
from the callbacks are handled in the
-
same way as the return values from callbacks registered with
-
<code>add_tag</code> and similar functions
.
</p>
-
-
<p>
-
The data callback will be called as seldom as possible with
-
the longest possible string, as long as it doesn't get called
-
out of order with any other callback
.
It
will never be called
-
with a zero length string
.
-
</p>
-
</dd>
-
<dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'>
-
<p>the called object</p>
+
<dd class='body--doc'><p>
Sort
with
care
of
numerical
sort
for
OID
values
:
+
"1
.
2
.
1"
before
"1
.
11.1"
</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
add_tag
</b></span>
<br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>add_container</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>add_entity</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>add_quote_tag</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>add_tags</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>add_containers</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>add_entities</b></span><br>
+
<span class='homogen--name'><b>
random
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved'>Parser.HTML </code> <b><span class='method'>add_tag</span>(</b><code class='
datatype'>
string</code> <code class='argument'>name</code>, <code class='datatype'>
mixed</code> <
code class='argument'>to_do</code><
b>
)
<
/b></code><br>
-
<code><code class='object unresolved'>Parser.HTML </code> <b><
span class='method'>
add_container
</span>(</b><code class='datatype'>
string
</code> <code class='argument'>
name
</code>
,
<
code class='datatype'>mixed</code> <code class='argument'>to_do</code><
b>)</b></code><
br>
-
<code><code class='object unresolved'>Parser.HTML <
/
code> <b><span class='method'>add_entity</span>(</b><code class='datatype'>string</code> <code class='argument'>entity</code>, <code class='datatype'>mixed</code> <code class='argument'>to_do</code><b>)</b></code><br>
-
<code><code class='object unresolved'>Parser.HTML </code> <b><span class='method'>add_quote_tag</span>(</b><code class='datatype'>string</code> <code class='argument'>name</code>, <code class='datatype'>mixed</code> <code class='argument'>to_do</code>, <code class='datatype'>string</code> <code class='argument'>end</code><b>)</b></code><br>
-
<code><code class='object unresolved'>Parser.HTML </code> <b><span class='method'>add_tags</span>(</b><code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>mixed</code>) <code class='argument'>tags</code><b>)</b></code><br>
-
<code><code class='object unresolved'>Parser.HTML </code> <b><span class='method'>add_containers</span>(</b><code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>mixed</code>) <code class='argument'>containers</code><b>)</b></code><br>
-
<code><code class='object unresolved'>Parser.HTML </code> <b><span class='method'>add_entities</span>(</b><code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>mixed</code>) <code class='argument'>entities</code><b>)</b></code></
p></dd>
+
<dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>
random
</span>(</b><code class='datatype'>
array
</code> <code class='argument'>
in
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p>
Registers
the actions to take when parsing various things.
-
Tags, containers, entities are as usual. add_quote_tag() adds
-
a
special
kind of tag that reads any data until the next
-
occurrence of the end string immediately before a tag end.</p>
-
-
<p><tt>to_do</tt> can be:</p>
-
-
<p><ul>
-
<li><p><b>a function</b> to be called. The function is on the form
-
<pre>
-
mixed tag_callback(Parser.HTML parser,mapping args,mixed ... extra)
-
mixed container_callback(Parser.HTML parser,mapping args,string content,mixed ... extra)
-
mixed entity_callback(Parser.HTML parser,mixed ... extra)
-
mixed quote_tag_callback(Parser.HTML parser,string content,mixed ... extra)
-
</pre>
-
depending on what realm the function is called by.</p></li><li><p><b>a string</b>. This tag/container/entity is then replaced
-
by the string. The string is normally not reparsed, i.e. it's
-
equivalent to writing a function that returns the string in an
-
array (but a lot faster). If <code>reparse_strings</code> is
-
set the string will be reparsed, though.</p></li><li><p><b>an array</b>. The first
element
is
a function as above.
-
It will receive
the
rest of the array as extra arguments. If
-
extra arguments are given by
<code>
set_extra</code>(), they will
-
appear after the ones
in
this array.
</
p></li><li><p><b>zero</b>. If there is a tag/container/entity with the
-
given name in the parser, it's removed.</p></li></ul></p>
-
-
<p>The callback function can return:</p>
-
-
<p><ul>
-
<li><p><b>a string</b>; this string will be pushed on the parser
-
stack and be parsed. Be careful not to return anything
-
in this way that could lead to a infinite recursion.</p></li><li><p><b>an array</b>; the element(s) of the array is the result
-
of the function. This will not be parsed. This is useful for
-
avoiding infinite recursion. The array can be of any size,
-
this means the empty array is the most effective to return if
-
you don't care about the result. If the parser is operating in
-
<
code>
mixed_mode</code>,
the
array
can contain anything
.
-
Otherwise only strings are allowed.
</p>
</li><li><p><b>zero</b>; this means "don't do anything", ie the
-
item that generated the callback is left as it is, and
-
the parser continues.</p></li><li><p><b>one</b>; reparse the last item again. This is useful to
-
parse a tag as a container, or vice versa: just add or remove
-
callbacks for the tag and return this to jump to the right
-
callback.</p></li></ul></p>
-
-
<p></p>
-
</dd>
-
<dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'>
-
<p>the called object</p>
-
</dd>
-
<dt class='head--doc'>See also</dt>
-
<dd class='body--doc'>
-
<p><code>tags</code>, <code>containers</code>, <code>entities</code></p></dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>at</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>at_line</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>at_char</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>at_column</b></span><br>
-
</dt>
-
<dd><p><code><code class='datatype'>array</code>(<code class='datatype'>int</code>) <b><span class='method'>at</span>(</b><b>)</b></code><br>
-
<code><code class='object unresolved'>int </code> <b><span class='method'>at_line</span>(</b><b>)</b></code><br>
-
<code><code class='object unresolved'>int </code> <b><span class='method'>at_char</span>(</b><b>)</b></code><br>
-
<code><code class='object unresolved'>int </code> <b><span class='method'>at_column</span>(</b><b>)</b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p> Returns the current position. Characters and columns count
-
from 0, lines count from 1.</p>
-
-
<p>
-
<code>at</code>() gives an array consisting of
-
({<i>line</i>,<i>char</i>,<i>column</i>}), in that order.</p>
+
<dd class='body--doc'><p>
Returns
a
random
element
from
the <code>in</code> array.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
case_insensitive_tag
</b></span>
<br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>ignore_tags</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>ignore_unknown</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>lazy_argument_end</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>lazy_entity_end</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>match_tag</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>max_parse_depth</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>mixed_mode</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>reparse_strings</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>ws_before_tag_name</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>xml_tag_syntax</b></span><br>
+
<span class='homogen--name'><b>
reduce
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved'>int </code> <b><span class='method'>case_insensitive_tag</span>(</b><code class='
datatype'>
void
</code>
|<code
class='datatype'>int
<
/code> <code class='argument'>value</code><
b>
)
<
/b></code><br>
-
<code><code class='object unresolved'>int </code> <b><
span class='method'>
ignore_tags
</span>(</b><code class='datatype'>
void
</code>
|<code class='datatype'>int</code> <code class='argument'>value</code><b>)</b></code><br>
-
<code><code class='object unresolved'>int </code> <b><span class='method'>ignore_unknown</span>
(<
/b><
code class='datatype
'>void</code>|<code
class=
'
datatype'
>
int</code> <code class='argument'>value</code><b>)</b></code><br>
-
<code><code class='object unresolved'>int </code> <b><span class='method'>lazy_argument_end</span>(</b><code class='datatype'>
void</code>
|<code class='datatype'>int</code> <code class='argument'>value</code><b>
)
</b></code><br>
-
<code><code
class='object unresolved'>int
<
/
code
>
<b><span
class='
method'>lazy_entity_end</span>(</b><code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='
argument'>
value
</code>
<b>)</b></code><br>
-
<code><code
class='object unresolved'>int
<
/
code
>
<b><span
class='
method'>match_tag</span>(</b><code class='
datatype'>
void
</code>
|<code
class='datatype'>int
<
/
code
>
<code
class='argument'>
value
</code>
<b>)</b></code><br>
-
<code><code
class='object unresolved'>int
<
/
code
>
<b><span
class='
method'>max_parse_depth</span>(</b><code class='
datatype'>
void</code>|<code class='datatype'>int</code> <code class='argument'>value</code><b>)</b></code><br>
-
<code><code class='object unresolved'>int </code> <b><span class='method'>
mixed
_mode
</
span>(</b><
code
class='datatype'
>
void</code>
|<code class='datatype'>
int</code> <code class='argument'>value</code><b>)</b></code><br>
-
<code><code class='object unresolved'>int </code> <b><span class='method'>reparse_strings</span>(</b><code class='datatype'>
void</code>
|<code
class='datatype'>int
<
/
code
>
<code
class='argument'>
value
</code><b>)</b></code><
br>
-
<code><code class='object unresolved'>int <
/
code> <b><span class='method'>ws_before_tag_name</span>(</b><code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>value</code><b>)</b></code><br>
-
<code><code class='object unresolved'>int </code> <b><span class='method'>xml_tag_syntax</span>(</b><code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>value</code><b>)</b></code></
p></dd>
+
<dd><p><code><code class='
datatype
'>
mixed
</code> <b><span class='method'>
reduce
</span>(</b><code class='datatype'>
function
</code>(
:
<code class='datatype void'>void</code>) <code class='argument'>
fun
</code>
,
<code class='datatype'>
array
</code> <code class='argument'>
arr
</code>
,
<code class='datatype'>mixed</code>|<code class='datatype'>void</code> <code class='argument'>
zero
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p>
Functions to query or set flags. These set the associated flag
-
to the value if any is given and returns the old value.
<
/p
>
-
-
<
p
>
-
The
flags
are:</p>
-
-
<p>
<
ul
>
-
<
li><p><b>case_insensitive_tag<
/
b
>
:
All tags and containers
-
are matched case insensitively, and argument names are
-
converted
to
lowercase. Tags added with
-
<code>
add_quote_tag
</code>
() are not affected
,
though. Switching
-
to case insensitive mode and back won't preserve
the
case
of
-
registered tags
and
containers.</p></li><li><p><b>ignore_tags</b>: Do not look for tags at all.
-
Normally tags are matched even when there's no callbacks for
-
them at all. When this is set,
the
tag
delimiters
'<' and
-
'>' will be treated as any normal character.</p></li><li><p><b>ignore_unknown</b>: Treat unknown tags and entities
-
as text data, continuing parsing for tags and entities inside
-
them.</p></li><li><p><b>lazy_argument_end</b>: A '>'
in
a tag argument
-
closes both the argument and the tag, even if the argument is
-
quoted.
<
/p
></
li
>
<li><p><b>lazy_entity_end</b>:
Normally,
the parser search
-
indefinitely for the entity end character (i.e. ';'). When
-
this flag is set, the characters '&', '<', '>', '"',
-
''', and any whitespace breaks the search for the entity end,
-
and the entity text is then ignored, i.e. treated as data.
<
/p
></
li
>
<li><p><b>match_tag</b>:
Unquoted nested tag starters
and
-
enders will be balanced when parsing tags
.
This
is
the
-
default.</p></li><li><p><b>max_stack_depth</b>: Maximum recursion depth during
-
parsing. Recursion occurs when a tag/container/entity/quote
-
tag callback function
returns
a
string to be reparsed
. The
-
default value is 10.</p></li><li><p><b>mixed_mode</b>: Allow callbacks to
return
arbitrary
-
data in the arrays, which will be concatenated in the output.
<
/p
></
li
>
<li><p><b>reparse_strings</b>:
When a plain string is used as
-
a tag/container/entity/quote tag callback, it's not reparsed
-
if
this flag is unset. Setting it causes all such strings to
-
be reparsed.
<
/p
></
li
>
<li><p><b>ws_before_tag_name</b>:
Allow
whitespace between
the
-
tag start character and the tag name.</p></li><li><p><b>xml_tag_syntax</b>: Whether or not to use XML syntax
-
to tell
empty
tags and container tags apart:<br />
-
-
<b>0</b>: Use HTML syntax only
. If
there's a '/' last in a
-
tag, it's just treated as any other argument.
<
br /
>
-
-
<
b>1<
/
b
>
:
Use HTML syntax, but ignore a '/' if it comes
-
last in a tag. This is the default.<br />
-
-
<b>2</b>: Use XML syntax
,
but when a tag
that
does not end
-
with '/>' is found which only got a non-container tag
-
callback, treat it as a non-container (i.e. don't start to
-
seek for the container end).<br />
-
-
<b>3</b>: Use XML syntax only. If a tag got both container
-
and non-container callbacks, the non-container callback is
-
called when the empty
element
form (i.e. the one ending with
-
'/>') is used, and the container callback otherwise. If
-
only a container callback exists, it gets the empty string as
-
content when there's none to be parsed. If only a
-
non-container callback exists, it
will be
called (without the
-
content argument) for both kinds of tags
.</p>
</li></ul>
-
</p>
+
<dd class='body--doc'><p><
code
>
reduce()
<
/code
>
sends
the
first
two
elements
in
<
code
>
arr
</
code
> to <code>
fun
</code>,
+
then
the
result
and the
next
element
in <
code
>
arr
</
code
>
to
<
code
>
fun
</
code
> and
+
so
on
.
Then
it
returns
the
result
. The
function
will
return
+
<
code
>
zero
</
code
> if <
code
>
arr
</
code
>
is
the empty
array
. If <
code
>
arr
</
code
>
has
+
only
one
element
, that element will be
returned
.</p>
</dd>
-
<dt class='head--doc'>
Note
</dt>
-
<dd class='body--doc'>
-
<p>
When functions are specified with
-
<code>
_set_tag_callback</code>
()
or
-
<
code>_set_entity_callback<
/code>
(), all tags or entities,
-
respectively, are considered known. However, if one of those
-
functions return 1 and ignore_unknown is set, they are treated
-
as text data instead of making another call to the same
</p>
+
<dt class='head--doc'>
See also
</dt>
+
<dd class='body--doc'><p><code>
rreduce
()</code></p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
clear_tags
</b></span>
<br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>clear_containers</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>clear_entities</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>clear_quote_tags</b></span><br>
+
<span class='homogen--name'><b>
rreduce
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
Parser.HTML
</code> <b><span class='method'>
clear_tags
</span>(</b><
b
>
)
</
b></
code><
br>
-
<
code
><code
class='
object
unresolved
'>
Parser.HTML
</code> <
b><span
class='
method
'>
clear_containers
</
span
>
(
<
/b
><
b>)<
/
b></
code><
br>
-
<
code
><code
class='
object unresolved
'>
Parser.HTML
</code> <
b><span
class='
method
'>
clear_entities
</
span>(</b><b>)</b></
code><
br>
-
<
code
><code
class='
object unresolved
'>
Parser.HTML
</code> <
b><span
class='
method
'>
clear_quote_tags
</
span
>
(
<
/
b>
<b>
)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
mixed
</code> <b><span class='method'>
rreduce
</span>(</b><
code class='datatype'
>
function
</code>
(:
<code class='
datatype
void
'>
void
</code>
)
<
code
class='
argument
'>
fun
</
code
>
,
<
code class='datatype'
>
array
</code>
<code class='
argument
'>
arr
</code>
,
<
code
class='
datatype
'>
mixed
</code>
|
<code class='
datatype
'>
void
</code> <
code
class='
argument
'>
zero
</
code
><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p>
Removes
all
registered
definitions
in the
different
-
categories
.
-
</p>
+
<dd class='body--doc'><p>
<code>rreduce()</code>
sends
the
last
two elements
in
<code>arr</code> to <code>fun</code>,
+
then
the
third last element in <code>arr</code> and the result to <code>fun</code> and
+
so on
.
Then it returns the result. The function will return
+
<
code>zero<
/
code> if <code>arr</code> is the empty array. If <code>arr</code> has
+
only one element, that element will be returned.</
p>
</dd>
-
<dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'>
-
<p>the called object</p>
-
</dd>
+
<dt class='head--doc'>See also</dt>
-
<dd class='body--doc'>
-
<p><code>
add_tag</code>, <code>add_tags</code>, <code>add_container</code>, <code>add_containers</code>, <code>add_entity</code>, <code>add_entities</code></p></dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>clone</b></span>
-
</dt>
-
<dd><p><code><code class='object unresolved'>Parser.HTML </code> <b><span class='method'>clone</span>
(
</b><code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>
)</
b></
code></p>
</dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p> Clones the <code>Parser.HTML</code> object.
-
A new object of the same class is created,
-
filled with the parse setup from the
-
old object.</p>
-
-
<p>
-
This is the simpliest way of flushing a
-
parse feed/output.</p>
-
-
<p>
-
The arguments to clone is sent to the
-
new object, simplifying work for custom classes
-
that inherits <code>Parser.HTML</code>.</p>
-
</dd>
-
<dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'>
-
<p>the new object.</p>
-
</dd>
-
<dt class='head--doc'>Note</dt>
-
<dd class='body--doc'>
-
<p>create is called _before_ the setup is copied.</p>
+
<dd class='body--doc'><p><code>
reduce
()</code></p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
tags</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>containers</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>entities</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>quote
_
tags
</b></span>
<br>
+
<span class='homogen--name'><b>
search
_
array
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
mapping
</code> <b><span class='method'>
tags
</span>(</b><
b
>
)
</
b
><
/
code><
br>
-
<
code><code class='
object unresolved
'>
mapping
</code>
<
b><span
class='
method
'>
containers
</
span
>(<
/b
><
b>)<
/
b></
code><
br>
-
<
code
><code
class='
object unresolved
'>
mapping
</code> <
b><span
class='
method
'>
entities
</
span>(</b><b>)</b></
code><
br>
-
<
code
><code
class='
object unresolved
'>
mapping
</code> <
b><span
class='
method
'>
quote_tags
</
span
>
(
<
/
b>
<b>
)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
int
</code> <b><span class='method'>
search_array
</span>(</b><
code class='datatype'
>
array
</
code
>
<code
class='argument'
>
arr
<
/
code>
,
<code class='
datatype
'>
string
</code>
|
<
code
class='
datatype
'>
function
</
code
>(
:
<
code class='datatype void'
>
void
</code>
)|
<code class='
datatype
'>
int
</code> <
code
class='
argument
'>
fun
</code>
,
<code class='
datatype
'>
mixed
</code>
...
<
code
class='
argument
'>
args
</
code
><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p>
Returns the current callback settings. For quote
_
tags,
the
-
values are arrays
(
{callback, end_quote}
)
.
</
p
>
-
-
<p>
-
Note
that
when
matching
is
done case insensitively, all names
-
will
be
returned
in lowercase
.</p>
-
-
<p>
-
Implementation
note:
With
the
exception
of quote_tags()
,
these
-
run in constant time since they return copy
-
on-write
mappings.
-
However, quote_tags() allocates a new mapping and thus runs in
-
linear time
.
-
</p>
+
<dd class='body--doc'><p>
<code>search
_
array()</code>
works
like
<code>map
()</
code
>
,
only
it
returns
the
index
+
of
the
first
call
that
returnes
true
instead
.</p>
+
<p>
If
no
call
returns
true
, -
1
is
returned
.</p>
</dd> <dt class='head--doc'>See also</dt>
-
<dd class='body--doc'>
-
<p><code>
add_tag
</code>, <code>
add_tags
</code>
,
<
code>add_container<
/
code>, <code>add_containers</code>, <code>add_entity</code>, <code>add_entities</code></
p></dd></dl>
+
<dd class='body--doc'><p><code>
sum()
</code>, <code>
map()
</code></p>
+
</dd></dl>
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
context
</b></span>
+
<span class='homogen--name'><b>
shuffle
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
string
</code> <b><span class='method'>
context
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
array
</code> <b><span class='method'>
shuffle
</span>(</b><
code class='datatype'>array</code> <code class='argument'>arr</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p>
Returns the current output context as a string:
<
/p
>
-
-
<
p> <ul>
-
<li><p><b>"data"<
/
b
>
:
In
top
level data. This is always returned
-
when called from tag or container callbacks.</p></li><li><p><b>"arg"</b>: In an unquoted argument.</p></li><li><p><b>A single character string</b>: In a quoted argument.
-
The string contains
the
starting
quote
character.</p></li><li><p><b>"splice_arg"</b>:
In a splice argument.</p></li></ul></p>
-
-
<p>
-
This function is typically only useful
in
entity
callbacks,
-
which can be called both from text and argument values of
-
different sorts
.
-
</p>
+
<dd class='body--doc'><p><
code
>
shuffle()
</
code
>
gives
back
the
same
elements,
but
in
random
order
.</p>
</dd> <dt class='head--doc'>See also</dt>
-
<dd class='body--doc'>
-
<p><code>
splice_arg</code></p></dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>current</b></span>
-
</dt>
-
<dd><p><code><code class='object unresolved'>string </code> <b><span class='method'>current</span>
(
</b><b>
)</
b></
code></p>
</dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p>Gives the current range of data, ie the whole tag/entity/etc
-
being parsed in the current callback. Returns zero if there's
-
no current range, i.e. when the function is not called in a
-
callback.</p>
+
<dd class='body--doc'><p><code>
permute
()</code></p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
feed
</b></span>
+
<span class='homogen--name'><b>
sort_array
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
Parser.HTML
</code> <b><span class='method'>
feed
</span>(</b><
b>)</b></
code
><br>
-
<code><code
class='
object unresolved
'>
Parser.HTML
</code> <
b><span class='method'>feed</span>(</b><
code class='
datatype
'>
string
</code> <code class='
argument
'>
s
</code><
b>)</b></
code
><br>
-
<code><code
class='
object
unresolved
'>
Parser.HTML
</code>
<
b><span class='method'>feed</span>(</b><
code class='datatype'>
string
</code> <code class='argument'>
s
</code>, <code class='datatype'>
int
</code> <code class='argument'>
do_parse
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
array
</code> <b><span class='method'>
sort_array
</span>(</b><code class='
datatype
'>
array
</code> <code class='
argument
'>
foo
</code>
,
<code class='
datatype
'>
function
</code>
(:
<code class='
datatype
void
'>
void
</code>
)|
<code class='datatype'>
void
</code> <code class='argument'>
cmp
</code>, <code class='datatype'>
mixed
</code>
...
<code class='argument'>
args
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p>
Feed
new
data
to the
<code>
Parser.HTML
</code>
-
object.
This
will
start
a
scan
and
may result in
-
callbacks
.
Note that it's possible that all
-
data
feeded
isn't
processed
-
to
do
that, call
-
<code>
finish
</code>
()
.</p>
-
-
<p>
-
If
the function is called without arguments,
-
no data is feeded, but the parser is run.
<
/p
>
-
-
<
p
>
-
If
the string argument
is
followed by a 0
,
-
<
tt
>
-
>
feed
(
s,0
)
;
</
tt
>
,
the string
is
feeded,
-
but the parser isn't run
.
-
</p>
+
<dd class='body--doc'><p>
This
function
sorts
an
array
after
a
compare-function
<code>
cmp
</code>
+
which
takes
two
arguments
and
should
return
<tt>1</tt>
if
the
first
argument
+
is
larger
then
the
second
.
</p>
+
<p>
The
remaining
arguments
<code>args</code>
will
be
sent
as
3rd,
4th
etc.
argument
+
to
<code>
cmp
</code>.</p>
+
<p>
If <
code
>
cmp
<
/code
> is
omitted
, <
code
>
`
>()</
code
> is
used
instead
.</p>
</dd>
-
<dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'>
-
<p>the called object</p>
-
</dd>
+
<dt class='head--doc'>See also</dt>
-
<dd class='body--doc'>
-
<p><code>
finish
</code>, <code>
read
</code>, <code>
feed
_
insert
</code></p></dd></dl>
+
<dd class='body--doc'><p><code>
map()
</code>, <code>
sort()
</code>, <code>
`>()</code>, <code>dwim
_
sort_func
</code>
,
<
code>lyskom_sort_func<
/
code></
p>
+
</dd></dl>
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
feed_insert
</b></span>
+
<span class='homogen--name'><b>
sum
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
Parser.HTML
</code> <b><span class='method'>
feed_insert
</span>(</b><code class='datatype'>
string
</code> <code class='argument'>
s
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
mixed
</code> <b><span class='method'>
sum
</span>(</b><code class='datatype'>
array
</code> <code class='argument'>
a
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p>
This
pushes a string on
the
parser
stack.
-
(I'll
write
more
about
this mechanism later.)
-
</p>
-
</dd>
-
<dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'>
-
<p>the called object</p>
+
<dd class='body--doc'><p>
Sum
the
elements
of
an
array
using
`+
</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
finish
</b></span>
+
<span class='homogen--name'><b>
sum_arrays
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
Parser.HTML
</code> <b><span class='method'>
finish
</span>(</b><
b
>
)
</
b
><
/
code><
br>
-
<
code><code class='
object unresolved
'>
Parser.HTML
</code> <
b><span
class='
method
'>
finish
</
span
>
(
<
/b><
code class='datatype'>
string
</code> <code class='argument'>
s
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
array
</code> <b><span class='method'>
sum_arrays
</span>(</b><
code class='datatype'
>
function
</
code
>
(
<code
class='datatype'
>
mixed
<
/
code>
... :
<code class='
datatype
'>
mixed
</code>
)
<
code
class='
argument
'>
sum
</
code
>
,
<code class='datatype'>
array
</code>
...
<code class='argument'>
args
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p>
Finish
a
parser
pass.
A
string
may
be
sent
here,
similar
to
-
feed()
.
-
<
/p
>
-
</
dd
>
-
<dt
class='head--doc'
>
Returns
</
dt
>
-
<
dd class='body--doc'>
-
<p>the called object<
/p>
+
<dd class='body--doc'><p>
Applies
the
function
<code>sum</code>
columnwise
on
the
elements
in
the
+
provided
arrays
.
E.g.
<
tt
>
sum_array(`+,a,b,c)
</
tt
>
does the same
+
as
<
tt
>
`+(a[*],b[*],c[*])
</
tt
>
.
</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get_extra
</b></span>
+
<span class='homogen--name'><b>
uniq2
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>array
</code> <b><span class='method'>
get_extra
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>array</code> <b><span class='method'>
uniq2
</span>(</b><
code class='datatype'>array</code> <code class='argument'>a</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p>
Gets
the
extra
arguments
set
by
<code>set_extra</code>().
-
</p>
-
<
/dd
>
-
<dt
class='head
-
-doc'>Returns
</
dt
>
-
<
dd
class='body--doc'
>
-
<
p
>
the
called object
</p>
+
<dd class='body--doc'><p>
Perform
the
same
action
as
the
Unix uniq command on an array,
+
that is, fold consecutive occurrences of the same element into
+
a single element of the result array:
</p>
+
<
p
>
aabbbcaababb
-
> abcabab.
</
p
>
+
<
p>
See also the <code
>
uniq
<
/code
>
function.
</p>
</dd></dl>
-
+
</dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Function</b></h2>
+
</dt><dd>
-
+
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
parse
_
tag_args
</b></span>
+
<span class='homogen--name'><b>
splice
_
call
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
mapping
</code> <b><span class='method'>
parse
_
tag_args
</span>(</b><code class='datatype'>
string
</code> <code class='argument'>
tag
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
mixed
</code> <b><span class='method'>
splice
_
call
</span>(</b><code class='datatype'>
array
</code> <code class='argument'>
args
</code>
,
<
code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code>, <code class='datatype'>mixed</code>|<code class='datatype'>void</code> ... <code class='argument'>extra</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p>
Parses
the
tag
arguments
from
a
tag
string
without
the
name
-
and
surrounding
brackets,
i
.
e.
a
string
on
the
form
-
"
<tt>
some=
"
tag
"
args
</tt>
"
.</p>
+
<dd class='body--doc'><p>
Calls
the
given
function
with
the
<tt>args</tt>
array
plus
the
optional
+
extra arguments as its arguments
and
returns
the
result
.
</p>
+
<p>
Most
useful
in
conjunction
with <code>map</code>, and particularly in combination
+
with
<
code>sscanf</code> with <
tt>"
...%{...%}...
"</tt>
scan strings (which indeed
+
was what it was invented for in the first place)
.</p>
</dd>
-
<dt class='head--doc'>
Returns
</dt>
-
<dd class='body--doc'>
-
<p>
a
mapping
containing
the
tag
arguments
</p>
+
<dt class='head--doc'><
span id='p-args'><
/
span>Parameter <code class='parameter'>args</code></
dt>
+
<dd
></dd><dd
class='body--doc'><p>
The
first
arguments
the
function
<
tt>f<
/
tt> expects</
p>
</dd>
-
<dt class='head--doc'>
See also
<
/dt>
-
<dd
class
='
body--doc'>
-
<
p
><code>tag_args</code></p></dd></dl>
-
-
-
<hr />
-
<dl class='group
-
-doc
'>
-
<
dt class='head--type'><span class='homogen--type'>Method<
/span>
-
<
span
class='
homogen--name
'><
b>parse_tag_name<
/
b
></
span>
-
</
dt>
-
<dd><
p><code><code class='object unresolved'>string <
/
code> <b><span class='method'>parse_tag_name</span>(</b><code class='datatype'>string</code> <code class='argument'>tag</code><b>)</b></code></p></
dd>
-
-
<
dt class='head--doc'>Description</dt>
-
<
dd class='body--doc'>
-
<p>
Parses
the
tag
name
from a tag string without
the
surrounding
-
brackets,
i.e. a string
on
the form "
<
tt>tagname some="tag"
-
args<
/
tt>".</
p>
+
<dt class='head--doc'><
span
id
='p-
f
'></span>
Parameter
<
code
class='
parameter
'>
f
</
code
></dt>
+
<dd></dd><dd class='body--doc'><p>
The
function
to
apply
the
arguments
on</p>
</dd>
-
<dt class='head--doc'>
Returns
<
/dt>
-
<dd
class
='
body--doc'>
-
<
p
>the tag name or an empty string if none</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group
-
-doc
'>
-
<
dt class='head--type'><span class='homogen--type'>Method<
/span>
-
<span
class='homogen--name'>
<
b>read</b></span>
-
</dt>
-
<dd><p><
code
><code
class='
datatype
'>
string
</code>
|
<
code class='datatype'>array<
/
code
>
(<code class='datatype'>mixed</code>) <b><span class='method'>read</span>(</b><b>)</b></code><br>
-
<
code
><
code class='datatype'>string<
/
code>|<code class='datatype'>array</code>(<code class='datatype'>mixed</code>) <b><span class='method'>read</span>(</b><code class='datatype'>int</code> <code class='argument'>max_elems</code><b>)</b></code></p></
dd>
-
-
<
dt class='head--doc'>Description</dt>
-
<
dd class='body--doc'>
-
<p>
Read
parsed
data
from
the
parser
object.
<
/p
>
-
-
<
p><code>mixed_mode<
/
code
>
, an array of arbitrary data otherwise.
</p>
+
<dt class='head--doc'><
span
id
='p-
extra
'></span>
Parameter
<code class='
parameter
'>
extra
</code></
dt
>
+
<
dd
></dd><dd class='body--doc'><p>
Optional
extra
arguments
to
send
to
<
tt
>
f
</
tt
></p>
</dd> <dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'>
-
<p>
a
string of parsed data if
the
parser
isn't
in
<
/p
>
-
</
dd
>
</dl>
-
-
-
<hr
/>
-
<
dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method<
/
span>
-
<span class='homogen--name'><b>set_extra</b></span>
-
</dt>
-
<dd><
p>
<code><code class='object unresolved'>Parser.HTML </code> <b><span class='method'>set_extra</span>(</b><code class='datatype'>mixed</code> <code class='argument'>...args</code><b>)</b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p>Sets the extra arguments passed to all tag, container and
-
entity callbacks.
-
</p>
+
<dd class='body--doc'><p>
Whatever
the
supplied
function
<
tt
>
f
</
tt
>
returns
</p>
</dd>
-
<dt class='head--doc'>
Returns
</dt>
-
<dd class='
body--doc
'>
-
<p>
the
called
object
</p>
-
</dd></dl>
+
<dt class='head--doc'>
Example
</dt>
+
<dd class='
example
'><
pre><
p>
<code
class='expr'>
+
class Product(string name, string version)
+
{
+
string _sprintf()
+
{
+
return sprintf("Product(%s/%s)", name, version);
+
}
+
}
+
map(({ ({ "pike", "7.1.11" }),
+
({ "whitefish", "0.1" }) }),
+
Function.splice_call, Product);
+
({ /* 2 elements */
+
Product(pike/7.1.11),
+
Product(whitefish/0.1)
+
})
+
</
code></
p>
+
</
pre></
dd></dl>
+
</dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Program</b></h2>
+
</dt><dd>
-
+
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
splice
_
arg
</b></span>
+
<span class='homogen--name'><b>
all
_
inherits
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
string
</code> <b><span class='method'>
splice
_
arg
</span>(</b><code class='datatype'>
void
</code>
|<code
class='datatype'>string
<
/
code
>
<code
class='argument'>
name
</code><b>)</b></code></p></dd>
-
-
<dt class='head--
doc
'>
Description
</dt>
-
<dd class='body--
doc
'>
-
<p>
If given a string, it sets the splice argument name to it
.
It
</p>
-
-
<p>If a splice argument name is set, it's parsed in all tags,
-
both those with callbacks and those without. Wherever it
-
occurs, its value (after being parsed for entities in the
-
normal way) is inserted directly into the tag. E.g:
-
<pre>
-
<foo arg1="val 1" splice="arg2='val 2' arg3" arg4>
-
</pre>
-
becomes
-
<pre>
-
<foo arg1="val 1" arg2='val 2' arg3 arg4>
-
</pre>
-
if "splice" is set as the splice argument name.</p>
-
</dd>
-
<dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'>
-
<p>the old splice argument name.</p>
+
<dd><p><code><code class='
datatype'>array</code>(<code
class=
'
datatype'
>
program
</code>
)
<b><span class='method'>
all
_
inherits
</span>(</b><code class='datatype'>
program
</code> <code class='argument'>
p
</code><b>)</b></code></p></dd>
+
<dt class='head--
fixme
'>
FIXME
</dt>
+
<dd class='body--
fixme
'><p>
Document
this
function
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
tag</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>tag
_
name
</b></span>
<br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>tag_args</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>tag_content</b></span><br>
+
<span class='homogen--name'><b>
inherit
_
tree
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved'>array </code> <b><span class='method'>tag</span>(</b><b>)</b></code><br>
-
<code><code class='object unresolved'>string </code> <b><span class='method'>tag_name</span>(</b><b>)</b></code><br>
-
<code><code class='
datatype'>
mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>mixed</code>) <b><span class='method'>tag_args</span>(</b><b>)</b></code><br>
-
<code><code class='object unresolved'>string </code> <b><span class='method'>tag_content</span>(</b><b>)</b></code><br>
-
<code><code class='object unresolved'>
array
</code> <b><span class='method'>
tag</span>(</b><code class='datatype'>mixed</code> <code class='argument'>default
_
value
</
code><b>)</b></code><br>
-
<code><code class='object unresolved'>string </code> <b><
span
class='method'
>
tag_args</span>
(</b><code class='datatype'>
mixed
</code> <code class='argument'>
default_value
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>array</code> <b><span class='method'>
inherit
_
tree
</span>(</b><code class='datatype'>
program
</code> <code class='argument'>
p
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p>
These give parsed information about the current thing being
-
parsed, e.g. the current tag, container or entity. They return
-
zero if they're not applicable.</p>
-
-
<p>
-
<tt>tag_name</tt> gives the name of the current tag. If used
-
from an entity callback, it gives the string inside the
-
entity.</p>
-
-
<p>
-
<tt>tag_args</tt> gives the arguments of the current tag,
-
parsed to
a
convenient
mapping
consisting of key:value pairs.
-
If the current thing isn't a tag, it gives zero
.
default_value
-
is used for arguments which have no value in the tag. If
-
default_value isn't given, the value is set to the same string
-
as the key.
</p>
-
-
<p>
-
<tt>tag_content</tt> gives the content of the current tag, if
-
it's a container or quote tag.</p>
-
-
<p>
-
<tt>tag()</tt> gives the equivalent of
-
<tt>({tag_name(),tag_args(), tag_content()})</tt>.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>write_out</b></span>
-
</dt>
-
<dd><p><code><code class='object unresolved'>Parser.HTML </code> <b><span class='method'>write_out</span>(</b><code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'>
-
<p> Send data to the output stream, i.e. it won't be parsed and
-
it won't be sent to the data callback, if any.</p>
-
-
<p>
-
Any data is allowed when the parser is running in
-
<code>mixed_mode</code>. Only strings are allowed otherwise.
-
</p>
+
<dd class='body--doc'><p>
Recursively
builds
a
inheritance
tree
by
+
fetching
programs
inheritance
lists
.</p>
</dd> <dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'>
-
<p>
the
called
object
</p>
-
</dd></dl>
-
</dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>
Parser
</b></h2>
+
<dd class='body--doc'>
<p>Returns an array with programs or arrays
+
as elements.
<
/
p>
+
</dd>
+
<dt
class='head--doc'>Example</dt>
+
<dd
class='example'>
<
pre><p>> class a{}
+
> class b{}
+
> class c{ inherit a; }
+
> class d{ inherit b; inherit c; }
+
> Program.inherit_tree(d);
+
Result: ({
/
* 3 elements */
+
d,
+
({ /* 1 element */
+
program
+
}),
+
({ /* 2 elements */
+
c,
+
({ /* 1 element */
+
program
+
})
+
})
+
})</
p>
+
</
pre></
dd></dl>
+
</dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>
ADT
</b></h2>
+
</dt><dd><dl><dt><h2 class='header'>Class <b class='ms datatype'>ADT.Heap</b></h2>
</dt><dd> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
.
</b></span>
+
<span class='homogen--name'><b>
adjust
</b></span>
</dt>
-
<dd><p><code> <b><span class='method'>
.
</span>(</b><b>)</b></code></p></dd>
-
</dl>
+
<dd><p><code>
<code
class='datatype'>void
<
/code> <
b><span class='method'>
adjust
</span>(</b><
code class='datatype'>mixed</code> <code class='argument'>value</code><
b>)</b></code></p></dd>
+
<
dt class='head--fixme'>FIXME<
/
dt>
+
<dd class='body--fixme'><p>Document this function</p>
+
</dd></
dl>
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
decode_numeric_xml_entity
</b></span>
+
<span class='homogen--name'><b>
push
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
string
</code> <b><span class='method'>
decode_numeric_xml_entity
</span>(</b><code class='datatype'>
string
</code> <code class='argument'>
chref
</code><b>)</b></code></p></dd>
-
-
<dt class='head--
doc
'>
Description
</dt>
-
<dd class='body--
doc
'><p>
Decodes
the
numeric XML entity
<
code>chref<
/
code>, e.g. <tt>"&#x34;"</tt> and
-
returns the character as a string. <code>chref</code> is the name part of
-
the entity, i.e. without the leading '&' and trailing ';'. Returns
-
zero if <code>chref</code> isn't on a recognized form or if the character
-
number is too large to be represented in a string.</
p>
+
<dd><p><code><code class='datatype'>
void
</code> <b><span class='method'>
push
</span>(</b><code class='datatype'>
mixed
</code> <code class='argument'>
value
</code><b>)</b></code></p></dd>
+
<dt class='head--
fixme
'>
FIXME
</dt>
+
<dd class='body--
fixme
'><p>
Document
this
function
</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get_xml_parser
</b></span>
+
<span class='homogen--name'><b>
size
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
Parser.HTML
</code> <b><span class='method'>
get_xml_parser
</span>(</b><b>)</b></code></p></dd>
-
-
<dt class='head--
doc
'>
Description
</dt>
-
<dd class='body--
doc
'><p>
Returns
a
<
code>Parser.HTML<
/
code> initialized for parsing XML. It has all
-
the flags set properly for XML syntax and callbacks to ignore
-
comments, CDATA blocks and unknown PI tags, but it has no
-
registered tags and doesn't decode any entities.</
p>
+
<dd><p><code><code class='
datatype
'>
int
</code> <b><span class='method'>
size
</span>(</b><b>)</b></code></p></dd>
+
<dt class='head--
fixme
'>
FIXME
</dt>
+
<dd class='body--
fixme
'><p>
Document
this
function
</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
html_entity_parser
</b></span>
<br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>parse_html_entities</b></span><br>
+
<span class='homogen--name'><b>
top
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved'>HTML</code> <b><span class='method'>html_entity_parser</span>(</b><b>)</b></code><br>
-
<code><code class='
datatype'>
string
</code> <b><span class='method'>
parse_html_entities
</span>(</b><
code class='datatype'>string</code> <code class='argument'>in</code><
b>)</b></code></p></dd>
-
-
<dt class='head--
doc
'>
Description
</dt>
-
<dd class='body--
doc
'><p>
Parse
any
HTML entities in the string to unicode characters.
-
Either return a complete parser (to build on or use) or parse
-
a string. Throw an error if there is an unrecognized entity in
-
the string.
</p>
-
</dd>
-
<dt class='head--doc'>Note</dt>
-
<dd class='body--doc'><p>Currently using XHTML 1.0 tables.</p>
+
<dd><p><code><code class='datatype'>
mixed
</code> <b><span class='method'>
top
</span>(</b><b>)</b></code></p></dd>
+
<dt class='head--
fixme
'>
FIXME
</dt>
+
<dd class='body--
fixme
'><p>
Document
this
function
</p>
</dd></dl>
-
<dl><dt><h2 class='header'>Class <b class='ms datatype'>
Parser
.
RCS
</b></h2>
+
<
/dd></
dl><
dl><
dt><h2 class='header'>Class <b class='ms datatype'>
ADT
.
History
</b></h2>
</dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>A
RCS
file
parser
that
eats
a
RCS
*,v
file
and
presents
nice
pike
-
data
structures
of
its
contents
.</p>
+
<dd class='body--doc'><p>A
history
is
a
stack
where
you can only push entries. When the stack has
+
reached
a
certain
size
the
oldest
entries
are
removed on every push.
+
Other proposed names for this
data
type
is
leaking
stack and table
+
(where you push objects onto the table in one end and objects are falling
+
off the table in the other
.</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
access
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
_sizeof
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
array
</code>
(
<
code
class='
datatype
'>
string
</
code
>
)
Parser
.
RCS.
<
b
><span class='
variable
'>
access
</span></b></code></p></dd>
+
<dd><p><code><code class='datatype'>
int
</code>
<
b><span
class='
method
'>
sizeof
</
span
>
(</b>
<span class='class'>ADT
.
History
<
/span
>
<span class='
argument
'>
arg
</span>
<
b>)<
/b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
The
usernames
listed
in the
ACCESS
section
of
the
RCS
file
</p>
+
<dd class='body--doc'><p>
A
<code>sizeof</code>
operation
on this object returns the number
+
of elements currently
in the
history,
e.g.
<=
the
current
+
max size.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
branch
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
`[]
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
string
</code>
|
<code class='
datatype
'>
int(0
.
.0
)</code>
Parser.RCS.
<
b><span
class='
variable
'>
branch
</
span
></
b></
code></p></dd>
+
<dd><p><code><code class='datatype'>
mixed
</code>
res =
<code class='
class
'>
ADT.History
()</code>
[ 
<
code
class='
class
'>
i
</
code
>
 ]
</code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
The
default
branch
(or
revision),
if
present
,
<code
class='expr'>0</code>
otherwise
</p>
+
<dd class='body--doc'><p>
Get
a
value
from
the
history as
if
it was an array
,
e.g.
+
both
positive and negative numbers may be used. The positive
+
numbers are however offset with 1, so [1] is the first entry
+
in the history and [-1] is the last.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>branches</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>string</code>) Parser.RCS.<b><span class='variable'>branches</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Maps branch numbers (indices) to branch names (values)</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>comment</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>string</code>|<code class='datatype'>int(0..0)</code> Parser.RCS.<b><span class='variable'>comment</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>The RCS file comment if present, <code class='expr'>0</code> otherwise</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>create</b></span> </dt>
-
<dd><p><code><span class='object'>
Parser
.
RCS
</span> <span class='class'>
Parser
.
RCS
</span><b>(</b><code class='datatype'>
string</code>|<code class='datatype'>void</code> <code class='argument'>file_name</code>, <code class='datatype'>string</code>|<code class='datatype'>
int
(0..0)
</code>
|<code
class='datatype'>void
<
/
code
>
<code
class='argument'>
file
_
contents
</code><b>)</b></code></p></dd>
+
<dd><p><code><span class='object'>
ADT
.
History
</span> <span class='class'>
ADT
.
History
</span><b>(</b><code class='datatype'>int</code> <code class='argument'>
max
_
size
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Initializes the RCS object.
<
/p>
-
</dd>
-
<dt class='head--doc'><span id='p-file_name'></span>Parameter <
code
class='parameter'
>
file
_
name
</code>
</dt>
-
<dd></dd><dd
class='body--doc'><p>The
path to
the
raw
RCS
file
(includes
trailing ",v"). Used
-
mainly for error reporting (truncated RCS file).</p>
-
</dd>
-
<dt class='head--doc'><span id='p-file_contents'></span>Parameter <code class='parameter'>file_contents</code></dt>
-
<dd></dd><dd class='body--doc'><p>If a string is provided,
that
string
will
be
parsed to
-
initialize
the
RCS object. If a zero (<code class='expr'>0</code>) is sent, no
-
initialization will be performed
at
all.
If
no value is given at
-
all, but <code>file_name</code> was provided, that file will be loaded and
-
parsed for object initialization
.</p>
+
<dd class='body--doc'><p><code>
max
_
size
</code>
is
the
maximum
number
of
entries
that
can
reside
in
the
+
history
at
the
same
time
.</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
description
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
flush
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
string
</code>
Parser.RCS.
<b><span class='
variable
'>
description
</span></b></code></p></dd>
+
<dd><p><code><code class='datatype'>
void
</code> <b><span class='
method
'>
flush
</span>
(
</b><
b>)<
/
b></
code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>The
RCS
file
description
</p>
+
<dd class='body--doc'><p>
Empties the history. All entries in the history are
+
removed, to allow garbage collect to remove them.
+
The
entry
sequence
counter is not reset.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
expand
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
get_first_entry_num
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
string
</code>
Parser.RCS.
<b><span class='
variable
'>
expand
</span></b></code></p></dd>
+
<dd><p><code><code class='datatype'>
int
</code> <b><span class='
method
'>
get_first_entry_num
</span>
(
</b><
b>)<
/
b></
code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
The
keyword
expansion
options
(as
named
by
RCS)
if
present,
-
<code
class='expr'>0</code>
otherwise
</p>
+
<dd class='body--doc'><p>
Returns
the
absolute
sequence
number
of
the
+
oldest
result
still
in
the
history.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
head
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
get_latest_entry_num
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
string
</code>
Parser.RCS.
<b><span class='
variable
'>
head
</span></b></code></p></dd>
+
<dd><p><code><code class='datatype'>
int
</code> <b><span class='
method
'>
get_latest_entry_num
</span>
(
</b><
b>)<
/
b></
code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Version
number of the
head
version
of
the
file
</p>
+
<dd class='body--doc'><p>
Returns
the absolute sequence
number of the
latest
+
result
inserted
into
the
history.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>locks</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>string</code>) Parser.RCS.<b><span class='variable'>locks</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Maps from username to revision for users that have acquired locks
-
on this file</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
parse
</b></span>
+
<span class='homogen--name'><b>
get_maxsize
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
this_program
</code> <b><span class='method'>
parse
</span>(</b><
code class='datatype'>string</code> <code class='argument'>raw</code>, <code class='datatype'>void</code>|<code class='datatype'>function</code>(<code class='datatype'>string</code>:<code class='datatype'>void</code>) <code class='argument'>progress_callback</code><
b>)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
int
</code> <b><span class='method'>
get_maxsize
</span>(</b><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Parse
the
RCS
file
<code>raw</code> and initialize all members
of
this
object
-
fully initialized.</p>
-
</dd>
-
<dt class='head--doc'><span id='p-raw'></span>Parameter <code class='parameter'>raw</code></dt>
-
<dd></dd><dd class='body--doc'><p>The unprocessed RCS file.</p>
-
</dd>
-
<dt class='head--doc'><span id='p-progress_callback'></span>Parameter <code class='parameter'>progress_callback</code></dt>
-
<dd></dd><dd class='body--doc'><p>Passed on to <code>parse_deltatext_sections</code>.</p>
-
</dd>
-
<dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'><p>The fully initialized object (only returned for API convenience;
-
the
object itself is destructively modified to match the data
-
extracted from
<
code>raw<
/
code>)</
p>
-
</dd>
-
<dt class='head--doc'>See also</dt>
-
<dd class='body--doc'><p><code>parse_admin_section</code>, <code>parse_delta_sections</code>,
-
<code>parse_deltatext_sections</code>, <code>create</code></p>
+
<dd class='body--doc'><p>
Returns
the
maximum
number
of
values
in
the
history
</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
parse_admin_section
</b></span>
+
<span class='homogen--name'><b>
push
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
string
</code> <b><span class='method'>
parse_admin_section
</span>(</b><code class='datatype'>
string
</code> <code class='argument'>
raw
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
void
</code> <b><span class='method'>
push
</span>(</b><code class='datatype'>
mixed
</code> <code class='argument'>
value
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Lower-level
API
function
for
parsing
only
the
admin section (the
-
initial chunk of an RCS file, see manpage rcsfile(5)) of an RCS
-
file
.
After running
<
code>parse_admin_section<
/
code>, the RCS object will be
-
initialized with the values for <code>head</code>, <code>branch</code>, <code>access</code>,
-
<code>branches</code>, <code>tags</code>, <code>locks</code>, <code>strict_locks</code>, <code>comment</code> and
-
<code>expand</code>.</
p>
-
</dd>
-
<dt class='head--doc'><span id='p-raw'></span>Parameter <code class='parameter'>raw</code></dt>
-
<dd></dd><dd class='body--doc'><p>The unprocessed RCS file.</p>
-
</dd>
-
<dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'><p>The rest of the RCS file, admin section removed.</p>
-
</dd>
-
<dt class='head--doc'>See also</dt>
-
<dd class='body--doc'><p><code>parse_delta_sections</code>, <code>parse_deltatext_sections</code>, <code>parse</code>, <code>create</code></p>
-
</dd><dt class='head--fixme'>FIXME</dt>
-
<dd class='body--fixme'><p>Does not handle rcsfile(5) newphrase skipping.</p>
+
<dd class='body--doc'><p>
Push
a
new
value
into
the
history
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
parse
_
delta_sections
</b></span>
+
<span class='homogen--name'><b>
set
_
maxsize
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
string
</code> <b><span class='method'>
parse
_
delta_sections
</span>(</b><code class='datatype'>
string
</code> <code class='argument'>
raw
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
void
</code> <b><span class='method'>
set
_
maxsize
</span>(</b><code class='datatype'>
int
</code> <code class='argument'>
_maxsize
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Lower-level
API function for parsing only
the
delta
sections
(the
-
second chunk
of
an
RCS
file,
see manpage rcsfile(5)) of an RCS
-
file. After running <code>parse_delta_sections</code>, the RCS object will
-
be
initialized with the value of <code>description</code> and populated
-
<code>revisions</code>
mapping
and <code>trunk</code> array. Their <code>Revision</code> members
-
are however only populated with
the
members
<code>Revision->revision</code>,
-
<code>Revision->branch</code>, <code>Revision->time</code>, <code>Revision->author</code>,
-
<code>Revision->state</code>, <code>Revision->branches</code>, <code>Revision->rcs_next</code>,
-
<code>Revision->ancestor</code> and <code>Revision->next</code>
.</p>
-
</dd>
-
<dt class='head--doc'><span id='p-raw'></span>Parameter <code class='parameter'>raw</code></dt>
-
<dd></dd><dd class='body--doc'><p>The unprocessed RCS file, with admin section removed. (See
-
<code>parse_admin_section</code>.)</p>
-
</dd>
-
<dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'><p>The rest of the RCS file, delta sections removed.</p>
-
</dd>
-
<dt class='head--doc'>See also</dt>
-
<dd class='body--doc'><p><code>parse_admin_section</code>, <code>parse_deltatext_sections</code>, <code>parse</code>, <code>create</code></p>
-
</dd><dt class='head--fixme'>FIXME</dt>
-
<dd class='body--fixme'><p>Does not handle rcsfile(5) newphrase skipping.</p>
+
<dd class='body--doc'><p>
Set
the
maximume
number
of
entries
that
can
be
+
stored
in
the
history
simultaneous
.</p>
</dd></dl>
-
+
</dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>ADT.Priority_queue</b></h2>
+
</dt><dd>
-
+
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
parse
_
deltatext_sections
</b></span>
+
<span class='homogen--name'><b>
adjust
_
pri
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>void</code> <b><span class='method'>
parse
_
deltatext_sections
</span>(</b><code class='datatype'>
string
</code> <code class='argument'>
raw
</code>, <code class='datatype'>
void
</code>
|<code
class='datatype'>function
<
/
code
>(<code
class='
datatype'>string</code>:<code class='datatype'>void</code>) <code class='
argument'>
progress
_
callback
</code>
,
<
code class='datatype'>array</code>|<code class='datatype'>void</code> <code class='argument'>callback_args</code><
b>)</b></code></p></dd>
-
-
<dt class='head--
doc'>Description</dt>
-
<dd class='body--doc'><p>Lower-level API function for parsing only the deltatext sections
-
(the final and typically largest chunk of an RCS file, see manpage
-
rcsfile(5)) of an RCS file. After a <code>parse_deltatext_sections</code>
-
run, the RCS object will be fully populated.</p>
-
</dd>
-
<dt class='head--doc'><span id='p-raw'></span>Parameter <code class='parameter'>raw</code></dt>
-
<dd></dd><dd class='body--doc'><p>The unprocessed RCS file, with admin and delta sections removed.
-
(See <code>parse_admin_section</code> and <code>parse_delta_sections</code>.)</p>
-
</dd>
-
<dt class='head--doc'><span id='p-progress_callback'></span>Parameter <code class='parameter'>progress_callback</code></dt>
-
<dd></dd><dd class='body--doc'><p>This optional callback is invoked with the revision of the
-
deltatext about to be parsed (useful for progress indicators).</p>
-
</dd>
-
<dt class='head--doc'><span id='p-args'></span>Parameter <code class='parameter'>args</code></dt>
-
<dd></dd><dd class='body--doc'><p>Optional extra trailing arguments to be sent to <code>progress_callback</code></p>
-
</dd>
-
<dt class='head--doc'>See also</dt>
-
<dd class='body--doc'><p><code>parse_admin_section</code>, <code>parse_delta_sections</code>, <code>parse</code>, <code>create</code></p>
-
</dd><dt class='head--
fixme'>FIXME</dt>
-
<dd class='body--fixme'><p>
Does
not
handle rcsfile(5) newphrase skipping.
</p>
+
<dd><p><code><code class='datatype'>void</code> <b><span class='method'>
adjust
_
pri
</span>(</b><code class='datatype'>
mixed
</code> <code class='argument'>
handle
</code>, <code class='datatype'>
int
</code> <code class='argument'>
new
_
pri
</code><b>)</b></code></p></dd>
+
<dt class='head--fixme'>FIXME</dt>
+
<dd class='body--fixme'><p>
Document
this
function
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
revisions
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Inherit
</span>
+
<span class='homogen--name'><b>
Heap
</b></span>
</dt>
-
<dd><p><code><
code
class='datatype'>
mapping</code>(<code
class='datatype'>string
</
code
>:
<code
class='object unresolved'>Revision
<
/code>) Parser.RCS.<b><
span class='
variable
'>
revisions
</span></
b></
code></p></dd>
+
<dd><p><code><
span
class='datatype'>
inherit .Heap
</
span
> : <span class='
inherit
'>
Heap
</span></code></p></dd>
+
</dl>
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Data for all revisions of the file. The indices of the mapping are
-
the revision numbers, whereas the values are the data from the
-
corresponding revision.</p>
-
</dd></dl>
+
-
+
<hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
strict_locks
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
pop
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
bool
</code>
Parser.RCS.
<b><span class='
variable
'>
strict_locks
</span></b></code></p></dd>
-
-
<dt class='head--
doc
'>
Description
</dt>
-
<dd class='body--
doc
'><p>
1
if
strict locking is set, 0 otherwise
</p>
+
<dd><p><code><code class='datatype'>
mixed
</code> <b><span class='
method
'>
pop
</span>
(
</b><
b>)<
/
b></
code></p></dd>
+
<dt class='head--
fixme
'>
FIXME
</dt>
+
<dd class='body--
fixme
'><p>
Document
this
function
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
tags
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
push
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
mapping
</code>(<code class='datatype'>
string
</code>
:
<code class='
datatype
'>
string
</code>
)
Parser.RCS.
<
b
><
span
class='
variable
'>
tags
</
span
></b></code></p></dd>
-
-
<dt class='head--
doc
'>
Description
</dt>
-
<dd class='body--
doc
'><p>
Maps
tag
names (indices) to tagged revision numbers (values)
</p>
+
<dd><p><code><code class='datatype'>
mixed
</code>
<b><span class='method'>push</span>
(<
/b><
code class='datatype'>
int
</code>
<code class='
argument
'>
pri
</code>
,
<
code class='datatype'
>
mixed
<
/code>
<code
class='
argument
'>
val
</
code
><
b>)<
/b></code></p></dd>
+
<dt class='head--
fixme
'>
FIXME
</dt>
+
<dd class='body--
fixme
'><p>
Document
this
function
</p>
</dd></dl>
-
-
-
<
hr
/
>
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>trunk</b></span>
-
</dt>
-
<
dd><
p><code><code class='datatype'>array<
/
code>(<code class='datatype'>mapping</code>) Parser.RCS.<b><span class='variable'>trunk</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Data for all revisions on the trunk, sorted in the same order as the
-
RCS file stored them - ie descending, most recent first, I'd assume
-
(rcsfile(5), of course, fails to state such irrelevant information).</p>
-
</dd></
dl>
-
<dl><dt><h2 class='header'>Class <b class='ms datatype'>
Parser
.
RCS.DeltatextIterator
</b></h2>
+
</dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>
ADT
.
Queue
</b></h2>
</dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Iterator
for
the
deltatext sections of the RCS file
.
Typical usage:
</p>
-
</dd>
-
<dt class='head--doc'>Example</dt>
-
<dd class='example'><pre><p>string raw = Stdio.read_file(my_rcs_filename);
-
Parser.RCS rcs = Parser.RCS(my_rcs_filename, 0);
-
raw = rcs->parse_delta_sections(rcs->parse_admin_section(raw));
-
foreach(rcs->DeltatextIterator(raw); int n; Parser.RCS.Revision rev)
-
do_something(rev);</p>
-
</pre></dd></dl>
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>`!</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>bool</code> res = !<code class='class'>Parser.RCS.DeltatextIterator()</code></code></p></dd>
-
-
<dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'><p>1 if the iterator has processed all deltatext entries, 0 otherwise.</p>
+
<dd class='body--doc'><p>
A
simple
FIFO
queue
.</p>
</dd></dl>
-
+
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>create</b></span> </dt>
-
<dd><p><code><span class='object'>
Parser
.
RCS.DeltatextIterator
</span> <span class='class'>
Parser
.
RCS.DeltatextIterator
</span><b>(</b><code class='datatype'>
string</code> <code class='argument'>deltatext_section</code>, <code class='datatype'>void</code>|<code class='datatype'>function</code>(<code class='datatype'>string</code>, <code class='datatype'>
mixed</code> ...
:<code
class='datatype'>void
<
/
code
>)
<code
class='argument'>
progress_callback</code>, <code class='datatype'>void</code>|<code class='datatype'>array</code>(<code class='datatype'>mixed</code>) <code class='argument'>progress_callback_
args</code><b>)</b></code></p></dd>
-
-
<dt class='head--
doc
'><
span id='p-deltatext_section'><
/
span>Parameter <code class='parameter'>deltatext_section</code></
dt>
-
<dd
></dd><dd
class='body--
doc
'><p>
the
deltatext
section of the RCS file in its entirety
</p>
-
</dd>
-
<dt class='head--doc'><span id='p-progress_callback'></span>Parameter <code class='parameter'>progress_callback</code></dt>
-
<dd></dd><dd class='body--doc'><p>This optional callback is invoked with the revision of the
-
deltatext about to be parsed (useful for progress indicators).</p>
-
</dd>
-
<dt class='head--doc'><span id='p-progress_callback_args'></span>Parameter <code class='parameter'>progress_callback_args</code></dt>
-
<dd></dd><dd class='body--doc'><p>Optional extra trailing arguments to be sent to <code>progress_callback</code></p>
-
</dd>
-
<dt class='head--doc'>See also</dt>
-
<dd class='body--doc'><p>the <tt>rcsfile(5)</tt> manpage outlines the sections of an RCS file</p>
+
<dd><p><code><span class='object'>
ADT
.
Queue
</span> <span class='class'>
ADT
.
Queue
</span><b>(</b><code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
+
<dt class='head--
fixme
'>
FIXME
</dt>
+
<dd class='body--
fixme
'><p>
Document
this
function
</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
first
</b></span>
+
<span class='homogen--name'><b>
flush
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
bool
</code> <b><span class='method'>
first
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
void
</code> <b><span class='method'>
flush
</span>(</b><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Restart
not
implemented; always returns 0 (==failed)
</p>
+
<dd class='body--doc'><p>
Empties
the
queue.
</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
index
</b></span>
+
<span class='homogen--name'><b>
read
</b></span>
<br>
+
<span class='homogen--type'>Method</span>
+
<span class='homogen--name'><b>get</b></span><br>
</dt>
-
<dd><p><code><code class='datatype'>
int
</code> <b><span class='method'>
index
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
mixed
</code> <b><span class='method'>
read
</span>(</b><b>)</b></code><
br>
+
<code><code class='datatype'>mixed<
/
code> <b><span class='method'>get</span>(</b><b>)</b></code></
p></dd>
-
<dt class='head--doc'>
Returns
</dt>
-
<dd class='body--doc'><p>
the
number of deltatext entries processed so far (0..N-1, N
-
being
the
total
number
of
revisions in
the
rcs file)
</p>
+
<dt class='head--doc'>
Description
</dt>
+
<dd class='body--doc'><p>
Returns
the
next
element
from
the
queue.
</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
next
</b></span>
+
<span class='homogen--name'><b>
is_empty
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>bool</code> <b><span class='method'>
next
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>bool</code> <b><span class='method'>
is_empty
</span>(</b><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
like
<code
class='expr'><code>`+=</code>(1)</code>, but returns 0
if the
iterator
is
finished
</p>
+
<dd class='body--doc'><p>
Returns
true
if the
queue
is
empty,
+
otherwise zero.
</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
parse_deltatext_section
</b></span>
+
<span class='homogen--name'><b>
peek
</b></span>
</dt>
-
<dd><p><code><code class='
modifier'>protected</code> <code class='
datatype'>
string
</code> <b><span class='method'>
parse_deltatext_section
</span>(</b><
code class='datatype'>string</code> <code class='argument'>raw</code><
b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
mixed
</code> <b><span class='method'>
peek
</span>(</b><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Chops
off
the
first
deltatext
section
from the
string <code>raw</code> and
-
returns
the
rest
of
the
string, or the value <code class='expr'>0</code> (zero) if
-
we had already visited the final deltatext entry
.
The deltatext's
-
data is stored destructively in the appropriate entry of the
-
<
code>revisions<
/
code> array.</
p>
-
</dd>
-
<dt class='head--doc'>Note</dt>
-
<dd class='body--doc'><p><code>raw</code> must start with a deltatext entry for this method to work</p>
-
</dd><dt class='head--fixme'>FIXME</dt>
-
<dd class='body--fixme'><p>does not handle rcsfile(5) newphrase skipping</p>
-
</dd><dt class='head--fixme'>FIXME</dt>
-
<dd class='body--fixme'><p>if the rcs file is truncated, this method writes a descriptive
-
error to stderr and then returns 0 - some nicer error handling
-
wouldn't hurt</p>
+
<dd class='body--doc'><p>
Returns
the
next
element
from the
queue
+
without
removing
it
from
the
queue
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
read_next
</b></span>
+
<span class='homogen--name'><b>
write
</b></span>
<br>
+
<span class='homogen--type'>Method</span>
+
<span class='homogen--name'><b>put</b></span><br>
</dt>
-
<dd><p><code><code class='
modifier
'>
protected
</code> <code class='datatype'>
bool
</code> <b><span class='method'>
read_next
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
void
</code>
<b><span
class='method'>write
<
/span>(</b><
code class='datatype'>
mixed
</code> <
code class='argument'>item</code><
b>
)
<
/b></code><br>
+
<code><code class='datatype'>void</code> <b><
span class='method'>
put
</span>(</b><
code class='datatype'>mixed</code> <code class='argument'>item</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
drops
the
leading whitespace before next revision's deltatext
-
entry and sets this_rev to the revision number we're about to read.
<
/p>
-
</dd>
-
<dt class='head--doc'>Note</dt>
-
<dd class='body--doc'><p>this method requires that <
code>
raw
</code>
starts
with
a valid deltatext entry
</p>
+
<dd class='body--doc'><p>
Adds
the <code>
item
</code>
to
the
queue.
</p>
</dd></dl>
-
-
-
<
hr
/
>
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>value</b></span>
-
</dt>
-
<
dd><
p><code><code class='object unresolved'>Revision<
/
code> <b><span class='method'>value</span>(</b><b>)</b></code></p></dd>
-
-
<dt class='head--doc'>Returns</dt>
-
<dd class='body--doc'><p>the <code>Revision</code> at whose deltatext data we are, updated with its info</p>
-
</dd></
dl>
-
<
/dd></
dl><
dl><
dt><h2 class='header'>Class <b class='ms datatype'>
Parser
.
RCS.Revision
</b></h2>
+
</dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>
ADT
.
Stack
</b></h2>
</dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
All
data
tied
to
a
particular
revision
of the
file
.</p>
+
<dd class='body--doc'><p>
This
class
implements
a
simple
stack.
Instead
of
adding and removing
+
elements to an array, and thus making it vary in size for every push
+
and pop operation, this stack tries to keep
the
stack size constant
.
+
If however the stack risks to overflow, it will allocate double its
+
current size, i.e. pushing an element on an full 32 slot stack will
+
result in a 64 slot stack with 33 elements.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
added
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
_sizeof
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>int</code>
Parser.RCS.Revision.
<b><span class='
variable
'>
added
</span></b></code></p></dd>
+
<dd><p><code><code class='datatype'>int</code> <b><span class='
method
'>
sizeof
</span>
(
</b>
<
span class='class'>ADT.Stack<
/
span> <span class='argument'>arg</span> <b>)</b></
code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
the
number
of
lines
that
were added from
the
previous
revision
-
to
make this revision (for
the
initial revision too)
</p>
+
<dd class='body--doc'><p>
<code>sizeof</code>
on
a
stack
returns
the
number
of
entries
+
in
the
stack.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
ancestor
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
_values
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
string
</code>
Parser.RCS.Revision.
<b><span class='
variable
'>
ancestor
</span></b></code></p></dd>
+
<dd><p><code><code class='datatype'>
array
</code> <b><span class='
method
'>
values
</span>
(
</b>
<
span class='class'>ADT.Stack<
/
span> <span class='argument'>arg</span> <b>)</b></
code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
the
revision
of
the
ancestor
of
this
revision,
or 0 if this was
-
the
initial
revision
</p>
+
<dd class='body--doc'><p>
<code>values</code>
on
a
stack
returns
all
the
entries
in
+
the
stack,
in order.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
author
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
`+
</b></span>
</dt>
-
<dd><p><code><code class='
datatype
'>
string
</code>
Parser
.
RCS.Revision.
<
b
><
span
class='
variable
'>
author
</
span
></
b></
code></p></dd>
+
<dd><p><code><code class='
object unresolved
'>
this_program
</code>
res = <code class='class'>ADT
.
Stack()
<
/code
>
 + 
<
code
class='
class
'>
s
</
code
></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
the
name
of
the
user
that
committed
the
revision
</p>
+
<dd class='body--doc'><p>
A
stack
added
with another stack yields a third
+
a third stack will all
the
stack
elements
from
+
the
two first stacks.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>branch</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>string</code> Parser.RCS.Revision.<b><span class='variable'>branch</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>the branch name on which this revision was committed (calculated
-
according to how cvs manages branches)</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>branches</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>array</code>(<code class='datatype'>string</code>) Parser.RCS.Revision.<b><span class='variable'>branches</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>when there are branches from this revision, an array of the
-
revision numbers where each branch starts, otherwise 0</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
expand_keywords
</b></span>
+
<span class='homogen--name'><b>
create
</b></span>
</dt>
-
<dd><p><code><
code
class='
datatype
'>
string
</
code
> <
b><
span class='
method
'>
expand_keywords
</span>
(
<
/
b><
code class='datatype'>string<
/
code
>
|
<code class='datatype'>
void</code> <code class='argument'>text</code>, <code class='datatype'>
int</code>|<code class='datatype'>void</code> <code class='argument'>
override
_
binary
</code><b>)</b></code></p></dd>
+
<dd><p><code><
span
class='
object
'>
ADT.Stack
</
span
> <span class='
class
'>
ADT.Stack
</span><b>
(
</
b
><code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>
initial
_
size
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Expand
keywords
and
return
the
resulting
text
according to the
-
expansion
rules
set for the file.</p>
-
</dd>
-
<dt class='head--doc'><span id='p-text'></span>Parameter <code class='parameter'>text</code></dt>
-
<dd></dd><dd class='body--doc'><p>If supplied, substitutes keywords for that text instead, using values
-
that would apply for this revision. Otherwise, this revision
is
used
.
</p>
-
</dd>
-
<dt
class='head--doc'><span id='p-override_binary'></span>Parameter <code class='parameter'>override_binary</code></dt>
-
<dd></dd><dd class='body--doc'><p>Perform expansion even if the file was checked in as binary.</p>
-
</dd>
-
<dt class='head--doc'>Note</dt>
-
<dd class='body--doc'><p>
The
Log
keyword
(which lacks sane quoting rules)
is
not
-
expanded
.
Keyword expansion rules set in CVSROOT/cvswrappers
-
are ignored. Only implements the -kkv and -kb expansion modes.
</p>
-
</dd>
-
<dt class='head--doc'>See also</dt>
-
<dd class='body--doc'><p><code>get_contents</code></p>
+
<dd class='body--doc'><p>
An
initial
stack
size
can
be
given
when
+
a
stack
is
cloned
. The
default
value
is
+
32
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
get_contents
</b></span>
+
<span class='homogen--name'><b>
pop
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
string
</code> <b><span class='method'>
get_contents
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
mixed
</code> <b><span class='method'>
pop
</span>(</b><
code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>val</code><
b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
the
file
contents
from
this
revision
,
without performing
-
any
keyword
expansion
.
</p>
-
</dd>
-
<dt
class='head--doc'>See
also</dt>
-
<dd
class='body--doc'>
<
p><code>expand_keywords<
/
code></
p>
+
<dd class='body--doc'><p>
Pops
and
returns
entry
<code>val</code>
from
the
stack
,
counting
+
from
the
top
.
If no value is given the top element is
+
popped
and returned. All popped entries are freed from
+
the stack.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>lines</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>int</code> Parser.RCS.Revision.<b><span class='variable'>lines</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>the number of lines this revision contained, altogether (not of
-
particular interest for binary files)</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>log</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>string</code> Parser.RCS.Revision.<b><span class='variable'>log</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>the log message associated with the revision</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>next</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>string</code> Parser.RCS.Revision.<b><span class='variable'>next</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>the revision that succeeds this revision, or 0 if none exists</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>rcs_next</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>string</code> Parser.RCS.Revision.<b><span class='variable'>rcs_next</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>the revision stored next in the rcs file, or 0 if none exists</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>removed</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>int</code> Parser.RCS.Revision.<b><span class='variable'>removed</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>the number of lines that were removed from the previous revision
-
to make this revision</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>revision</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>string</code> Parser.RCS.Revision.<b><span class='variable'>revision</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>the revision number (i e <code>RCS</code>->revisions["1.1"]->revision == "1.1")</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>state</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>string</code> Parser.RCS.Revision.<b><span class='variable'>state</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>the state of the revision - typically "Exp" or "dead"</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>time</b></span>
-
</dt>
-
<dd><p><code><code class='object unresolved'>Calendar.ISO.Second</code> Parser.RCS.Revision.<b><span class='variable'>time</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>the (UTC) date and time when the revision was committed</p>
-
</dd></dl>
-
</dd></dl></dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.SGML</b></h2>
-
</dt><dd><dl class='group--doc'>
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>This is a handy simple parser of SGML-like
-
syntax like HTML. It doesn't do anything advanced,
-
but finding the corresponding end-tags.</p>
-
<p> It's used like this:
-
<code class='expr'>array res=Parser.SGML()->feed(string)->finish()->result();</code></p>
-
<p> The resulting structure is an array of atoms,
-
where the atom can be a string or a tag.
-
A tag contains a similar array, as data.</p>
-
</dd>
-
<dt class='head--doc'>Example</dt>
-
<dd class='example'><pre><p>A string
-
<tt>"<gat>&nbsp;<gurka>&nbsp;</gurka>&nbsp;<banan>&nbsp;<kiwi>&nbsp;</gat>"</tt>
-
results in
-
<pre>
-
({
-
tag "gat" object with data:
-
({
-
tag "gurka" object with data:
-
({
-
" "
-
})
-
tag "banan" object with data:
-
({
-
" "
-
tag "kiwi" object with data:
-
({
-
" "
-
})
-
})
-
})
-
})
-
</pre></p>
-
<p> ie, simple "tags" (not containers) are not detected,
-
but containers are ended implicitely by a surrounding
-
container _with_ an end tag.</p>
-
<p> The 'tag' is an object with the following variables:
-
<pre>
-
string name; - name of tag
-
mapping args; - argument to tag
-
int line,char,column; - position of tag
-
string file; - filename (see <ref>create</ref>)
-
array(SGMLatom) data; - contained data
-
</pre></p>
-
</pre></dd></dl>
-
-
<hr />
-
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
create
</b></span>
+
<span class='homogen--name'><b>
push
</b></span>
</dt>
-
<dd><p><code><
span
class='
object
'>
Parser.SGML
</
span
> <
span class='class'>Parser.SGML</span><
b>
(
<
/b><b>)</b></code><br>
-
<code><
span class='
object
'>
Parser.SGML
</span>
<span class='class'>Parser.SGML</span><b>
(</b><code class='datatype'>
string
</code> <code class='argument'>
filename
</code><b>)</b></code></p></dd>
+
<dd><p><code><
code
class='
datatype
'>
void
</
code
> <b><span class='
method
'>
push
</span>(</b><code class='datatype'>
mixed
</code> <code class='argument'>
val
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
This
object
is
created
with
this
filename.
-
It's passed to all created tags, for debug and trace purposes.</p>
-
</dd>
-
<dt class='head--doc'>Note</dt>
-
<dd class='body--doc'><p>No, it doesn't read
the
file itself
.
See
<
code>feed()<
/
code>.</
p>
+
<dd class='body--doc'><p>
Push
an
element
on
the
top
of
the
stack
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
feed
</b></span>
<br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>finish</b></span><br>
-
<span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>result</b></span><br>
+
<span class='homogen--name'><b>
quick_pop
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
object
</code> <b><span class='method'>
feed
</span>(</b><code class='datatype'>
string
</code>
<code class='argument'>s</code><b>)</b></code><br>
-
<code><code class='datatype'>array</code>(<code class='object unresolved'>SGMLatom</code>
|<code class='datatype'>
string
</code>
)
<
b><span class='method'>finish</span>(</b><b>)</b></
code
><br>
-
<code><code
class='
datatype'>array</code>(<code class='object unresolved'>SGMLatom</code>|<code class='datatype'>string</code>) <b><span class='method'>result</span>(</b><code class='datatype'>string</code> <code class='
argument'>
s
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
void
</code> <b><span class='method'>
quick_pop
</span>(</b><code class='datatype'>
void
</code>|<code class='datatype'>
int
</code> <code class='argument'>
val
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Feed
new
data
to
the
object
, or
finish
the stream.
-
No result can be used until <code>finish()</code>
is
called
.
</p>
-
<p>
Both
<code>finish()</code>
and
<code>result()</code>
return
the
computed
data.</p>
-
<p>
<code>feed()</code> returns the called object
.</p>
+
<dd class='body--doc'><p>
Pops
<code>val</code>
entries
from
the
stack
, or
one
entry
+
if
no
value
is
given
.
The
popped
entries
are
not
+
actually
freed,
only
the
stack
pointer
is
moved
.</p>
</dd></dl>
-
</dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Parser.LR</b></h2>
-
</dt><dd><dl><dt><h2 class='header'>Enum <b class='ms datatype'>Parser.LR.SeverityLevel</b></h2>
-
</dt><dd><dl class='group--doc'>
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Severity level</p>
-
</dd></dl>
+
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Constant</span>
-
<span class='homogen--name'><b>NOTICE</b></span><br>
-
<span class='homogen--type'>Constant</span>
-
<span class='homogen--name'><b>WARNING</b></span><br>
-
<span class='homogen--type'>Constant</span>
-
<span class='homogen--name'><b>ERROR</b></span><br>
-
</dt>
-
<dd><p><code><code class='datatype'>constant</code> Parser.LR.<code class='constant'>NOTICE</code></code><br>
-
<code><code class='datatype'>constant</code> Parser.LR.<code class='constant'>WARNING</code></code><br>
-
<code><code class='datatype'>constant</code> Parser.LR.<code class='constant'>ERROR</code></code></p></dd>
-
</dl>
-
</dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.LR.ErrorHandler</b></h2>
-
</dt><dd><dl class='group--doc'>
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Class handling reporting of errors and warnings.</p>
-
</dd></dl>
+
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
create
</b></span>
+
<span class='homogen--name'><b>
reset
</b></span>
</dt>
-
<dd><p><code><
span
class='
object
'>
Parser.LR.ErrorHandler
</
span
> <span class='
class
'>
Parser.LR.ErrorHandler
</span>
<b>
(</b><code class='datatype'>int
(-1..1)
</code>|<code class='datatype'>void</code> <code class='argument'>
verbosity
</code><b>)</b></code></p></dd>
+
<dd><p><code><
code
class='
datatype
'>
void
</
code
> <
b><
span class='
method
'>
reset
</span>(</b><code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>
initial_size
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Create
a
new
error
handler
.</p>
+
<dd class='body--doc'><p>
Empties
the
stack,
resets
the stack pointer
+
and shrinks the stack size to the given value
+
or 32 if none is given
.</p>
</dd>
-
<dt class='head--doc'><span id='p-verbosity'></span>Parameter <code class='parameter'>verbosity</code></dt>
-
<dd></dd><dd class='body--doc'><p>Level of verbosity.</p>
-
</dd>
+
<dt class='head--doc'>See also</dt>
-
<dd class='body--doc'><p><code>
verbose
</code></p>
+
<dd class='body--doc'><p><code>
create
</code></p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>verbose</b></span>
-
</dt>
-
<dd><p><code><code class='modifier'>optional</code> <code class='datatype'>int(-1..1)</code> Parser.LR.ErrorHandler.<b><span class='variable'>verbose</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Verbosity level</p>
-
<table class='box'><tr><td><code><code class='key'>-1</code></code></td><td><p>Just errors.</p>
-
</td></tr>
-
<tr><td><code><code class='key'>0</code></code></td><td><p>Errors and warnings.</p>
-
</td></tr>
-
<tr><td><code><code class='key'>1</code></code></td><td><p>Also notices.</p>
-
</td></tr>
-
</table>
-
</dd></dl>
-
</dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.LR.Parser</b></h2>
-
</dt><dd><dl class='group--doc'>
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>This object implements an LALR(1) parser and compiler.</p>
-
<p> Normal use of this object would be:</p>
-
<p> <pre>
-
set_error_handler
-
{add_rule, set_priority, set_associativity}*
-
set_symbol_to_string
-
compile
-
{parse}*
-
</pre></p>
-
</dd></dl>
-
-
<hr />
-
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>_
sprintf
</b></span>
+
<span class='homogen--name'><b>
set
_
stack
</b></span>
</dt>
-
<dd><p><code><
span
class='datatype'>
string
</
span
> <b><span class='method'>
sprintf
</span>(</b><
span
class='datatype'>
string
</
span
> <
span
class='
constant
'>
format
</
span
>
, ...
<
span class='class'>Parser.LR.Parser</span> <span class='constant'>arg</span> ... <
b>)</b></code></p></dd>
+
<dd><p><code><
code
class='datatype'>
void
</
code
> <b><span class='method'>
set_stack
</span>(</b><
code
class='datatype'>
array
</
code
> <
code
class='
argument
'>
stack
</
code
><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Pretty-prints
the
current
grammar
to
a
string
.</p>
+
<dd class='body--doc'><p>
Sets
the
stacks
content
to
the
provided array
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
add_rule
</b></span>
+
<span class='homogen--name'><b>
top
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
void
</code> <b><span class='method'>
add_rule
</span>(</b><
code class='object unresolved'>Rule</code> <code class='argument'>r</code><
b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
mixed
</code> <b><span class='method'>
top
</span>(</b><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Add
a
rule
to
the
grammar
.</p>
+
<dd class='body--doc'><p>
Returns
the
top
element
from
the
stack, without
+
popping it
.</p>
</dd>
-
<dt class='head--doc'><
span id='p-r'><
/
span>Parameter <code class='parameter'>r</code></
dt>
-
<dd
></dd><dd
class='body--doc'><p>
Rule
to
add
.</p>
+
<dt class='head--doc'>
Throws
</dt>
+
<dd class='body--doc'><p>
Throws
an
error if called on an empty stack
.</p>
</dd></dl>
-
+
</dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>ADT.Relation</b></h2>
+
</dt><dd><dl><dt><h2 class='header'>Class <b class='ms datatype'>ADT.Relation.Binary</b></h2>
+
</dt><dd>
-
+
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
cast
</b></span>
+
<span class='homogen--name'><b>
_sizeof
</b></span>
</dt>
-
<dd><p><code><
b>(</b><span
class='datatype'>
int
</
span
>
<b>)</b><span
class='class'>Parser.LR.Parser
<
/span>()<br><
b>
(
<
/b><
span class='
datatype
'>
float
</span>
<b>)</b><span class='class'>Parser.LR.Parser</span>
(
)
<
br><b>(<
/b>
<span
class='datatype'>string
<
/
span
><b>)</b><span
class='class'>
Parser
.
LR
.
Parser
</span>
()<br><b>(</b><span
class='datatype'>array
<
/
span
><b>)</b><span
class='
class
'>
Parser.LR.Parser
</span>
()<br><b>(</b><span
class='datatype'>mapping
<
/span><
b>)</b><
span class='class'>Parser.LR.Parser<
/
span>()<br><b>(</b><span class='datatype'>multiset</span><b>)</b><span class='class'>Parser.LR.Parser</span>()</
code></p></dd>
+
<dd><p><code><
code
class='datatype'>
mixed
</
code
> <b><span class='
method
'>
sizeof
</span>(</b> <span class='class'>
ADT
.
Relation
.
Binary
</span> <span class='
argument
'>
arg
</span> <b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Implements
casting
.
</p>
-
</dd>
-
<dt
class='head--doc'><span
id='p-type'></span>Parameter
<code
class='parameter'>type</code></dt>
-
<dd></dd><dd
class='body--doc'><p>Type
to
cast
to
.</p>
+
<dd class='body--doc'><p>
Returns
the number of relation entries in the relation
.
(Or with
+
other
words:
the
number
of
relations
in
the relation set
.
)
</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
compile
</b></span>
+
<span class='homogen--name'><b>
`&
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
int
</code> <
b><span
class='
method
'>
compile</span>
(</
b
><
b
>
)
</
b
></code></p></dd>
+
<dd><p><code><code class='datatype'>
mixed
</code>
res =
<
code
class='
class
'>
ADT.Relation.Binary
(
)
</
code
>
 & 
<
code class='class'
>
rel
</
code
></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Compiles
the
grammar
into
a
parser,
so
that
parse()
can
be
called
.</p>
+
<dd class='body--doc'><p>
The
expression
`rel1
&
rel2' returns
a
new
relation
which has
+
those and only those relation entries
that
are
present
in
both
+
rel1 and rel2
.</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
error_handler
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
`()
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
function
</code>
(<code
class='object
unresolved'>SeverityLevel</code>, <code class
=
'datatype'>string</code>,
<code class='
datatype'>string</code>, <code
class
=
'
datatype'
>
mixed</code>
..
. :
<
code class='datatype'>void<
/code>)
Parser.LR.Parser.
<
b><span class='variable'>error_handler<
/
span></b></
code></p></dd>
+
<dd><p><code><code class='datatype'>
mixed
</code>
res
= <code class='class'>
ADT
.
Relation
.
Binary()
</code>
(
)</code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Compile
error
and
warning
handler
.</p>
+
<dd class='body--doc'><p>
Does
the
same as the <code>contains</code> function: returns true if the
+
relation "<code>left</code> R <code>right</code>" exists,
and
otherwise
false
.</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
grammar
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
`-
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
mapping
</code>
(<code
class
=
'datatype'>int
<
/
code
>:<code
class='
datatype
'>
array
</code>
(
<code class='
object unresolved
'>
Rule
</code>
)) Parser.LR.Parser.
<
b><span class='variable'>grammar<
/
span></b></
code></p></dd>
+
<dd><p><code><code class='datatype'>
mixed
</code>
res
=
<code class='
class
'>
ADT.Relation.Binary()
</code>
 - 
<code class='
class
'>
rel
</code></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>The
grammar
itself
.</p>
+
<dd class='body--doc'><p>The
expression
`rel1 - rel2' returns a new relation which has
+
those and only those relation entries that are present in rel1
+
and not present in rel2
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
item_to_string
</b></span>
+
<span class='homogen--name'><b>
`|
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
string
</code>
<b><span
class
=
'method'>item_to_string
<
/span>(</b><
code class='
object unresolved
'>
Item
</code>
<code class='
argument
'>
i
</code><
b>)<
/
b></
code></p></dd>
+
<dd><p><code><code class='datatype'>
mixed
</code>
res
=
<code class='
class
'>
ADT.Relation.Binary()
</code>
 | 
<code class='
class
'>
rel
</code></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Pretty-prints
an
item
to
a
string.</p>
-
</dd>
-
<dt
class='head--doc'><span
id='p-i'></span>Parameter
<code
class='parameter'>i</code></dt>
-
<dd></dd><dd
class='body--doc'><p>Item
to
pretty-print
.</p>
+
<dd class='body--doc'><p>
The
expression
`rel1
|
rel2' returns
a
new relation which has
+
all
the
relation
entries
present
in
rel1, or rel2, or both
.</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>known_states</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='object unresolved'>Kernel</code>) Parser.LR.Parser.<b><span class='variable'>known_states</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>LR0 states that are already known to the compiler.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>lr_error</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>int</code> Parser.LR.Parser.<b><span class='variable'>lr_error</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Error code</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
parse
</b></span>
+
<span class='homogen--name'><b>
add
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>
parse
</span>(</b><code class='datatype'>
object</code>|<code class='datatype'>function</code>(<code class='datatype'>void</code>:<code class='datatype'>string</code>|<code class='datatype'>array</code>(<code class='datatype'>string</code>|<code class='datatype'>
mixed</code>
))
<code class='argument'>
scanner
</code>, <code class='datatype'>
void
</code>
|<code
class='datatype'>object
<
/
code
>
<code
class='argument'>
action_object
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>
add
</span>(</b><code class='datatype'>mixed</code> <code class='argument'>
left
</code>, <code class='datatype'>
mixed
</code> <code class='argument'>
right
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Parse
the input according to the compiled grammar.
-
The last value reduced is returned.
<
/p
>
-
</
dd
>
-
<dt
class='head--doc'>Note</dt>
-
<dd
class='body--doc'>
<
p>The parser must have been compiled (with compile())
-
prior to calling this function.</p>
-
</dd>
-
<dt class='head--doc'>Bugs</dt>
-
<dd class='body--doc'><p>Errors should be throw()n.</p>
-
</dd>
-
<dt class='head--doc'><span id='p-scanner'></span>Parameter <
code
class='parameter'
>
scanner
</code>
</dt>
-
<dd></dd><dd
class='body--doc'><p>The
scanner
function.
It
returns
the
next symbol from the input
.
-
It should either return a string (terminal) or an array with
-
a string (terminal) and a mixed (value).
-
EOF is indicated with
the
empty
string
.</p>
-
</dd>
-
<dt class='head--doc'><span id='p-action_object'></span>Parameter <code class='parameter'>action_object</code></dt>
-
<dd></dd><dd class='body--doc'><p>Object used to resolve those actions that have been specified as
-
strings.</p>
+
<dd class='body--doc'><p>
Adds
"
<
code
>
left
</
code
>
R
<code>
right
</code>
"
as
a
member
of
the
relation
.
Returns
+
the
same
relation
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
rule_to_string
</b></span>
+
<span class='homogen--name'><b>
contains
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
string
</code> <b><span class='method'>
rule_to_string
</span>(</b><code class='
object
unresolved
'>
Rule
</code> <code class='argument'>
r
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
mixed
</code> <b><span class='method'>
contains
</span>(</b><code class='
datatype'>mixed</code>
<code class=
'
argument'
>
left
</code>
,
<code class='
datatype'>mixed</code> <code class='
argument'>
right
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Pretty-prints
a
rule
to
a
string.
<
/p
>
-
</
dd
>
-
<dt
class='head--doc'><span
id='p-r'>
<
/span>Parameter <
code
class='parameter'
>
r
</code>
</dt>
-
<dd></dd><dd
class='body--doc'>
<
p>Rule to print.<
/p>
+
<dd class='body--doc'><p>
Return
true/false:
does
the
relation
"
<
code
>
left
</
code
>
R
<code>
right
</code>
"
exist?
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>s_q</b></span>
-
</dt>
-
<dd><p><code><code class='object unresolved'>StateQueue</code> Parser.LR.Parser.<b><span class='variable'>s_q</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Contains all states used.
-
In the queue section are the states that remain to be compiled.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
set_associativity
</b></span>
+
<span class='homogen--name'><b>
filter
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
void
</code> <b><span class='method'>
set_associativity
</span>(</b><code class='datatype'>
string
</code>
<code class='
argument'>terminal</code>,
<code class=
'
datatype'
>
int
</code> <code class='argument'>
assoc
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
object
</code> <b><span class='method'>
filter
</span>(</b><code class='datatype'>
function
</code>
(:
<code class='
datatype
void
'>
void
</code>
)
<code class='argument'>
f
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Sets
the
associativity
of
a
terminal.</p>
-
</dd>
-
<dt
class='head--doc'><span
id='p-terminal'></span>Parameter
<code
class='parameter'>terminal</code></dt>
-
<dd></dd><dd
class='body--doc'><p>Terminal
to
set
the
associativity
for.
<
/p
>
-
</
dd
>
-
<dt
class='head--doc'><span
id='p-assoc'></span>Parameter
<code
class='parameter'
>
assoc
</code>
</dt>
-
<dd></dd><dd
class='body--doc'><p>Associativity;
negative
-
left
,
positive
-
right
,
-
zero
-
no
associativity
.</p>
+
<dd class='body--doc'><p>
Filters
the
entries
in
the
relation,
and
returns
a
relation with
+
all
those
entries
for which
the
filtering
function
<
code
>
f
</
code
>
returned
+
true.
The
function
<code>
f
</code>
gets
two
arguments:
the
left
and
the
right
+
value
for
every
entry
in
the relation
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
set
_
error_handler
</b></span>
+
<span class='homogen--name'><b>
filter
_
destructively
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
void
</code> <b><span class='method'>
set
_
error_handler
</span>(</b><code class='datatype'>
void</code>|<code class='datatype'>
function</code>(<code class='
object unresolved'>SeverityLevel</code>, <code class='
datatype
'>string</code>,
<code class=
'
datatype'
>
string</code>, <code class='datatype'>mixed</code> ... :<code class='datatype'>
void</code>) <code class='argument'>
handler
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
object
</code> <b><span class='method'>
filter
_
destructively
</span>(</b><code class='datatype'>function</code>(
:
<code class='datatype
void
'>void</code>) <code class='argument'>
f
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Sets
the
error
report
function
.
<
/p
>
-
</
dd
>
-
<dt
class='head--doc'><span
id='p-handler'></span>Parameter
<code
class='parameter'
>
handler
</code>
</dt>
-
<dd></dd><dd
class='body--doc'><p>Function
to
call
to
report
errors
and
warnings.
-
If
zero
or
not
specifier, use
the
built-in function
.</p>
+
<dd class='body--doc'><p>
Filters
the
entries
in
the relation destructively, removing all
+
entries for which the filtering
function
<
code
>
f
</
code
>
returns false.
+
The
function
<code>
f
</code>
gets
two
arguments:
the
left
and
the
right
value
+
for
each
entry
in
the
relation
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
set
_
priority
</b></span>
+
<span class='homogen--name'><b>
get
_
id
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
void
</code> <b><span class='method'>
set
_
priority
</span>(</b><
code class='datatype'>string</code> <code class='argument'>terminal</code>, <code class='datatype'>int</code> <code class='argument'>pri_val</code><
b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
mixed
</code> <b><span class='method'>
get
_
id
</span>(</b><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Sets
the
priority
of
a
terminal.</p>
-
</dd>
-
<dt
class='head--doc'><span
id='p-terminal'></span>Parameter
<code
class='parameter'>terminal</code></dt>
-
<dd></dd><dd
class='body--doc'><p>Terminal
to
set the priority for
.</p>
-
</dd>
-
<dt class='head--doc'><span id='p-pri_val'></span>Parameter <code class='parameter'>pri_val</code></dt>
-
<dd></dd><dd class='body--doc'><p>Priority; higher = prefer this terminal.</p>
+
<dd class='body--doc'><p>
Return
the
ID
value
which
was
given
as
first
argument
to
create()
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
set_symbol_to_string
</b></span>
+
<span class='homogen--name'><b>
map
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
void
</code> <b><span class='method'>
set_symbol_to_string
</span>(</b><code class='datatype'>
void</code>|<code class='datatype'>
function</code>(<code class='datatype
'>int</code>|<code
class=
'
datatype'
>
string
</code>
:<code class='datatype'>string</code>
) <code class='argument'>
s_to_s
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
array
</code> <b><span class='method'>
map
</span>(</b><code class='datatype'>function</code>(
:
<code class='datatype
void
'>
void
</code>) <code class='argument'>
f
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Sets
the
symbol
to
string
conversion function
.
-
The
conversion
function
is
used
by
the
various
*_to_string
functions
-
to
make
comprehensible
output
.</p>
-
<
/dd
>
-
<dt
class='head--doc'><span
id='p-s_to_s'></span>Parameter
<code
class='parameter'>s_to_s</code></dt>
-
<dd></dd><dd
class='body--doc'><p>Symbol
to
string
conversion
function.
-
If
zero
or
not
specified
,
use
the
built-in
function
.</p>
+
<dd class='body--doc'><p>
Maps
every
entry
in
the
relation
. The function
f
gets
two
+
arguments:
the
left
and
the right relation value. Returns
+
an
array
with
the return values of f for each and every
+
mapped entry
.</p>
+
<
p
>
Note: since the entries in the relation are not ordered,
+
the
returned
array
will have its elements in no particular
+
order.
If you need
to
know
which
relation entry produced which
+
result
in
the
array
,
you
have to make that information part
+
of
the
value
that <code>f</code> returns
.</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>start_state</b></span>
-
</dt>
-
<dd><p><code><code class='object unresolved'>Kernel</code> Parser.LR.Parser.<b><span class='variable'>start_state</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>The initial LR0 state.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
state_to_string
</b></span>
+
<span class='homogen--name'><b>
remove
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
string
</code> <b><span class='method'>
state_to_string
</span>(</b><code class='
object
unresolved
'>
Kernel
</code> <code class='argument'>
state
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
mixed
</code> <b><span class='method'>
remove
</span>(</b><code class='
datatype'>mixed</code>
<code class=
'
argument'
>
left
</code>
,
<code class='
datatype'>mixed</code> <code class='
argument'>
right
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Pretty-prints
a state to a string.
<
/p
>
-
</
dd
>
-
<dt
class='head--doc'><span
id='p-state'>
<
/span>Parameter <
code
class='parameter'
>
state
</code>
</dt>
-
<dd></dd><dd
class='body--doc'><p>State
to
pretty-print
.</p>
+
<dd class='body--doc'><p>
Removes
"
<
code
>
left
</
code
>
R
<code>
right
</code>
" as a member of the relation. Returns
+
the
same
relation
.</p>
</dd></dl>
-
<dl><dt><h2 class='header'>Class <b class='ms datatype'>
Parser
.
LR
.
Parser
.
Item
</b></h2>
+
<dl><dt><h2 class='header'>Class <b class='ms datatype'>
ADT
.
Relation
.
Binary
.
_get_iterator
</b></h2>
</dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>An
LR(0)
item,
a
partially
parsed
rule
.</p>
-
</dd></dl>
-
-
<
hr
/>
-
<dl
class='group--doc'
>
-
<
dt class='head--type'><span class='homogen--type'>Variable<
/
span
>
-
<
span class='homogen--name'><b>counter<
/
b
></
span
>
-
</
dt
>
-
<
dd
><
p
><
code><code
class='
datatype
'>
int</code>
Parser.LR.Parser.Item.
<b
><span
class='
variable
'>
counter
</
span></
b></
code
></
p
><
/
dd>
-
+
<dd class='body--doc'><p>An
iterator
which
makes
all
the
left/right entities in the relation
+
available as index/value pairs
.</p>
+
</dd></dl></
dd
><
/
dl></
dd
></
dl
></
dd
></
dl
><
dl
><
dt
><
h2
class='
header
'>
Module
<b class='
ms datatype
'>
ADT.Table
</b></
h2
>
+
</
dt
><dd>
<dl class='group--doc'>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Depth
counter
(used
when
compiling)
.</p>
-
<
/dd
>
</dl>
-
-
-
<hr
/>
-
<dl
class='group--doc'>
-
<dt
class='head--type'><span
class='homogen--type'>Variable
</
span
>
-
<
span
class='homogen
-
-name'>
<
b>direct_lookahead<
/
b
></
span
>
-
</
dt
>
-
<
dd
><
p
><
code><code
class='
datatype
'>
multiset
<
/code>(<code
class='datatype'>
string</code>) Parser
.
LR
.
Parser.Item.
<
b><span class='variable'>direct_lookahead<
/
span></
b></
code
></
p
><
/
dd>
-
+
<dd class='body--doc'><p>
ADT.Table
is
a
generic
module for manipulating tables
.</p>
+
<
p
>
Each table contains one or several columns.
+
Each column is associated with a name, the column name.
+
Optionally, one can provide a column type. The Table module can do a number
+
of operations on a given table, like computing the sum of a column,
+
grouping, sorting etc.
</
p
>
+
<
p>
All column references are case insensitive. A column can be referred to by
+
its position (starting from zero). All operations are non
-
destructive.
That
+
means that a new table object will be returned after, for example, a sort.
</
p
>
+
</
dd
></
dl
><
dl
><
dt
><
h2
class='
header
'>
Class
<
b
class='
ms
datatype'>
ADT
.
Table
.
table
<
/
b></
h2
>
+
</
dt
><
dd
><
dl class='group--doc'
>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Look-ahead
set
for this item
.</p>
+
<dd class='body--doc'><p>
The
table
base-class
.</p>
</dd></dl>
-
+
<hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
error
_
lookahead
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>_
indices
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
multiset
</code>(<code class='datatype'>string</code>)
Parser
.
LR
.
Parser.Item.
<
b
><span class='
variable
'>
error_lookahead
</span></b></code></p></dd>
+
<dd><p><code><code class='datatype'>
array
</code>(<code class='datatype'>string</code>)
<b><span class='method'>indices</span>(</b> <span class='class'>ADT
.
Table
.
table
<
/span
>
<span class='
argument
'>
arg
</span>
<
b>)<
/b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Look-ahead
set
used
for
detecting
conflicts
</p>
+
<dd class='body--doc'><p>
This
method
returns
the column names
for
the
table. The case used when
+
the table was created will be returned.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
item
_
id
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>_
sizeof
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>int</code>
Parser
.
LR
.
Parser.Item.
<
b
><span class='
variable
'>
item_id
</span></b></code></p></dd>
+
<dd><p><code><code class='datatype'>int</code>
<b><span class='method'>sizeof</span>(</b> <span class='class'>ADT
.
Table
.
table
<
/span
>
<span class='
argument
'>
arg
</span>
<
b>)<
/b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Used
to
identify
the
item.
-
Equal
to
r->number
+
offset
.</p>
+
<dd class='body--doc'><p>
This
method
returns
the
number
of
rows
in
the
table
.</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
master
_
item
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>_
values
</b></span>
</dt>
-
<dd><p><code><code class='
object
unresolved
'>
Item
</code>
Parser
.
LR
.
Parser.Item.
<
b
><span class='
variable
'>
master_item
</span></b></code></p></dd>
+
<dd><p><code><code class='
datatype'>array</code>(<code
class=
'
datatype'
>
array
</code>
)
<b><span class='method'>values</span>(</b> <span class='class'>ADT
.
Table
.
table
<
/span
>
<span class='
argument
'>
arg
</span>
<
b>)<
/b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Item
representing
this
one
(used
for
shifts)
.</p>
+
<dd class='body--doc'><p>
This
method
returns
the
contents
of
a table as a two dimensional array
.
+
The format is an array of rows. Each row is an array of columns.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
next_state
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
`==
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
Kernel
</code>
Parser
.
LR
.
Parser.Item.
<
b
><
span
class='
variable
'>
next_state
</
span
></
b></
code></p></dd>
+
<dd><p><code><code class='
datatype
'>
int
</code>
res = <code class='class'>ADT
.
Table
.
table()
<
/code
>
 == 
<
code
class='
class
'>
table
</
code
></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
The
state
we
will
get
if
we
shift
according
to
this
rule
</p>
+
<dd class='body--doc'><p>
This
method
compares
two
tables.
They are equal
if
the
contents
+
of
the
tables
and the column names are equal. The column name
+
comparison is case insensitive.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
number
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
`[]
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
int
</code>
Parser
.
LR
.
Parser.Item.
<
b
><
span
class='
variable
'>
number
</
span
></
b></
code></p></dd>
+
<dd><p><code><code class='datatype'>
array
</code>
res = <code class='class'>ADT
.
Table
.
table()
<
/code
>
[ 
<
code
class='
class
'>
column
</
code
>
 ]
</code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Item
identification
number
(
used when compiling
).</p>
+
<dd class='body--doc'><p>
Same
as
<code>col
()
</code>
.</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
offset
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
append_bottom
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
int
</code>
Parser.LR.Parser.Item.
<b><span class='
variable
'>
offset
</span></b></code></p></dd>
+
<dd><p><code><code class='datatype'>
object
</code> <b><span class='
method
'>
append_bottom
</span>
(
</b><
code class='datatype'>object<
/code>
<
code class='argument'>table<
/
code><b>)</b></code></
p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
How
long
into
the
rule
the
parsing
has
come
.</p>
+
<dd class='body--doc'><p>
This
method
appends
two tables. The table given as an argument will be
+
added at
the
bottom
of
the
current
table.
Note, the column names must
+
be equal
.
The column name comparison is case insensitive.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
r
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
append_right
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
Rule
</code>
Parser.LR.Parser.Item.
<b><span class='
variable
'>
r
</span></b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
object
</code> <b><span class='
method
'>
append_right
</span>
(
</b><
code class='datatype'>object<
/code>
<
code class='argument'>table<
/
code><b>)</b></code></
p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>The
rule
</p>
+
<dd class='body--doc'><p>
This method appends two tables.
The
table given as an argument will be
+
added on the right side of the current table. Note that the number of
+
rows in both tables must be equal.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>relation</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>multiset</code>(<code class='object unresolved'>Item</code>) Parser.LR.Parser.Item.<b><span class='variable'>relation</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Relation to other items (used when compiling).</p>
-
</dd></dl>
-
</dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.LR.Parser.Kernel</b></h2>
-
</dt><dd><dl class='group--doc'>
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Implements an LR(1) state</p>
-
</dd></dl>
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>action</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>mapping</code>(<code class='datatype'>int</code>|<code class='datatype'>string</code>:<code class='object unresolved'>Kernel</code>|<code class='object unresolved'>Rule</code>) Parser.LR.Parser.Kernel.<b><span class='variable'>action</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>The action table for this state</p>
-
<p> <pre>
-
object(kernel) SHIFT to this state on this symbol.
-
object(rule) REDUCE according to this rule on this symbol.
-
</pre></p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
add_item
</b></span>
+
<span class='homogen--name'><b>
col
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
void
</code> <b><span class='method'>
add_item
</span>(</b><code class='
object
unresolved
'>
Item
</code> <code class='argument'>
i
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
array
</code> <b><span class='method'>
col
</span>(</b><code class='
datatype'>int</code>|<code
class=
'
datatype'
>
string
</code> <code class='argument'>
column
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Add
an
item
to
the
state
.</p>
+
<dd class='body--doc'><p>
This
method
returns
the
contents of a given column as an array
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
closure
</b></span>
+
<span class='homogen--name'><b>
create
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
void
</code> <
b
><
span
class='
method
'>
closure
</
span
>(</
b
><code class='datatype'>
int
</code> <code class='argument'>
nonterminal
</code><b>)</b></code></p></dd>
+
<dd><p><code><
span class='object'>ADT.Table.table</span> <span class='class'>ADT.Table.table</span><b>(</b><
code class='datatype'>
array
</code>
(<code
class='datatype'>array
<
/code
>
)
<
code
class='
argument
'>
table
</
code
>
, <code class='datatype'>array</code>
(<
code class='datatype'>string<
/
code
>
)
<code class='
argument'>column_names</code>, <code class='
datatype'>
array
</code>
(<code
class='datatype'>mapping
<
/
code
>(<code
class='
datatype'>string</code>:<code class='datatype'>string</code>))|<code class='datatype'>void</code> <code class='
argument'>
column_types
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Make
the
closure
of
this
state.
</p>
+
<dd class='body--doc'><p>
The
<code>ADT.Table.table</code>
class
takes
two
or three arguments:
</p>
</dd>
-
<dt class='head--doc'><span id='p-
nonterminal
'></span>Parameter <code class='parameter'>
nonterminal
</code></dt>
-
<dd></dd><dd class='body--doc'><p>
Nonterminal
to
make
the
closure
on.</p>
+
<dt class='head--doc'><span id='p-
table
'></span>Parameter <code class='parameter'>
table
</code></dt>
+
<dd></dd><dd class='body--doc'><p>
The
first argument is a two-dimensional array consisting of
+
one array of columns per row. All rows must have the same
+
number of columns as specified in <code>column_names</code>.</p>
+
</dd>
+
<dt class='head--doc'><span id='p-column_names'></span>Parameter <code class='parameter'>column_names</code></dt>
+
<dd></dd><dd class='body--doc'><p>This argument is an array of column names associated with each
+
column in the table. References by column name are case insensitive.
+
The case used in <code>column_names</code> will be used when the table is
+
displayed. A column can also be referred
to
by
its position,
+
starting from zero.</p>
+
</dd>
+
<dt class='head--doc'><span id='p-column_types'></span>Parameter <code class='parameter'>column_types</code></dt>
+
<dd></dd><dd class='body--doc'><p>This is an optional array of mappings. The column type
+
information is only used when displaying
the
table.
Currently, only the
+
keyword <tt>"type"</tt> is recognized. The type can be specified as
+
<tt>"text"</tt> or <tt>"num"</tt> (numerical). Text columns are left
+
adjusted, whereas numerical columns are right adjusted. If a mapping
+
in the array is 0 (zero), it will be assumed to be a text column.
+
If <code>column_types</code> is omitted, all columns will displayed as text.</p>
+
<p> See <code>ADT.Table.ASCII.encode()</code>
on
how to display a table
.</p>
+
</dd>
+
<dt class='head--doc'>See also</dt>
+
<dd class='body--doc'><p><code>ADT.Table.ASCII.encode()</code></p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
closure_set
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
decode
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
multiset
</code>
Parser.LR.Parser.Kernel.
<b><span class='
variable
'>
closure_set
</span></b></code></p></dd>
+
<dd><p><code><code class='datatype'>
object
</code> <b><span class='
method
'>
decode
</span>
(
</b><
code class='datatype'>string<
/code>
<
code class='argument'>s<
/
code><b>)</b></code></
p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
The
symbols
that
closure
has
been
called
on
.</p>
+
<dd class='body--doc'><p>
This
method
returns
a
table
object
from
a binary string
+
representation of a table, as returned by <code>encode()</code>
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
do_goto
</b></span>
+
<span class='homogen--name'><b>
distinct
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
Kernel
</code> <b><span class='method'>
do_goto
</span>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>
symbol
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
object
</code> <b><span class='method'>
distinct
</span>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code>
...
<code class='argument'>
columns
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Generates
the
state
reached
when
doing
goto
on
the
specified
symbol.
-
i
.
e.
it
compiles
the
LR(0)
state.</p>
-
</dd>
-
<dt
class='head--doc'><span
id='p-symbol'></span>Parameter
<code
class='parameter'>symbol</code></dt>
-
<dd></dd><dd
class='body--doc'><p>Symbol
to
make
goto
on
.</p>
+
<dd class='body--doc'><p>
This
method groups by
the
given
columns
and
returns
a
table
with
only
+
unique rows
.
When
no
columns
are
given,
all
rows
will
be unique. A new
+
table
object
will
be
returned
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
goto_set
</b></span>
+
<span class='homogen--name'><b>
encode
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
multiset</code>(<code class='datatype'>int</code>|<code class='datatype'>
string</code>
)
<b><span class='method'>
goto_set
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>string</code> <b><span class='method'>
encode
</span>(</b><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Make
the
goto-set
of
this
state
.</p>
+
<dd class='body--doc'><p>
This
method
returns
a binary string representation
of
the
table
.
It is
+
useful when one wants to store a the table, for example in a file.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
item_id_to_item
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
group
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>mapping</code>(<code class='datatype'>int</code>:<code class='
object
unresolved
'>
Item
</code>)
Parser
.
LR
.
Parser
.
Kernel.
<
b><span
class='
variable
'>
item_id_to_item
</
span
></b></code></p></dd>
+
<dd><p><code><code class='datatype'>
object</code> <b><span class='method'>group</span>(</b><code class='datatype'>
mapping</code>(<code class='datatype'>int</code>
|<code class='datatype'>string</code>
:<code class='
datatype'>function</code>(:<code
class=
'
datatype void'
>
void
</code>)
)|<code
class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code>, <code class='datatype'>mixed</code>
...
<
code
class='
argument
'>
args
</
code
><
b>)<
/b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Used
to
lookup
items
given
rule
and
offset
</p>
+
<dd class='body--doc'><p>
This
method
calls
the
function
<code>f</code>
for
each column each time a
+
non uniqe row will be joined. The table will be grouped by the
+
columns not listed. The result will be returned as a new table object.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
items
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
limit
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
array
</code>(<code class='
object unresolved
'>
Item
</code>
)
Parser.LR.Parser.Kernel.
<
b><span
class='
variable
'>
items
</
span
></b></code></p></dd>
+
<dd><p><code><code class='datatype'>
object
</code>
<b><span class='method'>limit</span>
(<
/b><
code class='
datatype
'>
int
</code> <
code
class='
argument
'>
n
</
code
><
b>)<
/b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Contains
the
items
in
this
state
.</p>
+
<dd class='body--doc'><p>
This
method truncates
the
table
to
the
first <code>n</code> rows and returns
+
a new object
.</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
rules
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
map
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
multiset
</code>(<code class='
object
unresolved
'>
Rule
</code>)
Parser
.
LR
.
Parser
.
Kernel.
<
b><span
class='
variable
'>
rules
</
span
></b></code></p></dd>
+
<dd><p><code><code class='datatype'>
object
</code>
<b><span class='method'>map</span>
(<
/b><
code class='
datatype'>function</code>(:<code
class=
'
datatype void'
>
void
</code>)
<code class='argument'>f</code>, <code class='datatype'>array</code>(<code class='datatype'>int</code>|<code class='datatype'>string</code>)|<code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>columns</code>, <code class='datatype'>mixed</code>
...
<
code
class='
argument
'>
args
</
code
><
b>)<
/b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Used
to
check
if
a
rule
already
has
been
added
when
doing
closures
.</p>
+
<dd class='body--doc'><p>
This
method calls the function <code>f</code> for all rows in the table.
+
The value returned will replace the values in the columns given
+
as argument
to
map.
If
the
function
returns
an
array,
several
+
columns
will
be replaced
.
Otherwise the first column will be
+
replaced. The result will be returned as a new table object.
</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
symbol_items
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
remove
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
mapping
</code>
(
<
code
class='
datatype
'>
int
</
code
>
:
<code class='datatype'>
multiset
</code>
(
<code class='
object unresolved
'>
Item
</code>
))
Parser
.
LR
.
Parser
.
Kernel.
<
b><span
class='
variable
'>
symbol_items
</
span
></b></code></p></dd>
+
<dd><p><code><code class='datatype'>
object
</code>
<
b><span
class='
method
'>
remove
</
span
>
(
<
/b><
code class='datatype'>
int
</code>
|
<code class='
datatype
'>
string
</code> ...
<
code
class='
argument
'>
columns
</
code
><
b>)<
/b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Contains
the
items
whose
next
symbol
is
this
non-terminal
.</p>
+
<dd class='body--doc'><p>
Like
<code>select()</code>, but
the
given
<code>columns</code>
will
not
be
in
the
+
resulting table
.</p>
</dd></dl>
-
</dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.LR.Parser.StateQueue</b></h2>
-
</dt><dd><dl class='group--doc'>
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>This is a queue, which keeps the elements even after they are retrieved.</p>
-
</dd></dl>
+
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>arr</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>array</code>(<code class='object unresolved'>Kernel</code>) Parser.LR.Parser.StateQueue.<b><span class='variable'>arr</span></b></code></p></dd>
+
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>The queue itself.</p>
-
</dd></dl>
-
-
+
<hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
head
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
rename
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
int
</code>
Parser.LR.Parser.StateQueue.
<b><span class='
variable
'>
head
</span></b></code></p></dd>
+
<dd><p><code><code class='datatype'>
object
</code> <b><span class='
method
'>
rename
</span>
(
</b><
code class='datatype'>string<
/code>
|
<
code class='datatype'>int<
/
code> <code class='argument'>from</code>, <code class='datatype'>string</code> <code class='argument'>to</code><b>)</b></code></
p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Index
of
the
head
of
the
queue
.</p>
+
<dd class='body--doc'><p>
This
method
renames
the
column
named
<code>from</code> to <code>to</code> and
+
returns a new table object. Note that <code>from</code> can be
the
column
+
position
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
next
</b></span>
+
<span class='homogen--name'><b>
reverse
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
Kernel
</code> <b><span class='method'>
next
</span>(</b><b>)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
object
</code> <b><span class='method'>
reverse
</span>(</b><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Return
the
next
state
from
the
queue
.</p>
+
<dd class='body--doc'><p>
This
method reverses
the
rows
of
the
table and returns a
+
new table object
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
push
</b></span>
+
<span class='homogen--name'><b>
row
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
Kernel
</code> <b><span class='method'>
push
</span>(</b><code class='
object unresolved
'>
Kernel
</code> <code class='argument'>
state
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
array
</code> <b><span class='method'>
row
</span>(</b><code class='
datatype
'>
int
</code> <code class='argument'>
row_number
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Pushes
the
state
on
the
queue.</p>
-
</dd>
-
<dt
class='head--doc'><span
id='p-state'></span>Parameter
<code
class='parameter'>state</code></dt>
-
<dd></dd><dd
class='body--doc'><p>State
to
push
.</p>
+
<dd class='body--doc'><p>
This
method
returns
the
contents
of
a
given
row
as
an
array
.</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>
Variable
</span>
-
<span class='homogen--name'><b>
tail
</b></span>
+
<dt class='head--type'><span class='homogen--type'>
Method
</span>
+
<span class='homogen--name'><b>
rsort
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
int
</code>
Parser.LR.Parser.StateQueue.
<b><span class='
variable
'>
tail
</span></b></code></p></dd>
+
<dd><p><code><code class='datatype'>
object
</code> <b><span class='
method
'>
rsort
</span>
(
</b><
code class='datatype'>int<
/code>
|
<
code class='datatype'>string<
/
code> ... <code class='argument'>columns</code><b>)</b></code></
p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Index
of
the
tail
of
the queue
.</p>
+
<dd class='body--doc'><p>
Like
<code>sort()</code>,
but
in
descending
order
.</p>
</dd></dl>
-
</dd></dl></dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.LR.Priority</b></h2>
-
</dt><dd><dl class='group--doc'>
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Specifies the priority and associativity of a rule.</p>
-
</dd></dl>
+
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>assoc</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>int</code> Parser.LR.Priority.<b><span class='variable'>assoc</span></b></code></p></dd>
+
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Associativity</p>
-
<table class='box'><tr><td><code><code class='key'>-1</code></code></td><td><p>Left</p>
-
</td></tr>
-
<tr><td><code><code class='key'>0</code></code></td><td><p>None</p>
-
</td></tr>
-
<tr><td><code><code class='key'>1</code></code></td><td><p>Right</p>
-
</td></tr>
-
</table>
-
</dd></dl>
-
-
+
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
create
</b></span>
+
<span class='homogen--name'><b>
select
</b></span>
</dt>
-
<dd><p><code><
span
class='
object
'>
Parser.LR.Priority
</
span
> <span class='
class
'>
Parser.LR.Priority
</span>
<b>
(</b><code class='datatype'>int</code>
<code class='
argument
'>
p
</code>
,
<code
class='datatype'>int</code>
<code class='argument'>
a
</code><b>)</b></code></p></dd>
+
<dd><p><code><
code
class='
datatype
'>
object
</
code
> <
b><
span class='
method
'>
select
</span>(</b><code class='datatype'>int</code>
|
<code class='
datatype
'>
string
</code>
...
<code class='argument'>
columns
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Create
a new
priority
object
.</p>
-
</dd>
-
<dt
class='head--doc'><span
id='p-p'></span>Parameter
<code
class='parameter'>p</code></dt>
-
<dd></dd><dd
class='body--doc'><p>Priority
.</p>
-
</dd>
-
<dt class='head--doc'><span id='p-a'></span>Parameter <code class='parameter'>a</code></dt>
-
<dd></dd><dd class='body--doc'><p>Associativity.</p>
+
<dd class='body--doc'><p>
This
method returns
a new
table
object
with
the
selected
columns
only
.</p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>value</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>int</code> Parser.LR.Priority.<b><span class='variable'>value</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Priority value</p>
-
</dd></dl>
-
</dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.LR.Rule</b></h2>
-
</dt><dd><dl class='group--doc'>
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>This object is used to represent a BNF-rule in the LR parser.</p>
-
</dd></dl>
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>action</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>function</code>(:<code class='datatype void'>void</code>)|<code class='datatype'>string</code> Parser.LR.Rule.<b><span class='variable'>action</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Action to do when reducing this rule.
-
function - call this function.
-
string - call this function by name in the object given to the parser.
-
The function is called with arguments corresponding to the values of
-
the elements of the rule. The return value of the function will be
-
the value of this non-terminal. The default rule is to return the first
-
argument.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
create
</b></span>
+
<span class='homogen--name'><b>
sort
</b></span>
</dt>
-
<dd><p><code><
span class='object'>Parser.LR.Rule</span> <span class='class'>Parser.LR.Rule</span><b>(</b><
code class='datatype'>
int
</code> <
code class='argument'
>
nt
<
/code>,
<code
class='
datatype
'>
array
</
code
>(<
code class='datatype'>string<
/
code
>
|
<code class='datatype'>int</code>
) <code class='argument'>r</code>, <code class='datatype'>function</code>(:<code class='datatype void'>void</code>)
|<code class='datatype'>string</code>
|<code
class='datatype'>void</code>
<code class='argument'>
a
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
object
</code> <
b
><
span
class='
method
'>
sort
</
span
>(</
b
><code class='datatype'>int</code>|<code class='datatype'>string</code>
...
<code class='argument'>
columns
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Create
a
BNF
rule
.</p>
+
<dd class='body--doc'><p>
This
method sorts the table in ascendent order on one or several columns
+
and returns
a
new
table object
.
The left most column is sorted last. Note
+
that the sort is stable.
</p>
</dd>
-
<dt class='head--doc'>
Example</dt>
-
<dd
class='example'>
<
pre><p>The rule<
/
p>
-
<p> rule : nonterminal ":" symbols ";" { add_rule };</p>
-
<p> might be created as</p>
-
<p> rule(4, ({ 9, ":", 5, ";" }), "add_rule");</p>
-
<p> where 4 corresponds to the nonterminal "rule", 9 to "nonterminal"
-
and 5 to "symbols", and the function "add_rule" is too be called
-
when this rule is reduced.</p>
-
</pre></dd>
-
<
dt
class='head--doc'
>
<span id='p-nt'></span>Parameter <code class='parameter'>nt</code></dt>
-
<dd
></dd><dd
class='body--doc'><p>
Non-terminal to reduce to.
<
/p>
-
</dd>
-
<dt class='head--doc'><span id='p-r'></span>Parameter <
code
class='parameter'
>
r
</code></
dt>
-
<dd></dd><dd class='body--doc'><
p>
Symbol sequence that reduces to nt.</p>
-
</dd>
-
<dt class='head--doc'><span id='p-a'></span>Parameter <code class='parameter'>a</code></dt>
-
<dd></dd><dd class='body--doc'><p>Action to do when reducing according to this rule.
-
function - Call this function.
-
string - Call this function by name in the object given to the parser.
-
The function is called with arguments corresponding to the values of
-
the elements of the rule. The return value of the function will become
-
the value of this non-terminal. The default rule is to return the first
-
argument.</p>
+
<dt class='head--doc'>
See
also
</dt>
+
<dd class='body--doc'><p><code>
rsort()
</code></p>
</dd></dl> <hr /> <dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>has_tokens</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>int</code> Parser.LR.Rule.<b><span class='variable'>has_tokens</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>This rule contains tokens</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>nonterminal</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>int</code> Parser.LR.Rule.<b><span class='variable'>nonterminal</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Non-terminal this rule reduces to.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>num_nonnullables</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>int</code> Parser.LR.Rule.<b><span class='variable'>num_nonnullables</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>This rule has this many non-nullable symbols at the moment.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>number</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>int</code> Parser.LR.Rule.<b><span class='variable'>number</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Sequence number of this rule (used for conflict resolving)
-
Also used to identify the rule.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>pri</b></span>
-
</dt>
-
<dd><p><code><code class='object unresolved'>Priority</code> Parser.LR.Rule.<b><span class='variable'>pri</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Priority and associativity of this rule.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>symbols</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>array</code>(<code class='datatype'>string</code>|<code class='datatype'>int</code>) Parser.LR.Rule.<b><span class='variable'>symbols</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>The actual rule</p>
-
</dd></dl>
-
</dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Parser.LR.GrammarParser</b></h2>
-
</dt><dd><dl class='group--doc'>
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>This module generates an LR parser from a grammar specified according
-
to the following grammar:</p>
-
<p> <pre>
-
directives : directive ;
-
directives : directives directive ;
-
directive : declaration ;
-
directive : rule ;
-
declaration : "%token" terminals ";" ;
-
rule : nonterminal ":" symbols ";" ;
-
rule : nonterminal ":" symbols action ";" ;
-
symbols : symbol ;
-
symbols : symbols symbol ;
-
terminals : terminal ;
-
terminals : terminals terminal ;
-
symbol : nonterminal ;
-
symbol : "string" ;
-
action : "{" "identifier" "}" ;
-
nonterminal : "identifier" ;
-
terminal : "string";
-
</pre></p>
-
</dd></dl>
-
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Variable</span>
-
<span class='homogen--name'><b>lr_error</b></span>
-
</dt>
-
<dd><p><code><code class='datatype'>int</code> Parser.LR.GrammarParser.<b><span class='variable'>lr_error</span></b></code></p></dd>
-
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>Error code from the parsing.</p>
-
</dd></dl>
-
-
-
<hr />
-
<dl class='group--doc'>
+
<dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
make_parser
</b></span>
+
<span class='homogen--name'><b>
sum
</b></span>
</dt>
-
<dd><p><code><code class='
object unresolved
'>
Parser
</code> <b><span class='method'>
make_parser
</span>(</b><code class='datatype'>
string
</code>
<code class='
argument
'>
str
</code>
,
<code
class='datatype'>object</code>|<code
class='datatype'>void
<
/
code
>
<code
class='argument'>
m
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='
datatype
'>
object
</code> <b><span class='method'>
sum
</span>(</b><code class='datatype'>
int
</code>
|
<code class='
datatype
'>
string
</code>
...
<code class='argument'>
columns
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Compiles
the
parser-specification
given
in
the first argument
.
-
Named
actions
are
taken
from
the
object
if
available,
otherwise
-
left
as
is.</p>
-
</dd>
-
<dt
class='head--doc'>Bugs</dt>
-
<dd
class='body--doc'><p>Returns
error-code
in
both
GrammarParser
.
error and
-
return_value->lr_error.
</p>
+
<dd class='body--doc'><p>
This
method
sums
all
equal
rows.
The
table
will
be
grouped
by
the
+
columns
not
listed.
The
result
will
be
returned
as
a
new
table
object
.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
make_parser_from_file
</b></span>
+
<span class='homogen--name'><b>
type
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
int
</code>
|
<
code
class='
object unresolved
'>
Parser
</
code
>
<b><
span
class='
method
'>
make_parser_from_file
</
span
>
(
<
/b><
code class='datatype'>string</code> <code class='argument'>
fname
</code>, <code class='datatype'>
object
</code>|<code class='datatype'>
void
</code> <code class='argument'>
m
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
mapping
</code>
<
b><span
class='
method
'>
type
</
span
>
(
<
/
b><
code
class='
datatype
'>
int
</
code
>
|
<code class='datatype'>string</code> <code class='argument'>
column
</code>, <code class='datatype'>
void
</code>|<code class='datatype'>
mapping
</code> <code class='argument'>
type
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Compiles
the
file
specified in
the
first
argument
into
an
LR parser
.</p>
-
<
/dd
>
-
<dt
class='head--doc'>See
also
</
dt
>
-
<dd
class='body--doc'>
<
p><
code>
make_parser
</code></p>
+
<dd class='body--doc'><p>
This
method
gives
the
type
for
the
given
<code>column</code>
.</p>
+
<
p
>
If a second argument is given, the old type will be replaced
+
with
<
code>type<
/
code
>
. The column type is only used when the table is displayed.
+
The format is as specified in
<code>
create()
</code>
.
</p>
</dd></dl>
-
</dd></dl></dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Parser.Pike</b></h2>
-
</dt><dd><dl class='group--doc'>
-
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>This module parses and tokanizes Pike source code.</p>
-
</dd></dl>
+
-
<hr />
-
<dl class='group--doc'>
-
<dt class='head--type'><span class='homogen--type'>Inherit</span>
-
<span class='homogen--name'><b>"C.pmod"</b></span>
-
</dt>
-
<dd><p><code><span class='datatype'>inherit "C.pmod"</span> : <span class='inherit'>"C.pmod"</span></code></p></dd>
-
</dl>
+
-
+
<hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
split
</b></span>
+
<span class='homogen--name'><b>
where
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
array
</code>(<code class='datatype'>
string
</code>
)
<
b
><
span
class='
method
'>
split
</
span
>
(
</
b
><code class='datatype'>string</code> <code class='argument'>
data
</code>, <code class='datatype'>void</code>
|
<code class='datatype'>
mapping
</code> <code class='argument'>
state
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
object
</code>
<b><span class='method'>where</span>
(<
/b><
code class='datatype'>
array
</code>
(<code
class='datatype'>int
<
/code
>
|
<
code
class='
datatype
'>
string
</
code
>
)|
<
code class='datatype'>int<
/
code
>
|
<code class='datatype'>string</code> <code class='argument'>
columns
</code>, <code class='datatype'>
function</code>(:<code class='datatype
void
'>void
</code>
)
<code class='
argument'>f</code>, <code class='
datatype'>
mixed
</code>
...
<code class='argument'>
args
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Splits
the
<code>data</code>
string
into
an
array
of tokens
.
An
additional
-
element
with
a
newline
will be
added
to the resulting array of
-
tokens
. If the
optional
argument
<code>state</code>
is
provided
the
split
-
function
is
able to pause and resume splitting inside #"" and
-
/**/ tokens
. The
<code>state</code> argument should be an initially empty
-
mapping, in which split
will
store
its
state
between
successive
-
calls
.</p>
+
<dd class='body--doc'><p>
This
method
calls
the
function
for
each
row
.
If
the function
+
returns
zero,
the
row
will be
thrown
away
. If the
function
+
returns
something
non-zero,
the
row
will
be
kept
. The
result
+
will
be
returned
as
a
new
table
object
.</p>
</dd></dl>
-
</dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>
Parser
.
Python
</b></h2>
+
</dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>
ADT
.
Table.ASCII
</b></h2>
</dt><dd> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
-
<span class='homogen--name'><b>
split
</b></span>
+
<span class='homogen--name'><b>
encode
</b></span>
</dt>
-
<dd><p><code><code class='datatype'>
array
</code>(<code class='datatype'>
string
</code>
)
<
b><span
class='
method
'>
split
</
span
>
(
</
b
><code class='datatype'>
string
</code> <code class='argument'>
data
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>
string
</code>
<b><span class='method'>encode</span>
(<
/b><
code class='datatype'>
object
</code> <
code
class='
argument
'>
table
</
code
>
,
<
code class='datatype'>void<
/
code
>
|
<code class='datatype'>
mapping
</code> <code class='argument'>
options
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt>
-
<dd class='body--doc'><p>
Returns
the
provided
string
with
Python
code
as
-
an
array
with
tokens
.</p>
+
<dd class='body--doc'><p>
This
method
returns
a
table
represented
in
ASCII suitable for human eyes.
+
<code>options</code> is
an
optional
mapping. If the keyword <tt>"indent"</tt> is used
+
with
a number, the table will be indented with that number of space
+
characters
.</p>
</dd></dl>
-
</dd></dl></dd></dl></dd></dl></body></html>
+
</dd></dl></dd></dl></dd></dl></
dd></dl></
body></html>