Author: Raymond Bosman
Date: 2006-12-21 14:01:13 +0100 (Thu, 21 Dec 2006)
New Revision: 4432
Log:
- Removed unused code.
- Added documentation.
Modified:
trunk/Template/src/parser.php
trunk/Template/src/parsers/source_to_tst/implementations/array_fetch.php
trunk/Template/src/parsers/source_to_tst/implementations/expression.php
trunk/Template/src/parsers/source_to_tst/implementations/program.php
trunk/Template/src/parsers/source_to_tst/interfaces/source_to_tst_parser.php
Modified: trunk/Template/src/parser.php
===================================================================
--- trunk/Template/src/parser.php 2006-12-21 12:23:55 UTC (rev 4431)
+++ trunk/Template/src/parser.php 2006-12-21 13:01:13 UTC (rev 4432)
@@ -17,7 +17,6 @@
*/
class ezcTemplateParser
{
-
/**
* @var ezcTemplate
*/
@@ -59,9 +58,11 @@
public $symbolTable;
/**
- *
* Note: The source code in $code must be loaded/created before passing it
to this parser.
- */
+ *
+ * @param ezcTemplateSourceCode $source
+ * @param ezcTemplate $template
+ */
function __construct( ezcTemplateSourceCode $source, ezcTemplate $template
)
{
$this->source = $source;
@@ -90,15 +91,6 @@
}
/**
- * @todo Currently used for testing order of element creation, might not
be needed.
- */
- public function reportElementCursor( $startCursor, $endCursor, $element )
- {
- // echo "element <", get_class( $element ) . ">\n";
- }
-
-
- /**
* Figures out the operator precedence for the new operator $newOperator
* by examining it with the current operator element.
*
@@ -291,8 +283,8 @@
* current operator if there is one, if not it becomes the current item.
* The element which should be the current item is returned by this
function.
*
- * @param ezcTemplateTstNode $currentOperator The current operator/operand
element, can be null.
- * @param ezcTemplateTstNode $operand The parsed operator/operand which
should be added as parameter.
+ * @param ezcTemplateTstNode $currentOperator The current
operator/operand element, can be null.
+ * @param ezcTemplateTstNode $operand The parsed
operator/operand which should be added as parameter.
* @return ezcTemplateTstNode
*/
public function handleOperand( /*ezcTemplateTstNode*/ $currentOperator,
ezcTemplateTstNode $operand )
@@ -322,6 +314,11 @@
}
}
+ /**
+ * Creates the TST tree structure from the source code.
+ *
+ * @return void
+ */
public function parseIntoNodeTree()
{
if ( !$this->source->hasCode() )
@@ -365,6 +362,7 @@
* Note: This does nothing if self::$trimWhitespace is set to false.
* @param ezcTemplateBlockTstNode $block
* Block element which has its children trimmed of indentation
whitespace.
+ * @return void
*/
public function trimBlockLevelIndentation( ezcTemplateBlockTstNode $block )
{
@@ -389,6 +387,7 @@
* Note: This does nothing if self::$trimWhitespace is set to false.
* @param ezcTemplateBlockTstNode $block
* Block element which has its child blocks trimmed of EOL
whitespace.
+ * @return void
*/
public function trimBlockLine( ezcTemplateBlockTstNode $block )
{
Modified:
trunk/Template/src/parsers/source_to_tst/implementations/array_fetch.php
===================================================================
--- trunk/Template/src/parsers/source_to_tst/implementations/array_fetch.php
2006-12-21 12:23:55 UTC (rev 4431)
+++ trunk/Template/src/parsers/source_to_tst/implementations/array_fetch.php
2006-12-21 13:01:13 UTC (rev 4432)
@@ -66,7 +66,6 @@
$this->fetch->endCursor = clone
$this->lastParser->currentOperator->endCursor;
$this->fetch->appendParameter( $this->lastParser->currentOperator );
- $this->parser->reportElementCursor( $this->fetch->startCursor,
$this->fetch->endCursor, $this->fetch );
return true;
}
Modified:
trunk/Template/src/parsers/source_to_tst/implementations/expression.php
===================================================================
--- trunk/Template/src/parsers/source_to_tst/implementations/expression.php
2006-12-21 12:23:55 UTC (rev 4431)
+++ trunk/Template/src/parsers/source_to_tst/implementations/expression.php
2006-12-21 13:01:13 UTC (rev 4432)
@@ -314,7 +314,6 @@
$this->currentOperator = $operator;
}
- $this->parser->reportElementCursor(
$operator->startCursor, $operator->endCursor, $operator );
$this->lastCursor->copy( $cursor );
return true;
}
@@ -340,7 +339,6 @@
$this->currentOperator = $this->parser->handleOperatorPrecedence(
$this->currentOperator, $operator );
- $this->parser->reportElementCursor( $operator->startCursor,
$operator->endCursor, $operator );
$this->lastCursor->copy( $cursor );
return true;
@@ -376,7 +374,6 @@
$this->currentOperator = $operator;
}
- $this->parser->reportElementCursor( $operator->startCursor,
$operator->endCursor, $operator );
$this->lastCursor->copy( $cursor );
return true;
@@ -446,7 +443,6 @@
$this->checkForValidOperator( $this->currentOperator,
$operator, $cursor );
$this->currentOperator =
$this->parser->handleOperatorPrecedence( $this->currentOperator, $operator );
- $this->parser->reportElementCursor( $operator->startCursor,
$operator->endCursor, $operator );
return true;
}
@@ -557,7 +553,6 @@
$this->currentOperator =
$this->parser->handleOperatorPrecedence( $this->currentOperator, $operator );
- $this->parser->reportElementCursor( $operator->startCursor,
$operator->endCursor, $operator );
$this->lastCursor->copy( $cursor );
// -> operator can have an identifier as the next operand
Modified: trunk/Template/src/parsers/source_to_tst/implementations/program.php
===================================================================
--- trunk/Template/src/parsers/source_to_tst/implementations/program.php
2006-12-21 12:23:55 UTC (rev 4431)
+++ trunk/Template/src/parsers/source_to_tst/implementations/program.php
2006-12-21 13:01:13 UTC (rev 4432)
@@ -68,7 +68,6 @@
if ( $this->lastCursor->length( $blockCursor ) > 0 )
{
$textElement = new ezcTemplateTextBlockTstNode(
$this->parser->source, clone $this->lastCursor, clone $blockCursor );
- $this->parser->reportElementCursor( $textElement->startCursor,
$textElement->endCursor, $textElement );
$this->handleElements( array( $textElement ) );
unset( $textElement );
}
@@ -121,7 +120,6 @@
if ( $lastCursor->length( $cursor ) > 0 )
{
$textElement = new ezcTemplateTextBlockTstNode(
$this->parser->source, clone $lastCursor, clone $cursor );
- $this->parser->reportElementCursor( $textElement->startCursor,
$textElement->endCursor, $textElement );
$this->handleElements( array( $textElement ) );
}
Modified:
trunk/Template/src/parsers/source_to_tst/interfaces/source_to_tst_parser.php
===================================================================
---
trunk/Template/src/parsers/source_to_tst/interfaces/source_to_tst_parser.php
2006-12-21 12:23:55 UTC (rev 4431)
+++
trunk/Template/src/parsers/source_to_tst/interfaces/source_to_tst_parser.php
2006-12-21 13:01:13 UTC (rev 4432)
@@ -282,13 +282,9 @@
*
* @param ezcTemplateTstNode $element The element object to add to list.
*/
- public function appendElement( $element, $report = true )
+ public function appendElement( $element )
{
$this->elements[] = $element;
- if ( $report )
- {
- $this->parser->reportElementCursor( $element->startCursor,
$element->endCursor, $element );
- }
}
/**
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components