*/
class Twig_TokenParser_AutoEscape extends Twig_TokenParser
{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
public function parse(Twig_Token $token)
{
$lineno = $token->getLine();
return $token->test('endautoescape');
}
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @param string The tag name
+ */
public function getTag()
{
return 'autoescape';
*/
class Twig_TokenParser_Block extends Twig_TokenParser
{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
public function parse(Twig_Token $token)
{
$lineno = $token->getLine();
return $token->test('endblock');
}
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @param string The tag name
+ */
public function getTag()
{
return 'block';
*/
class Twig_TokenParser_Debug extends Twig_TokenParser
{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
public function parse(Twig_Token $token)
{
$lineno = $token->getLine();
return new Twig_Node_Debug($expr, $lineno, $this->getTag());
}
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @param string The tag name
+ */
public function getTag()
{
return 'debug';
*/
class Twig_TokenParser_Display extends Twig_TokenParser
{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
public function parse(Twig_Token $token)
{
$lineno = $token->getLine();
return new Twig_Node_BlockReference($name, $lineno, $this->getTag());
}
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @param string The tag name
+ */
public function getTag()
{
return 'display';
*/
class Twig_TokenParser_Extends extends Twig_TokenParser
{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
public function parse(Twig_Token $token)
{
if (null !== $this->parser->getParent()) {
return null;
}
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @param string The tag name
+ */
public function getTag()
{
return 'extends';
*/
class Twig_TokenParser_Filter extends Twig_TokenParser
{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
public function parse(Twig_Token $token)
{
$filters = $this->parser->getExpressionParser()->parseFilterExpressionRaw();
return $token->test('endfilter');
}
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @param string The tag name
+ */
public function getTag()
{
return 'filter';
*/
class Twig_TokenParser_For extends Twig_TokenParser
{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
public function parse(Twig_Token $token)
{
$lineno = $token->getLine();
return $token->test('endfor');
}
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @param string The tag name
+ */
public function getTag()
{
return 'for';
*/
class Twig_TokenParser_If extends Twig_TokenParser
{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
public function parse(Twig_Token $token)
{
$lineno = $token->getLine();
return $token->test(array('endif'));
}
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @param string The tag name
+ */
public function getTag()
{
return 'if';
*/
class Twig_TokenParser_Import extends Twig_TokenParser
{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
public function parse(Twig_Token $token)
{
$macro = $this->parser->getExpressionParser()->parseExpression();
return new Twig_Node_Import($macro, $var, $token->getLine(), $this->getTag());
}
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @param string The tag name
+ */
public function getTag()
{
return 'import';
*/
class Twig_TokenParser_Include extends Twig_TokenParser
{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
public function parse(Twig_Token $token)
{
$expr = $this->parser->getExpressionParser()->parseExpression();
return new Twig_Node_Include($expr, $variables, $token->getLine(), $this->getTag());
}
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @param string The tag name
+ */
public function getTag()
{
return 'include';
*/
class Twig_TokenParser_Macro extends Twig_TokenParser
{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
public function parse(Twig_Token $token)
{
$lineno = $token->getLine();
return $token->test('endmacro');
}
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @param string The tag name
+ */
public function getTag()
{
return 'macro';
*/
class Twig_TokenParser_Parent extends Twig_TokenParser
{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
public function parse(Twig_Token $token)
{
if (!count($this->parser->getBlockStack())) {
return new Twig_Node_Parent($this->parser->peekBlockStack(), $token->getLine(), $this->getTag());
}
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @param string The tag name
+ */
public function getTag()
{
return 'parent';
*/
class Twig_TokenParser_Sandbox extends Twig_TokenParser
{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
public function parse(Twig_Token $token)
{
$this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
return $token->test('endsandbox');
}
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @param string The tag name
+ */
public function getTag()
{
return 'sandbox';
*/
class Twig_TokenParser_Set extends Twig_TokenParser
{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
public function parse(Twig_Token $token)
{
$lineno = $token->getLine();
return $token->test('endset');
}
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @param string The tag name
+ */
public function getTag()
{
return 'set';
*/
class Twig_TokenParser_Trans extends Twig_TokenParser
{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
public function parse(Twig_Token $token)
{
$lineno = $token->getLine();
return $token->test('endtrans');
}
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @param string The tag name
+ */
public function getTag()
{
return 'trans';
{
public function setParser(Twig_Parser $parser);
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
public function parse(Twig_Token $token);
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @param string The tag name
+ */
public function getTag();
}