1 | <?php |
||
14 | class XlsHeaderTokenParser extends AbstractTokenParser |
||
15 | { |
||
16 | /** |
||
17 | * @param Twig_Token $token |
||
18 | * |
||
19 | * @return XlsHeaderNode |
||
20 | * @throws \Twig_Error_Syntax |
||
21 | */ |
||
22 | public function parse(Twig_Token $token) |
||
23 | { |
||
24 | // parse attributes |
||
25 | $type = new Twig_Node_Expression_Constant('header', $token->getLine()); |
||
26 | if (!$this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE) && !$this->parser->getStream()->test(Twig_Token::BLOCK_END_TYPE)) { |
||
27 | $type = $this->parser->getExpressionParser()->parseExpression(); |
||
28 | } |
||
29 | $properties = $this->parseProperties($token); |
||
30 | $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); |
||
31 | |||
32 | // parse body |
||
33 | $body = $this->parseBody(); |
||
34 | |||
35 | // return node |
||
36 | return new XlsHeaderNode($type, $properties, $body, $token->getLine(), $this->getTag()); |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @return string |
||
41 | */ |
||
42 | public function getTag() |
||
46 | } |
||
47 |