Beispiel #1
0
 private function processTag($tag)
 {
     //Try to find the tag name
     preg_match('/(\\S*)(?:\\s*(.*|))$/ADs', $tag, $parts);
     list(, $tagName, $expression) = $parts;
     //If the tag name is unknown, try to use the fallback
     if (isset(self::$closingTags[$tagName])) {
         $tagName = self::$closingTags[$tagName];
     } elseif (!self::$environment->hasTag($tagName)) {
         $tagName = self::$fallbackTagName;
         $expression = $tag;
     }
     $this->pushToken(Token::TAG_START, $tagName);
     self::$expressionTokenizer->setLine($this->line);
     $stream = self::$expressionTokenizer->tokenize($expression);
     while (!$stream->next()->test(Token::EOF)) {
         $this->tokenBuffer[] = $stream->current();
     }
     $this->line = $stream->current()->getLine();
     $this->pushToken(Token::TAG_END, $tagName);
 }
Beispiel #2
0
 /**
  * @return Token
  */
 public function next()
 {
     $this->current = $this->next;
     $this->next = $this->tokenizer->nextToken();
     return $this->current;
 }