41 $stream = $this->parser->getStream();
42 $names = $this->parser->getExpressionParser()->parseAssignmentExpression();
47 $values = $this->parser->getExpressionParser()->parseMultitargetExpression();
51 if (count($names) !== count($values)) {
52 throw new Twig_Error_Syntax(
"When using set, you must have the same number of variables and assignments.", $stream->getCurrent()->getLine(), $stream->getFilename());
57 if (count($names) > 1) {
58 throw new Twig_Error_Syntax(
"When using set with a block, you cannot have a multi-target.", $stream->getCurrent()->getLine(), $stream->getFilename());
63 $values = $this->parser->subparse(array($this,
'decideBlockEnd'),
true);
72 return $token->
test(
'endset');
Base class for all token parsers.
Exception thrown when a syntax error occurs during lexing or parsing of a template.
test($type, $values=null)
Tests the current token for a type and/or a value.
decideBlockEnd(Twig_Token $token)
getTag()
Gets the tag name associated with this token parser.
parse(Twig_Token $token)
Parses a token and returns a node.