9699552002-03-12Martin Nilsson <!doctype html><html><head><title>Pike Reference Manual</title> <meta charset='utf-8'></head>
1f918f2002-05-26Martin Nilsson <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> </dt><dd>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>allow_rxml_entities</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>autoconvert</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>define_entity</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>define_entity_raw</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>parse_dtd</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>Simple</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><span class='datatype'>inherit Parser.XML.Simple</span> : <span class='inherit'>Simple</span></code></p></dd> </dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>parse</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>parse_dtd</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson </dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Parser.XML.NSTree</b></h2> </dt><dd><dl class='group--doc'>
e4e3f32002-04-06Martin Nilsson <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>Tree</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><span class='datatype'>inherit Parser.XML.Tree</span> : <span class='inherit'>Tree</span></code></p></dd> </dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>parse_input</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Takes a XML string <code>data</code> and produces a namespace node tree.</p>
e4e3f32002-04-06Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>visualize</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>&gt; object x = parse_input("&lt;a&gt;&lt;b&gt;&lt;c/&gt;d&lt;/b&gt;&lt;b&gt;&lt;e/&gt;&lt;f&gt;g&lt;/f&gt;&lt;/b&gt;&lt;/a&gt;"); &gt; 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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>diff_namespaces</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns the difference between this nodes and its parents namespaces.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_default_ns</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>get_default_ns</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns the default namespace in the current scope.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_defined_nss</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns a mapping with all the namespaces defined in the current scope, except the default namespace.</p>
e4e3f32002-04-06Martin Nilsson </dd> <dt class='head--doc'>Note</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_ns</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>get_ns</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns the namespace in which the current element is defined in.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_ns_attributes</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns all the attributes in all namespaces that is associated with this node.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_ns_attributes</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns the attributes in this node that is declared in the provided namespace.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_xml_name</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>get_xml_name</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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></dl>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>remove_child</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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></dl> </dd></dl></dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Parser.XML.Tree</b></h2> </dt><dd>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>XML_ATTR</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Attribute nodes are created on demand</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>XML_COMMENT</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>XML_ELEMENT</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>XML_HEADER</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>XML_PI</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>XML_ROOT</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson  <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>parse_file</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Loads the XML file <code>path</code>, creates a node tree representation and returns the root node.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>parse_input</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Takes a XML string and produces a node tree.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>parse_xml_callback</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>`[]</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='object unresolved'>AbstractNode</code> res = <code class='class'>Parser.XML.Tree.AbstractNode()</code>[&#32;<code class='class'>pos</code>&#32;]</code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>add_child</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd> <dt class='head--doc'>Returns</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>The updated child node is returned.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>clone</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns the corresponding node in a clone of the tree.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>count_children</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>count_children</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns the number of children of the node.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_ancestors</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_children</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns all the nodes children.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_descendants</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_following</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns all the nodes that follows after the current one.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_following_siblings</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns all following siblings, i.e. all siblings present after this node in the parents children list.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_last_child</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='object unresolved'>AbstractNode</code> <b><span class='method'>get_last_child</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns the last childe node or zero.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_parent</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='object unresolved'>AbstractNode</code> <b><span class='method'>get_parent</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns the parent node.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_preceding</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns all preceding nodes, excluding this nodes ancestors.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_preceding_siblings</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns all preceding siblings, i.e. all siblings present before this node in the parents children list.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_root</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='object unresolved'>AbstractNode</code> <b><span class='method'>get_root</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Follows all parent pointers and returns the root node.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_siblings</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns all siblings, including this node.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>iterate_children</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>remove_child</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>remove_node</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>remove_node</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Removes this node from its parent. The parent reference is set to null.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>replace_child</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd> <dt class='head--doc'>Returns</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns the new child node.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>replace_children</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Replaces the nodes children with the provided ones. All parent references are updated.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>replace_node</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Replaces this node with the provided one.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Returns the new node.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>set_parent</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Sets the parent node to <code>parent</code>.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>walk_inorder</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>walk_postorder</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>walk_preorder</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>walk_preorder_2</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson </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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>cast</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>clone</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>create</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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> </dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_any_name</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>get_any_name</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Return name of tag or name of attribute node.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_attr_name</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>get_attr_name</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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_attribute_nodes</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_attributes</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>mapping</code> <b><span class='method'>get_attributes</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns this nodes attributes, which can be altered destructivly to alter the nodes attributes.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_doc_order</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>get_doc_order</span>(</b><b>)</b></code></p></dd> </dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_elements</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_first_element</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_node_type</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>get_node_type</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns the node type. See defined node type constants.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_tag_name</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>get_tag_name</span>(</b><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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_text</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>get_text</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns text content in node.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson  <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>render_xml</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>render_xml</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Creates an XML representation of the nodes sub tree.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>set_doc_order</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> <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>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>value_of_node</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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></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'>
e4e3f32002-04-06Martin Nilsson <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <p>
1f918f2002-05-26Martin Nilsson The object is easily reused, by calling the <code>clone</code>() function.
e4e3f32002-04-06Martin Nilsson </p> </dd>
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>See also</dt>
e4e3f32002-04-06Martin Nilsson <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <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> </dt> <dd><p><code><code class='object unresolved'>mapping </code> <b><span class='method'>_inspect</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt>
e4e3f32002-04-06Martin Nilsson <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <p> The format and contents of this mapping may change without further notice.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <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.
e4e3f32002-04-06Martin Nilsson </p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'> <p>the called object</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <p><tt>to_do</tt> can be:</p>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </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'>
1f918f2002-05-26Martin Nilsson <p><code>tags</code>, <code>containers</code>, <code>entities</code></p></dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p> Returns the current position. Characters and columns count from 0, lines count from 1.</p>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <p> <code>at</code>() gives an array consisting of ({<i>line</i>,<i>char</i>,<i>column</i>}), in that order.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <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 '&lt;' and '&gt;' 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 '&gt;' 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 '&amp;', '&lt;', '&gt;', '"', ''', 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 '/&gt;' 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 '/&gt;') 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>
e4e3f32002-04-06Martin Nilsson </p> </dd>
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Note</dt>
e4e3f32002-04-06Martin Nilsson <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p>Removes all registered definitions in the different categories.
e4e3f32002-04-06Martin Nilsson </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'>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>clone</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p>the new object.</p>
e4e3f32002-04-06Martin Nilsson </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p>create is called _before_ the setup is copied.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson <span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>quote_tags</b></span><br>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p> Returns the current callback settings. For quote_tags, the values are arrays ({callback, end_quote}).</p>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <p> Note that when matching is done case insensitively, all names will be returned in lowercase.</p>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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.
e4e3f32002-04-06Martin Nilsson </p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>context</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='object unresolved'>string </code> <b><span class='method'>context</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p> Returns the current output context as a string:</p>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <p> This function is typically only useful in entity callbacks, which can be called both from text and argument values of different sorts.
e4e3f32002-04-06Martin Nilsson </p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p><code>splice_arg</code></p></dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>current</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='object unresolved'>string </code> <b><span class='method'>current</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>feed</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <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>-&gt;feed(s,0);</tt>, the string is feeded, but the parser isn't run. </p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'> <p>the called object</p>
e4e3f32002-04-06Martin Nilsson </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p><code>finish</code>, <code>read</code>, <code>feed_insert</code></p></dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>feed_insert</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p>This pushes a string on the parser stack. (I'll write more about this mechanism later.)
e4e3f32002-04-06Martin Nilsson </p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p>the called object</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>finish</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p>Finish a parser pass. A string may be sent here, similar to feed().
e4e3f32002-04-06Martin Nilsson </p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p>the called object</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_extra</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='object unresolved'>array </code> <b><span class='method'>get_extra</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p>Gets the extra arguments set by <code>set_extra</code>().
e4e3f32002-04-06Martin Nilsson </p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p>the called object</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>parse_tag_args</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p>a mapping containing the tag arguments</p>
e4e3f32002-04-06Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>See also</dt>
e4e3f32002-04-06Martin Nilsson <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p><code>tag_args</code></p></dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>parse_tag_name</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p>the tag name or an empty string if none</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>read</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p>Read parsed data from the parser object.</p> <p><code>mixed_mode</code>, an array of arbitrary data otherwise.</p>
e4e3f32002-04-06Martin Nilsson </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p>a string of parsed data if the parser isn't in</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>set_extra</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p>Sets the extra arguments passed to all tag, container and entity callbacks.
e4e3f32002-04-06Martin Nilsson </p>
1f918f2002-05-26Martin Nilsson </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'> <p>the called object</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>splice_arg</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <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> &lt;foo arg1="val 1" splice="arg2='val 2' arg3" arg4&gt; </pre> becomes <pre> &lt;foo arg1="val 1" arg2='val 2' arg3 arg4&gt; </pre> if "splice" is set as the splice argument name.</p>
e4e3f32002-04-06Martin Nilsson </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p>the old splice argument name.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>tag</b></span><br>
e4e3f32002-04-06Martin Nilsson <span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>tag_name</b></span><br>
e4e3f32002-04-06Martin Nilsson <span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson <p>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>write_out</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <p> Any data is allowed when the parser is running in <code>mixed_mode</code>. Only strings are allowed otherwise.
e4e3f32002-04-06Martin Nilsson </p> </dd>
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Returns</dt>
e4e3f32002-04-06Martin Nilsson <dd class='body--doc'>
1f918f2002-05-26Martin Nilsson <p>the called object</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson </dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Parser</b></h2>
e4e3f32002-04-06Martin Nilsson </dt><dd> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>.</b></span> </dt> <dd><p><code> <b><span class='method'>.</span>(</b><b>)</b></code></p></dd> </dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>decode_numeric_xml_entity</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Decodes the numeric XML entity <code>chref</code>, e.g. <tt>"&amp;#x34;"</tt> and returns the character as a string. <code>chref</code> is the name part of the entity, i.e. without the leading '&amp;' 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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_xml_parser</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='object unresolved'>Parser.HTML</code> <b><span class='method'>get_xml_parser</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>html_entity_parser</b></span><br>
e4e3f32002-04-06Martin Nilsson <span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>parse_html_entities</b></span><br>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson <dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.RCS</b></h2>
e4e3f32002-04-06Martin Nilsson </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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></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> <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>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>The usernames listed in the ACCESS section of the RCS file</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>branch</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>The default branch (or revision), if present, <code class='expr'>0</code> otherwise</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>comment</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>The RCS file comment if present, <code class='expr'>0</code> otherwise</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>create</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>description</b></span> </dt> <dd><p><code><code class='datatype'>string</code> Parser.RCS.<b><span class='variable'>description</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>The RCS file description</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>expand</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> Parser.RCS.<b><span class='variable'>expand</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>The keyword expansion options (as named by RCS) if present, <code class='expr'>0</code> otherwise</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>head</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> Parser.RCS.<b><span class='variable'>head</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Version number of the head version of the file</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>locks</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Maps from username to revision for users that have acquired locks on this file</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>parse</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>parse_admin_section</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>parse_delta_sections</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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-&gt;revision</code>, <code>Revision-&gt;branch</code>, <code>Revision-&gt;time</code>, <code>Revision-&gt;author</code>, <code>Revision-&gt;state</code>, <code>Revision-&gt;branches</code>, <code>Revision-&gt;rcs_next</code>, <code>Revision-&gt;ancestor</code> and <code>Revision-&gt;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>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>parse_deltatext_sections</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Variable</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>revisions</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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> <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>strict_locks</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>bool</code> Parser.RCS.<b><span class='variable'>strict_locks</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>1 if strict locking is set, 0 otherwise</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>tags</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Maps tag names (indices) to tagged revision numbers (values)</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>trunk</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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.Revision</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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>added</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> Parser.RCS.Revision.<b><span class='variable'>added</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>ancestor</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> Parser.RCS.Revision.<b><span class='variable'>ancestor</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>the revision of the ancestor of this revision, or 0 if this was the initial revision</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>author</b></span> </dt> <dd><p><code><code class='datatype'>string</code> Parser.RCS.Revision.<b><span class='variable'>author</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>the name of the user that committed the revision</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>branch</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> Parser.RCS.Revision.<b><span class='variable'>branch</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>the branch name on which this revision was committed (calculated according to how cvs manages branches)</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>branches</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>expand_keywords</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>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd> <dt class='head--doc'>Note</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>get_contents</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>get_contents</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Returns the file contents from this revision, without performing any keyword expansion.</p>
e4e3f32002-04-06Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>expand_keywords</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>lines</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> Parser.RCS.Revision.<b><span class='variable'>lines</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>the number of lines this revision contained, altogether (not of particular interest for binary files)</p> </dd></dl>
9699552002-03-12Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>log</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> Parser.RCS.Revision.<b><span class='variable'>log</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>the log message associated with the revision</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>next</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> Parser.RCS.Revision.<b><span class='variable'>next</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>the revision that succeeds this revision, or 0 if none exists</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>rcs_next</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> Parser.RCS.Revision.<b><span class='variable'>rcs_next</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>the revision stored next in the rcs file, or 0 if none exists</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>removed</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> Parser.RCS.Revision.<b><span class='variable'>removed</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>the number of lines that were removed from the previous revision to make this revision</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>the revision number (i e <code>RCS</code>-&gt;revisions["1.1"]-&gt;revision == "1.1")</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>state</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code> Parser.RCS.Revision.<b><span class='variable'>state</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>the state of the revision - typically "Exp" or "dead"</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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&nbsp;res=Parser.SGML()-&gt;feed(string)-&gt;finish()-&gt;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>"&lt;gat&gt;&amp;nbsp;&lt;gurka&gt;&amp;nbsp;&lt;/gurka&gt;&amp;nbsp;&lt;banan&gt;&amp;nbsp;&lt;kiwi&gt;&amp;nbsp;&lt;/gat&gt;"</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 &lt;ref&gt;create&lt;/ref&gt;) array(SGMLatom) data; - contained data </pre></p> </pre></dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>create</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd> <dt class='head--doc'>Note</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>No, it doesn't read the file itself. See <code>feed()</code>.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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></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>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>create</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Create a new error handler.</p>
e4e3f32002-04-06Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p><code>verbose</code></p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>verbose</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.LR.Parser</b></h2>
e4e3f32002-04-06Martin Nilsson </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>_sprintf</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Pretty-prints the current grammar to a string.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>add_rule</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Add a rule to the grammar.</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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>cast</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Implements casting.</p>
e4e3f32002-04-06Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <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></dl>
9699552002-03-12Martin Nilsson 
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>compile</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>compile</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Compiles the grammar into a parser, so that parse() can be called.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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> <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>
e4e3f32002-04-06Martin Nilsson <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Compile error and warning handler.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>grammar</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>The grammar itself.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>item_to_string</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Pretty-prints an item to a string.</p>
9699552002-03-12Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>known_states</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>LR0 states that are already known to the compiler.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>lr_error</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> Parser.LR.Parser.<b><span class='variable'>lr_error</span></b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Error code</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>parse</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Parse the input according to the compiled grammar. The last value reduced is returned.</p>
9699552002-03-12Martin Nilsson </dd>
e4e3f32002-04-06Martin Nilsson <dt class='head--doc'>Note</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>The parser must have been compiled (with compile()) prior to calling this function.</p>
9699552002-03-12Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>rule_to_string</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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></dl>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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'>State_queue</code> Parser.LR.Parser.<b><span class='variable'>s_q</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>set_associativity</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>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Sets the associativity of a terminal.</p>
9699552002-03-12Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>set_error_handler</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Sets the error report function.</p>
e4e3f32002-04-06Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>set_priority</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Sets the priority of a terminal.</p>
9699552002-03-12Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>set_symbol_to_string</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>start_state</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='object unresolved'>Kernel</code> Parser.LR.Parser.<b><span class='variable'>start_state</span></b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>The initial LR0 state.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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> </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> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Pretty-prints a state to a string.</p>
9699552002-03-12Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson <dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.LR.Parser.Item</b></h2>
e4e3f32002-04-06Martin Nilsson </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>An LR(0) item, a partially parsed rule.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>counter</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> Parser.LR.Parser.Item.<b><span class='variable'>counter</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Depth counter (used when compiling).</p> </dd></dl>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>direct_lookahead</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Look-ahead set for this item.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>error_lookahead</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Look-ahead set used for detecting conflicts</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>item_id</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> Parser.LR.Parser.Item.<b><span class='variable'>item_id</span></b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Used to identify the item. Equal to r-&gt;number + offset.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>master_item</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='object unresolved'>Item</code> Parser.LR.Parser.Item.<b><span class='variable'>master_item</span></b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Item representing this one (used for shifts).</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>next_state</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='object unresolved'>Kernel</code> Parser.LR.Parser.Item.<b><span class='variable'>next_state</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>The state we will get if we shift according to this rule</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>number</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> Parser.LR.Parser.Item.<b><span class='variable'>number</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Item identification number (used when compiling).</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>offset</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> Parser.LR.Parser.Item.<b><span class='variable'>offset</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>How long into the rule the parsing has come.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>r</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='object unresolved'>Rule</code> Parser.LR.Parser.Item.<b><span class='variable'>r</span></b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>The rule</p> </dd></dl>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>relation</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>add_item</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Add an item to the state.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>closure</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Make the closure of this state.</p>
9699552002-03-12Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>closure_set</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>multiset</code> Parser.LR.Parser.Kernel.<b><span class='variable'>closure_set</span></b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>The symbols that closure has been called on.</p>
9699552002-03-12Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>do_goto</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>goto_set</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Make the goto-set of this state.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>item_id_to_item</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Used to lookup items given rule and offset</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>items</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Contains the items in this state.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>rules</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> <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>
9699552002-03-12Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
9699552002-03-12Martin Nilsson <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>symbol_items</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Contains the items whose next symbol is this non-terminal.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.LR.Parser.State_queue</b></h2>
e4e3f32002-04-06Martin Nilsson </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>This is a queue, which keeps the elements even after they are retrieved.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>arr</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>array</code>(<code class='object unresolved'>Kernel</code>) Parser.LR.Parser.State_queue.<b><span class='variable'>arr</span></b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>The queue itself.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>head</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> Parser.LR.Parser.State_queue.<b><span class='variable'>head</span></b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Index of the head of the queue.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>next</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='object unresolved'>Kernel</code> <b><span class='method'>next</span>(</b><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Return the next state from the queue.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>push</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Pushes the state on the queue.</p>
9699552002-03-12Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
9699552002-03-12Martin Nilsson <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>tail</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> Parser.LR.Parser.State_queue.<b><span class='variable'>tail</span></b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Index of the tail of the queue.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson </dd></dl></dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.LR.Priority</b></h2>
e4e3f32002-04-06Martin Nilsson </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Specifies the priority and associativity of a rule.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>assoc</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>create</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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> <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>
e4e3f32002-04-06Martin Nilsson </dd></dl>
9699552002-03-12Martin Nilsson 
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>value</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> Parser.LR.Priority.<b><span class='variable'>value</span></b></code></p></dd>
9699552002-03-12Martin Nilsson 
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>action</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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>
e4e3f32002-04-06Martin Nilsson 
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>create</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Create a BNF rule.</p>
9699552002-03-12Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>has_tokens</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> Parser.LR.Rule.<b><span class='variable'>has_tokens</span></b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>This rule contains tokens</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>num_nonnullables</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> Parser.LR.Rule.<b><span class='variable'>num_nonnullables</span></b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>This rule has this many non-nullable symbols at the moment.</p> </dd></dl>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>number</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> Parser.LR.Rule.<b><span class='variable'>number</span></b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Sequence number of this rule (used for conflict resolving) Also used to identify the rule.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>pri</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='object unresolved'>Priority</code> Parser.LR.Rule.<b><span class='variable'>pri</span></b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Priority and associativity of this rule.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>symbols</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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.Grammar_parser</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>
e4e3f32002-04-06Martin Nilsson </dd></dl>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>lr_error</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> Parser.LR.Grammar_parser.<b><span class='variable'>lr_error</span></b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Error code from the parsing.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>make_parser</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <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 Grammar_parser.error and return_value-&gt;lr_error.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>make_parser_from_file</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <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>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Compiles the file specified in the first argument into an LR parser.</p>
9699552002-03-12Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>make_parser</code></p> </dd></dl> </dd></dl></dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Parser.MP3</b></h2> </dt><dd><dl><dt><h2 class='header'>Class <b class='ms datatype'>Parser.MP3.Buffer</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Buffer object for unified access to MP3 file represented by Stdio.File object or string</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>create</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><span class='object'>Parser.MP3.Buffer</span> <span class='class'>Parser.MP3.Buffer</span><b>(</b><code class='object unresolved'>Stdio.File</code>|<code class='datatype'>string</code> <code class='argument'>_fd</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Creates Buffer object</p>
9699552002-03-12Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <dt class='head--doc'><span id='p-_fd'></span>Parameter <code class='parameter'>_fd</code></dt> <dd></dd><dd class='body--doc'><p>The Stdio.File object or string contained MP3 file</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>getbytes</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>string</code>|<code class='datatype'>int</code> <b><span class='method'>getbytes</span>(</b><code class='datatype'>int</code> <code class='argument'>n</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>s</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson 
9699552002-03-12Martin Nilsson <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson <dd class='body--doc'><p>Gets data from buffer</p>
9699552002-03-12Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <dt class='head--doc'><span id='p-n'></span>Parameter <code class='parameter'>n</code></dt> <dd></dd><dd class='body--doc'><p>Number of bytes</p> </dd> <dt class='head--doc'><span id='p-s'></span>Parameter <code class='parameter'>s</code></dt> <dd></dd><dd class='body--doc'><p>Flag for type of returned data. 1 = string, 0 or void = integer</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
9699552002-03-12Martin Nilsson 
1f918f2002-05-26Martin Nilsson 
9699552002-03-12Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>is_file</b></span>
9699552002-03-12Martin Nilsson </dt>
1f918f2002-05-26Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>is_file</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
1f918f2002-05-26Martin Nilsson