Ejemplo n.º 1
0
 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) {
             throw new ezcTemplateParserException($element->source, $element->startCursor, $element->startCursor, ezcTemplateSourceToTstErrorMessages::MSG_DEFAULT_LAST);
         }
         $this->children[] = $element;
         return true;
         // 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;
             } else {
                 $trimmedLength = strlen(ltrim($element->text));
                 $element->startCursor->advance(strlen($element->text) - $trimmedLength);
             }
         }
         throw new ezcTemplateParserException($element->source, $element->startCursor, $element->startCursor, ezcTemplateSourceToTstErrorMessages::MSG_EXPECT_CASE_STATEMENT);
     }
 }
Ejemplo n.º 2
0
 /**
  * Constructs a new ezcTemplateCycleControlTstNode.
  *
  * @param ezcTemplateSource $source
  * @param ezcTemplateCursor $start
  * @param ezcTemplateCursor $end
  */
 public function __construct(ezcTemplateSourceCode $source, $start, $end, $name = null)
 {
     parent::__construct($source, $start, $end);
     $this->name = $name;
     $this->variables = array();
     $this->isNestingBlock = false;
 }
Ejemplo n.º 3
0
 /**
  * Constructs a new ezcTemplateForeachLoopTstNode.
  *
  * @param ezcTemplateSource $source
  * @param ezcTemplateCursor $start
  * @param ezcTemplateCursor $end
  */
 public function __construct(ezcTemplateSourceCode $source, $start, $end)
 {
     parent::__construct($source, $start, $end);
     $this->context = null;
     $this->name = 'tr_context';
     $this->isNestingBlock = false;
 }
Ejemplo n.º 4
0
 /**
  * Constructs a new ezcTemplateDeclarationTstNode.
  *
  * @param ezcTemplateSource $source
  * @param ezcTemplateCursor $start
  * @param ezcTemplateCursor $end
  */
 public function __construct(ezcTemplateSourceCode $source, $start, $end)
 {
     parent::__construct($source, $start, $end);
     $this->type = "normal";
     $this->variable = null;
     $this->expression = null;
 }
Ejemplo n.º 5
0
 /**
  *
  * @param ezcTemplateSource $source
  * @param ezcTemplateCursor $start
  * @param ezcTemplateCursor $end
  */
 public function __construct(ezcTemplateSourceCode $source, $start, $end)
 {
     parent::__construct($source, $start, $end);
     $this->file = null;
     $this->send = array();
     $this->receive = array();
     $this->isNestingBlock = false;
 }
Ejemplo n.º 6
0
 /**
  *
  * @param ezcTemplateSource $source
  * @param ezcTemplateCursor $start
  * @param ezcTemplateCursor $end
  */
 public function __construct(ezcTemplateSourceCode $source, $start, $end)
 {
     parent::__construct($source, $start, $end);
     $this->startBracket = '{';
     $this->endBracket = '}';
     $this->expressionRoot = null;
     $this->isNestingBlock = false;
 }
Ejemplo n.º 7
0
 public function handleElement(ezcTemplateTstNode $element)
 {
     if ($this->canHandleElement($element)) {
         $this->children[] = $element;
         $element->parentBlock = $this;
     } else {
         parent::handleElement($element);
     }
 }
Ejemplo n.º 8
0
 /**
  * Constructs a new ezcTemplateForeachLoopTstNode.
  *
  * @param ezcTemplateSource $source
  * @param ezcTemplateCursor $start
  * @param ezcTemplateCursor $end
  */
 public function __construct(ezcTemplateSourceCode $source, $start, $end)
 {
     parent::__construct($source, $start, $end);
     $this->value = $this->keyVariableName = $this->itemVariableName = null;
     $this->name = 'foreach';
     $this->increment = array();
     $this->decrement = array();
     $this->offset = $this->limit = null;
 }
Ejemplo n.º 9
0
 public function handleElement(ezcTemplateTstNode $element)
 {
     parent::handleElement($element);
 }
Ejemplo n.º 10
0
 /**
  * Constructs a new custom block
  *
  * @param ezcTemplateSourceCode $source
  * @param ezcTemplateCursor $start
  * @param ezcTemplateCursor $end
  */
 public function __construct(ezcTemplateSourceCode $source, $start, $end)
 {
     parent::__construct($source, $start, $end);
     $this->customParameters = array();
 }
Ejemplo n.º 11
0
 /**
  */
 public function __construct(ezcTemplateSourceCode $source, $start, $end)
 {
     parent::__construct($source, $start, $end);
 }
Ejemplo n.º 12
0
 /**
  *
  * @param ezcTemplateSource $source
  * @param ezcTemplateCursor $start
  * @param ezcTemplateCursor $end
  */
 public function __construct(ezcTemplateSourceCode $source, $start, $end)
 {
     parent::__construct($source, $start, $end);
     $this->name = 'dynamic';
 }
Ejemplo n.º 13
0
 /**
  *
  * @param ezcTemplateSource $source
  * @param ezcTemplateCursor $start
  * @param ezcTemplateCursor $end
  */
 public function __construct(ezcTemplateSourceCode $source, $start, $end)
 {
     parent::__construct($source, $start, $end);
     $this->isNestingBlock = true;
 }
Ejemplo n.º 14
0
 /**
  * Trims away EOL whitespace for block lines for the specified block element.
  *
  * The parser will call the ezcTemplateBlockTstNode::trimLine() method
  * of the specified block object with the whitespace removal object passed
  * as parameter. This allows the block element to choose how to apply the trimming
  * process since it may have more than one child list.
  *
  * 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)
 {
     if (!$this->trimWhitespace) {
         return;
     }
     // Tell the block to trim its block line for any whitespace and EOL characters
     // by passign the object  which has defined the rules for trimming whitespace
     $block->trimLine($this->whitespaceRemoval);
 }