36 $stream = $this->parser->getStream();
37 $names = $this->parser->getExpressionParser()->parseAssignmentExpression();
41 $values = $this->parser->getExpressionParser()->parseMultitargetExpression();
45 if (count(
$names) !== count($values)) {
46 throw new Twig_Error_Syntax(
'When using set, you must have the same number of variables and assignments.',
$stream->getCurrent()->getLine(),
$stream->getSourceContext());
52 throw new Twig_Error_Syntax(
'When using set with a block, you cannot have a multi-target.',
$stream->getCurrent()->getLine(),
$stream->getSourceContext());
57 $values = $this->parser->subparse(
array($this,
'decideBlockEnd'),
true);
66 return $token->
test(
'endset');
75 class_alias(
'Twig_TokenParser_Set',
'Twig\TokenParser\SetTokenParser',
false);
test($type, $values=null)
Tests the current token for a type and/or a value.
getTag()
Gets the tag name associated with this token parser.
$stream
PHP stream implementation.
Exception thrown when a syntax error occurs during lexing or parsing of a template.
Base class for all token parsers.
decideBlockEnd(Twig_Token $token)
parse(Twig_Token $token)
Parses a token and returns a node.
Create styles array
The data for the language used.