function &parse() { $until = func_get_args(); $nodelist = new NodeList($this); while ($token = $this->tokenstream->next()) { //$token = $this->tokenstream->current(); switch ($token->type) { case 'text': $node = new TextNode($token->content, $token->position); break; case 'variable': $args = H2o_Parser::parseArguments($token->content, $token->position); $variable = array_shift($args); $filters = $args; $node = new VariableNode($variable, $filters, $token->position); break; case 'comment': $node = new CommentNode($token->content); break; case 'block': if (in_array($token->content, $until)) { $this->token = $token; return $nodelist; } $temp = preg_split('/\\s+/', $token->content, 2); $name = $temp[0]; $args = count($temp) > 1 ? $temp[1] : null; $node = H2o::createTag($name, $args, $this, $token->position); $this->token = $token; } $this->searching = join(',', $until); $this->first = false; $nodelist->append($node); } if ($until) { throw new TemplateSyntaxError('Unclose tag, expecting ' . $until[0]); } return $nodelist; }