private function processHtmlTagBegin(Token $token)
{
if ($token->closing) {
while ($this->htmlNode) {
if (strcasecmp($this->htmlNode->name, $token->name) === 0) {
break;
}
if ($this->htmlNode->macroAttrs) {
throw new CompileException("Unexpected </{$token->name}>, expecting " . self::printEndTag($this->htmlNode));
}
$this->htmlNode = $this->htmlNode->parentNode;
}
if (!$this->htmlNode) {
$this->htmlNode = new HtmlNode($token->name);
}
$this->htmlNode->closing = TRUE;
$this->htmlNode->endLine = $this->getLine();
$this->context = self::CONTEXT_HTML_TEXT;
} elseif ($token->text === '<!--') {
$this->context = self::CONTEXT_HTML_COMMENT;
} elseif ($token->text === '<?' || $token->text === '<!') {
$this->context = self::CONTEXT_HTML_BOGUS_COMMENT;
$this->output .= $token->text === '<?' ? '<<?php ?>?' : '<!';
// bypass error in escape()
return;
} else {
$this->htmlNode = new HtmlNode($token->name, $this->htmlNode);
$this->htmlNode->startLine = $this->getLine();
$this->context = self::CONTEXT_HTML_TAG;
}
$this->tagOffset = strlen($this->output);
$this->output .= $token->text;
}