Author: kn
Date: Fri Feb 15 16:34:12 2008
New Revision: 7387
Log:
- Parse document titles and create section structure
# Exceptions and nodes still need to be redefined slightly to throw more
# verbose error messages.
Added:
experimental/Document/src/document/rst/nodes/section.php (with props)
experimental/Document/src/document/rst/nodes/text_line.php (with props)
experimental/Document/src/document/rst/nodes/title.php (with props)
experimental/Document/src/exceptions/rst_parser.php (with props)
experimental/Document/tests/files/rst/parser/titles.rst
Modified:
experimental/Document/design/class_diagram.png
experimental/Document/src/document/rst/node.php
experimental/Document/src/document/rst/nodes/document.php
experimental/Document/src/document/rst/parser.php
experimental/Document/src/document_autoload.php
experimental/Document/tests/files/rst/parser/titles.txt
Modified: experimental/Document/design/class_diagram.png
==============================================================================
Binary files - no diff available.
Modified: experimental/Document/src/document/rst/node.php
==============================================================================
--- experimental/Document/src/document/rst/node.php [iso-8859-1] (original)
+++ experimental/Document/src/document/rst/node.php [iso-8859-1] Fri Feb 15
16:34:12 2008
@@ -16,13 +16,18 @@
* @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
* @license http://ez.no/licenses/new_bsd New BSD License
*/
-class ezcDocumentRstNode extends ezcBaseStruct // implements RecursiveIterator
+abstract class ezcDocumentRstNode extends ezcBaseStruct // implements
RecursiveIterator
{
// Node types
- const DOCUMENT = 0;
- const SECTION = 1;
- const TITLE = 2;
- const PARAGRAPH = 3;
+ const DOCUMENT = 0;
+ const SECTION = 1;
+ const TITLE = 2;
+ const PARAGRAPH = 3;
+ const TEXT_LINE = 4;
+
+ const TABLE = 10;
+
+ const BULLET_LIST = 20;
// ...
/**
@@ -61,7 +66,7 @@
*/
public static function __set_state( $properties )
{
- return new static(
+ return new ezcDocumentRstNode(
$properties['type'],
$properties['nodes']
);
Modified: experimental/Document/src/document/rst/nodes/document.php
==============================================================================
--- experimental/Document/src/document/rst/nodes/document.php [iso-8859-1]
(original)
+++ experimental/Document/src/document/rst/nodes/document.php [iso-8859-1] Fri
Feb 15 16:34:12 2008
@@ -18,6 +18,13 @@
*/
class ezcDocumentRstDocumentNode extends ezcDocumentRstNode
{
+ /**
+ * Neting depth of document is always 0
+ *
+ * @var int
+ */
+ public $depth = 0;
+
/**
* Construct RST document node
*
@@ -40,9 +47,11 @@
*/
public static function __set_state( $properties )
{
- return new ezcDocumentRstDocumentNode(
+ $node = new ezcDocumentRstDocumentNode(
$properties['nodes']
);
+
+ return $node;
}
}
Added: experimental/Document/src/document/rst/nodes/section.php
==============================================================================
--- experimental/Document/src/document/rst/nodes/section.php (added)
+++ experimental/Document/src/document/rst/nodes/section.php [iso-8859-1] Fri
Feb 15 16:34:12 2008
@@ -1,0 +1,71 @@
+<?php
+/**
+ * File containing the ezcDocumentRstSectionNode struct
+ *
+ * @package Section
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+
+/**
+ * The document AST node
+ *
+ * @package Section
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+class ezcDocumentRstSectionNode extends ezcDocumentRstNode
+{
+ /**
+ * Section title
+ *
+ * @var string
+ */
+ public $title;
+
+ /**
+ * Depth of section nesting
+ *
+ * @var int
+ */
+ public $depth;
+
+ /**
+ * Construct RST document node
+ *
+ * @param array $nodes
+ * @return void
+ */
+ public function __construct( ezcDocumentRstTextLineNode $title, $depth = 0
)
+ {
+ // Perhaps check, that only node of type section and metadata are
+ // added.
+ parent::__construct( self::SECTION, array() );
+
+ $this->title = $title;
+ $this->depth = $depth;
+ }
+
+ /**
+ * Set state after var_export
+ *
+ * @param array $properties
+ * @return void
+ * @ignore
+ */
+ public static function __set_state( $properties )
+ {
+ $node = new ezcDocumentRstSectionNode(
+ $properties['title'],
+ $properties['depth']
+ );
+
+ $node->nodes = $properties['nodes'];
+
+ return $node;
+ }
+}
+
+?>
Propchange: experimental/Document/src/document/rst/nodes/section.php
------------------------------------------------------------------------------
svn:eol-style = native
Added: experimental/Document/src/document/rst/nodes/text_line.php
==============================================================================
--- experimental/Document/src/document/rst/nodes/text_line.php (added)
+++ experimental/Document/src/document/rst/nodes/text_line.php [iso-8859-1] Fri
Feb 15 16:34:12 2008
@@ -1,0 +1,49 @@
+<?php
+/**
+ * File containing the ezcDocumentRstTextLineNode struct
+ *
+ * @package TextLine
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+
+/**
+ * The document AST node
+ *
+ * @package TextLine
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+class ezcDocumentRstTextLineNode extends ezcDocumentRstNode
+{
+ /**
+ * Construct RST document node
+ *
+ * @param array $nodes
+ * @return void
+ */
+ public function __construct( ezcDocumentRstToken $token )
+ {
+ // Perhaps check, that only node of type section and metadata are
+ // added.
+ parent::__construct( self::TEXT_LINE, array( $token ) );
+ }
+
+ /**
+ * Set state after var_export
+ *
+ * @param array $properties
+ * @return void
+ * @ignore
+ */
+ public static function __set_state( $properties )
+ {
+ return new ezcDocumentRstTextLineNode(
+ $properties['nodes'][0]
+ );
+ }
+}
+
+?>
Propchange: experimental/Document/src/document/rst/nodes/text_line.php
------------------------------------------------------------------------------
svn:eol-style = native
Added: experimental/Document/src/document/rst/nodes/title.php
==============================================================================
--- experimental/Document/src/document/rst/nodes/title.php (added)
+++ experimental/Document/src/document/rst/nodes/title.php [iso-8859-1] Fri Feb
15 16:34:12 2008
@@ -1,0 +1,60 @@
+<?php
+/**
+ * File containing the ezcDocumentRstTitleNode struct
+ *
+ * @package Title
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+
+/**
+ * The document AST node
+ *
+ * @package Title
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+class ezcDocumentRstTitleNode extends ezcDocumentRstNode
+{
+ /**
+ * Token, which is used for the current title definition
+ *
+ * @var ezcDocumentRstToken
+ */
+ public $token;
+
+ /**
+ * Construct RST document node
+ *
+ * @param array $nodes
+ * @return void
+ */
+ public function __construct( ezcDocumentRstToken $token )
+ {
+ // Perhaps check, that only node of type section and metadata are
+ // added.
+ parent::__construct( self::TITLE, array() );
+
+ $this->token = $token;
+ }
+
+ /**
+ * Set state after var_export
+ *
+ * @param array $properties
+ * @return void
+ * @ignore
+ */
+ public static function __set_state( $properties )
+ {
+ $node = new ezcDocumentRstTitleNode(
+ $properties['token']
+ );
+
+ return $node;
+ }
+}
+
+?>
Propchange: experimental/Document/src/document/rst/nodes/title.php
------------------------------------------------------------------------------
svn:eol-style = native
Modified: experimental/Document/src/document/rst/parser.php
==============================================================================
--- experimental/Document/src/document/rst/parser.php [iso-8859-1] (original)
+++ experimental/Document/src/document/rst/parser.php [iso-8859-1] Fri Feb 15
16:34:12 2008
@@ -22,6 +22,15 @@
class ezcDocumentRstParser
{
/**
+ * List with parser warnings.
+ *
+ * Fatal errors are directly announced by throwing an exception.
+ *
+ * @var array
+ */
+ protected $warnings = array();
+
+ /**
* Array containing simplified shift ruleset
*
* We cannot express the RST syntax as a usual grammar using a BNF. With
@@ -57,14 +66,16 @@
ezcDocumentRstToken::NEWLINE => array(
),
ezcDocumentRstToken::BACKSLASH => array(
- 'shiftBackslash'
+ 'shiftBackslash',
),
ezcDocumentRstToken::SPECIAL_CHARS => array(
+ 'shiftTitle',
),
ezcDocumentRstToken::TEXT_LINE => array(
+ 'shiftText'
),
ezcDocumentRstToken::EOF => array(
- 'shiftDocument'
+ 'shiftDocument',
),
);
@@ -86,7 +97,9 @@
* @var array
*/
protected $reductions = array(
- ezcDocumentRstNode::DOCUMENT => 'reduceDocument',
+ ezcDocumentRstNode::DOCUMENT => 'reduceSection',
+ ezcDocumentRstNode::SECTION => 'reduceSection',
+ ezcDocumentRstNode::TITLE => 'reduceTitle',
);
/**
@@ -105,11 +118,11 @@
protected $documentStack = array();
/**
- * The resulting sucessfully parsed document.
- *
- * @var ezcDocumentRstDocumentNode
- */
- protected $parsedDocument = null;
+ * Array with title levels used by the document author in their order.
+ *
+ * @var array
+ */
+ protected $titleLevels = array();
/**
* Construct parser
@@ -134,27 +147,51 @@
{
while ( ( $token = array_shift( $tokens ) ) !== null )
{
+ // echo "[T] Token: {$token->type}\n";
+
// First shift given token by the defined reduction methods
foreach ( $this->shifts[$token->type] as $method )
{
+ // echo "[S] Try $method .. ";
if ( ( $node = $this->$method( $token, $tokens ) ) === false )
{
- // The shift method processed the token, go to next one.
+ // The shift method cannot handle the token, go to next
+ // echo "skip\n";
continue;
}
-
- // Call reduce methods for node
- $reduction = $this->reductions[$node->type];
- $this->$reduction( $node );
+ // echo "USE\n";
+
+ // Call reduce methods for nodes as long the reduction methods
+ // recreate some node
+ do {
+ if ( !isset( $this->reductions[$node->type] ) )
+ {
+ // If there are no reduction rules for the node, just
+ // add it to the stack
+ // echo "[R] Add to stack.\n";
+
+ array_unshift( $this->documentStack, $node );
+ break;
+ }
+
+ $reduction = $this->reductions[$node->type];
+ // echo "[R] Reduce with $reduction.\n";
+ $node = $this->$reduction( $node );
+ } while ( $node !== null );
// We found a matching rule, so that we can leave the loop
break;
}
}
- // This should always be set at this point, each other case should have
- // caused an exception.
- return $this->parsedDocument;
+ // Check if we successfully reduced the document stack
+ if ( ( count( $this->documentStack ) !== 1 ) ||
+ ( !( $document = reset( $this->documentStack ) ) instanceof
ezcDocumentRstDocumentNode ) )
+ {
+ throw new ezcDocumentRstParserException();
+ }
+
+ return $document;
}
/**
@@ -180,6 +217,55 @@
}
/**
+ * Create new title node from titles with a top and bottom line
+ *
+ * @param ezcDocumentRstToken $token
+ * @param array $tokens
+ * @return ezcDocumentRstTitleNode
+ */
+ protected function shiftTitle( ezcDocumentRstToken $token, array $tokens )
+ {
+ if ( ( $token->position !== 1 ) ||
+ ( $tokens[0]->type !== ezcDocumentRstToken::NEWLINE ) )
+ {
+ // This is not a title line at all
+ // echo " -> No title line.\n";
+ return false;
+ }
+
+ // Handle literal block markers differently, they are followed by two
+ // newlines (maybe with whitespaces inbetween).
+ if ( ( ( $tokens[1]->type === ezcDocumentRstToken::NEWLINE ) ||
+ ( ( $tokens[1]->type === ezcDocumentRstToken::WHITESPACE ) &&
+ ( $tokens[2]->type === ezcDocumentRstToken::NEWLINE ) ) ) &&
+ isset( $this->documentStack[0] ) &&
+ ( $this->documentStack[0]->type !== ezcDocumentRstNode::TEXT_LINE
) )
+ {
+ // This seems to be something else, like a liteal block marker.
+ // echo " -> Literal block marker?\n";
+ return false;
+ }
+
+ return new ezcDocumentRstTitleNode(
+ $token
+ );
+ }
+
+ /**
+ * Just keep text as text nodes
+ *
+ * @param ezcDocumentRstToken $token
+ * @param array $tokens
+ * @return ezcDocumentRstTitleNode
+ */
+ protected function shiftText( ezcDocumentRstToken $token, array $tokens )
+ {
+ return new ezcDocumentRstTextLineNode(
+ $token
+ );
+ }
+
+ /**
* Reduce all elements to one document node.
*
* @param ezcDocumentRstDocumentNode $node
@@ -187,14 +273,17 @@
*/
protected function reduceDocument( ezcDocumentRstDocumentNode $node )
{
- foreach ( $this->documentStack as $child )
- {
- if ( ( $child->type !== ezcDocumentRstNode::SECTION ) &&
- ( $child->type !== ezcDocumentRstNode::METADATA ) )
+ while ( $child = array_shift( $this->documentStack ) )
+ {
+ if ( !in_array( $child->type, array(
+// ezcDocumentRstNode::METADATA,
+ ezcDocumentRstNode::SECTION,
+ ), true ) )
{
+ // @TODO: Enhance error message
throw new ezcDocumentRstParserException(
- $child, ezcDocumentRstParserException::FATAL,
- 'Unexpected node.'
+ null, ezcDocumentRstParserException::FATAL,
+ 'Unexpected child.'
);
}
@@ -204,6 +293,146 @@
$this->documentStack = array();
$this->parsedDocument = $node;
}
+
+ /**
+ * Reduce all elements to one document node.
+ *
+ * @param ezcDocumentRstTitleNode $node
+ * @return void
+ */
+ protected function reduceTitle( ezcDocumentRstTitleNode $node )
+ {
+ if ( !isset( $this->documentStack[0] ) ||
+ ( $this->documentStack[0]->type !== ezcDocumentRstNode::TEXT_LINE
) )
+ {
+ // This is a title top line, just skip for now.
+ array_unshift( $this->documentStack, $node );
+ return;
+ }
+
+ // Pop title line from stack
+ $title = array_shift( $this->documentStack );
+ $titleType = $node->token->content[0];
+
+ // Check if the lengths of the top line and the text matches.
+ if ( strlen( $node->token->content ) !== strlen(
$title->nodes[0]->content ) )
+ {
+ $this->warnings[] = "Title underline length does not match text
length in line {$node->token->line}.";
+ }
+
+ // Check if the title has a top line
+ if ( isset( $this->documentStack[0] ) &&
+ ( $this->documentStack[0]->type === ezcDocumentRstNode::TITLE ) )
+ {
+ $doubleTitle = array_shift( $this->documentStack );
+ $titleType = $doubleTitle->token->content[0] . $titleType;
+
+ // Ensure title over and underline lengths matches, for docutils
+ // this is a severe error.
+ if ( strlen( $node->token->content ) !== strlen(
$doubleTitle->token->content ) )
+ {
+ throw new ezcDocumentRstParserException(
+ $node->token, ezcDocumentRstParserException::FATAL,
+ "Title overline & underline mismatch in line
{$node->token->line}."
+ );
+ }
+ }
+
+ // Get section nesting depth for title
+ if ( isset( $this->titleLevels[$titleType] ) )
+ {
+ $depth = $this->titleLevels[$titleType];
+ }
+ else
+ {
+ $this->titleLevels[$titleType] = $depth = count(
$this->titleLevels ) + 1;
+ }
+
+ // Prepend section element to document stack
+ return new ezcDocumentRstSectionNode(
+ $title,
+ $depth
+ );
+ }
+
+ /**
+ * Reduce prior sections, if a new section has been found.
+ *
+ * If a new section has been found all sections with a higher depth level
+ * can be closed, and all items fitting into sections may be aggregated by
+ * the respective sections as well.
+ *
+ * @param ezcDocumentRstSectionNode $node
+ * @return void
+ */
+ protected function reduceSection( ezcDocumentRstNode $node )
+ {
+ // Collected node for prior section
+ $collected = array();
+ $lastSectionDepth = -1;
+
+ // Include all paragraphs, tables, lists and sections with a higher
+ // nesting depth
+ while ( $child = array_shift( $this->documentStack ) )
+ {
+ if ( !in_array( $child->type, array(
+ ezcDocumentRstNode::PARAGRAPH,
+ ezcDocumentRstNode::SECTION,
+ ezcDocumentRstNode::BULLET_LIST,
+ ezcDocumentRstNode::TABLE,
+ ), true ) )
+ {
+ // @TODO: Enhance error message
+ throw new ezcDocumentRstParserException(
+ null, ezcDocumentRstParserException::FATAL,
+ 'Unexpected child.'
+ );
+ }
+
+ if ( $child->type === ezcDocumentRstNode::SECTION )
+ {
+ if ( $child->depth <= $node->depth )
+ {
+ $child->nodes = $collected;
+ // If the found section has a same or higher level, just
+ // leave it on the stack
+ array_unshift( $this->documentStack, $child );
+ array_unshift( $this->documentStack, $node );
+ // echo " -> Leave on stack.\n";
+ return;
+ }
+
+ if ( ( $lastSectionDepth - $child->depth ) > 1 )
+ {
+ $token = $child->title->token;
+
+ throw new ezcDocumentRstParserException(
+ $token, ezcDocumentRstParserException::FATAL,
+ "Title depth inconsitency in line
{$node->token->line}."
+ );
+ }
+
+ if ( ( $lastSectionDepth === -1 ) ||
+ ( $lastSectionDepth > $child->depth ) )
+ {
+ // If the section level is higher then in our new node and
+ // lower the the last node, reduce sections.
+ // echo " -> Reduce section {$child->depth}.";
+ $child->nodes = $collected;
+ $collected = array();
+ }
+
+ // Sections on an equal level are just appended, for all
+ // sections we remember the last depth.
+ $lastSectionDepth = $child->depth;
+ }
+
+ $collected[] = $child;
+ }
+
+ $node->nodes = $collected;
+ array_unshift( $this->documentStack, $node );
+ }
}
?>
Modified: experimental/Document/src/document_autoload.php
==============================================================================
--- experimental/Document/src/document_autoload.php [iso-8859-1] (original)
+++ experimental/Document/src/document_autoload.php [iso-8859-1] Fri Feb 15
16:34:12 2008
@@ -12,6 +12,7 @@
return array(
'ezcDocumentException' =>
'Document/exceptions/exception.php',
'ezcDocumentErrnousXmlException' =>
'Document/exceptions/errnous_xml.php',
+ 'ezcDocumentRstParserException' =>
'Document/exceptions/rst_parser.php',
'ezcDocumentRstTokenizerException' =>
'Document/exceptions/rst_tokenizer.php',
'ezcDocument' =>
'Document/interfaces/document.php',
'ezcDocumentBaseOptions' =>
'Document/options/document_base.php',
@@ -37,6 +38,9 @@
'ezcDocumentRstDocumentNode' =>
'Document/document/rst/nodes/document.php',
'ezcDocumentRstOptions' =>
'Document/options/document_rst.php',
'ezcDocumentRstParser' =>
'Document/document/rst/parser.php',
+ 'ezcDocumentRstSectionNode' =>
'Document/document/rst/nodes/section.php',
+ 'ezcDocumentRstTextLineNode' =>
'Document/document/rst/nodes/text_line.php',
+ 'ezcDocumentRstTitleNode' =>
'Document/document/rst/nodes/title.php',
'ezcDocumentRstToken' =>
'Document/document/rst/token.php',
'ezcDocumentRstTokenizer' =>
'Document/document/rst/tokenizer.php',
'ezcDocumentXhtml' =>
'Document/document/xml/xhtml.php',
Added: experimental/Document/src/exceptions/rst_parser.php
==============================================================================
--- experimental/Document/src/exceptions/rst_parser.php (added)
+++ experimental/Document/src/exceptions/rst_parser.php [iso-8859-1] Fri Feb 15
16:34:12 2008
@@ -1,0 +1,37 @@
+<?php
+/**
+ * Base exception for the Document package.
+ *
+ * @package Document
+ * @version //autogentag//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+
+/**
+ * Exception thrown, when the RST parser could not parse asome token sequence.
+ *
+ * @package Document
+ * @version //autogentag//
+ */
+class ezcDocumentRstParserException extends ezcDocumentException
+{
+ const FATAL = 1;
+
+ /**
+ * Construct exception from errnous string and current position
+ *
+ * @param int $line
+ * @param int $position
+ * @param string $string
+ * @return void
+ */
+ public function __construct( )
+ {
+ parent::__construct(
+ "Parse error."
+ );
+ }
+}
+
+?>
Propchange: experimental/Document/src/exceptions/rst_parser.php
------------------------------------------------------------------------------
svn:eol-style = native
Added: experimental/Document/tests/files/rst/parser/titles.rst
==============================================================================
--- experimental/Document/tests/files/rst/parser/titles.rst (added)
+++ experimental/Document/tests/files/rst/parser/titles.rst [iso-8859-1] Fri
Feb 15 16:34:12 2008
@@ -1,0 +1,406 @@
+<?php
+
+return ezcDocumentRstDocumentNode::__set_state(array(
+ 'depth' => 0,
+ 'type' => 0,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+ ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section Title',
+ 'line' => 2,
+ 'position' => 2,
+ )),
+ ),
+ )),
+ 'depth' => 1,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+ ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section Title',
+ 'line' => 6,
+ 'position' => 2,
+ )),
+ ),
+ )),
+ 'depth' => 2,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+ ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section Title',
+ 'line' => 48,
+ 'position' => 1,
+ )),
+ ),
+ )),
+ 'depth' => 3,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+ ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section Title',
+ 'line' => 51,
+ 'position' => 1,
+ )),
+ ),
+ )),
+ 'depth' => 4,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+ ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section Title',
+ 'line' => 54,
+ 'position' => 1,
+ )),
+ ),
+ )),
+ 'depth' => 5,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ ),
+ )),
+ ),
+ )),
+ ),
+ )),
+ 1 =>
+ ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+ ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section Title',
+ 'line' => 9,
+ 'position' => 1,
+ )),
+ ),
+ )),
+ 'depth' => 3,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+ ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section Title',
+ 'line' => 12,
+ 'position' => 1,
+ )),
+ ),
+ )),
+ 'depth' => 4,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+ ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section Title',
+ 'line' => 21,
+ 'position' => 1,
+ )),
+ ),
+ )),
+ 'depth' => 5,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+ ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section Title',
+ 'line' => 24,
+ 'position' => 1,
+ )),
+ ),
+ )),
+ 'depth' => 6,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+ ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section Title',
+ 'line' => 33,
+ 'position' => 1,
+ )),
+ ),
+ )),
+ 'depth' => 7,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+
ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section Title',
+ 'line' => 36,
+ 'position' => 1,
+ )),
+ ),
+ )),
+ 'depth' => 8,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ 0 =>
+
ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+
ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+
ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section Title',
+ 'line' => 39,
+ 'position' => 1,
+ )),
+ ),
+ )),
+ 'depth' => 9,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ 0 =>
+
ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+
ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+
ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section Title',
+ 'line' => 42,
+ 'position' => 1,
+ )),
+ ),
+ )),
+ 'depth' => 10,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ 0 =>
+
ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+
ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+
ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section
Title',
+ 'line' => 45,
+ 'position' => 1,
+ )),
+ ),
+ )),
+ 'depth' => 11,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ ),
+ )),
+ ),
+ )),
+ ),
+ )),
+ ),
+ )),
+ ),
+ )),
+ 1 =>
+ ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+ ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section Title',
+ 'line' => 27,
+ 'position' => 1,
+ )),
+ ),
+ )),
+ 'depth' => 7,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+
ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section Title',
+ 'line' => 30,
+ 'position' => 1,
+ )),
+ ),
+ )),
+ 'depth' => 8,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ ),
+ )),
+ ),
+ )),
+ ),
+ )),
+ ),
+ )),
+ 1 =>
+ ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+ ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section Title',
+ 'line' => 15,
+ 'position' => 1,
+ )),
+ ),
+ )),
+ 'depth' => 5,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstSectionNode::__set_state(array(
+ 'title' =>
+ ezcDocumentRstTextLineNode::__set_state(array(
+ 'type' => 4,
+ 'nodes' =>
+ array (
+ 0 =>
+ ezcDocumentRstToken::__set_state(array(
+ 'type' => 5,
+ 'content' => 'Section Title',
+ 'line' => 18,
+ 'position' => 1,
+ )),
+ ),
+ )),
+ 'depth' => 6,
+ 'type' => 1,
+ 'nodes' =>
+ array (
+ ),
+ )),
+ ),
+ )),
+ ),
+ )),
+ ),
+ )),
+ ),
+ )),
+ ),
+ )),
+ ),
+));
+
Modified: experimental/Document/tests/files/rst/parser/titles.txt
==============================================================================
--- experimental/Document/tests/files/rst/parser/titles.txt [iso-8859-1]
(original)
+++ experimental/Document/tests/files/rst/parser/titles.txt [iso-8859-1] Fri
Feb 15 16:34:12 2008
@@ -7,7 +7,7 @@
---------------
Section Title
-=============
+==============
Section Title
-------------
@@ -17,6 +17,18 @@
Section Title
'''''''''''''
+
+Section Title
+`````````````
+
+Section Title
+'''''''''''''
+
+Section Title
+.............
+
+Section Title
+~~~~~~~~~~~~~
Section Title
.............
@@ -32,3 +44,12 @@
Section Title
^^^^^^^^^^^^^
+
+Section Title
+==============
+
+Section Title
+-------------
+
+Section Title
+`````````````
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components