ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
TestTokenParser Class Reference
+ Inheritance diagram for TestTokenParser:
+ Collaboration diagram for TestTokenParser:

Public Member Functions

 parse (Twig_Token $token)
 Parses a token and returns a node. More...
 
 getTag ()
 Gets the tag name associated with this token parser. More...
 
- Public Member Functions inherited from Twig_TokenParser
 setParser (Twig_Parser $parser)
 Sets the parser associated with this token parser. More...
 
 setParser (Twig_Parser $parser)
 Sets the parser associated with this token parser. More...
 
 parse (Twig_Token $token)
 Parses a token and returns a node. More...
 
 getTag ()
 Gets the tag name associated with this token parser. More...
 

Additional Inherited Members

- Protected Attributes inherited from Twig_TokenParser
 $parser
 

Detailed Description

Definition at line 176 of file ParserTest.php.

Member Function Documentation

◆ getTag()

TestTokenParser::getTag ( )

Gets the tag name associated with this token parser.

Returns
string The tag name

Implements Twig_TokenParserInterface.

Definition at line 194 of file ParserTest.php.

195 {
196 return 'test';
197 }

◆ parse()

TestTokenParser::parse ( Twig_Token  $token)

Parses a token and returns a node.

Returns
Twig_NodeInterface
Exceptions
Twig_Error_Syntax

Implements Twig_TokenParserInterface.

Definition at line 178 of file ParserTest.php.

179 {
180 // simulate the parsing of another template right in the middle of the parsing of the current template
181 $this->parser->parse(new Twig_TokenStream(array(
183 new Twig_Token(Twig_Token::NAME_TYPE, 'extends', 1),
184 new Twig_Token(Twig_Token::STRING_TYPE, 'base', 1),
187 )));
188
189 $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
190
191 return new Twig_Node(array());
192 }
Represents a node in the AST.
Definition: Node.php:19
Represents a token stream.
Definition: TokenStream.php:21
Represents a Token.
Definition: Token.php:21
const BLOCK_END_TYPE
Definition: Token.php:30
const EOF_TYPE
Definition: Token.php:26
const BLOCK_START_TYPE
Definition: Token.php:28
const NAME_TYPE
Definition: Token.php:32
const STRING_TYPE
Definition: Token.php:34

References Twig_Token\BLOCK_END_TYPE, Twig_Token\BLOCK_START_TYPE, Twig_Token\EOF_TYPE, Twig_Token\NAME_TYPE, and Twig_Token\STRING_TYPE.


The documentation for this class was generated from the following file: