function yylex()
{
$this->token = NULL;
if ($this->length == $this->N) {
if ($this->status != self::IN_NONE && $this->status != self::IN_HTML) {
$this->Error("Unexpected end");
}
return FALSE;
}
if ($this->status == self::IN_NONE) {
$i =& $this->N;
$data = substr($this->data, $i, 12);
static $lencache = array();
foreach ($this->open_tags as $value => $token) {
if (!isset($lencache[$value])) {
$lencache[$value] = strlen($value);
}
$len = $lencache[$value];
if (strncmp($data, $value, $len) == 0) {
$this->value = $value;
$this->token = $token;
$i += $len;
switch ($this->token) {
case HG_Parser::T_TAG_OPEN:
$this->status = self::IN_TAG;
break;
case HG_Parser::T_COMMENT:
$zdata =& $this->data;
if (($pos = strpos($zdata, self::$end_comment, $i)) === FALSE) {
$this->error("unexpected end");
}
$this->value = substr($zdata, $i, $pos - 2);
$this->status = self::IN_NONE;
$i = $pos + 2;
break;
case HG_Parser::T_PRINT_OPEN:
$this->status = self::IN_ECHO;
$this->echoFirstToken = false;
break;
}
return TRUE;
}
}
$this->status = self::IN_HTML;
}
switch ($this->status) {
case self::IN_TAG:
case self::IN_ECHO:
$this->yylex_main();
break;
default:
$this->yylex_html();
}
if (empty($this->token)) {
if ($this->status != self::IN_NONE && $this->status != self::IN_HTML) {
$this->Error("Unexpected end");
}
return FALSE;
}
return TRUE;
}