condition = null; } public function getTreeProperties() { return array( 'name' => $this->name, 'condition' => $this->condition, 'children' => $this->children ); } public function handleElement( ezcTemplateTstNode $element ) { if ( $element instanceof ezcTemplateCaseTstNode ) { if ( $element->conditions === null ) { if ( $this->defaultCaseFound ) { throw new ezcTemplateParserException( $element->source, $element->startCursor, $element->startCursor, ezcTemplateSourceToTstErrorMessages::MSG_DEFAULT_DUPLICATE ); } $this->defaultCaseFound = true; } elseif( $this->defaultCaseFound ) // Found a default case already.. { throw new ezcTemplateParserException( $element->source, $element->startCursor, $element->startCursor, ezcTemplateSourceToTstErrorMessages::MSG_DEFAULT_LAST ); } parent::handleElement( $element ); } elseif( $element instanceof ezcTemplateDocCommentTstNode ) { parent::handleElement( $element ); } else { if ( $element instanceof ezcTemplateTextBlockTstNode ) { // Only spaces, newlines and tabs? if ( preg_match( "#^\s*$#", $element->text) != 0 ) { // It's okay, but ignore it. return; } } throw new ezcTemplateParserException( $element->source, $element->startCursor, $element->startCursor, ezcTemplateSourceToTstErrorMessages::MSG_EXPECT_CASE_STATEMENT ); } } } ?>