ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SimpleTokenParser Class Reference
+ Inheritance diagram for SimpleTokenParser:
+ Collaboration diagram for SimpleTokenParser:

Public Member Functions

 __construct ($tag, $grammar)
 
 getGrammar ()
 
 getTag ()
 Gets the tag name associated with this token parser. More...
 
 getNode (array $values, $line)
 
- Public Member Functions inherited from Twig_Extensions_SimpleTokenParser
 parse (Twig_Token $token)
 Parses a token and returns a node. More...
 
- Public Member Functions inherited from Twig_TokenParser
 setParser (Twig_Parser $parser)
 Sets the parser associated with this token parser. More...
 

Protected Attributes

 $tag
 
 $grammar
 
- Protected Attributes inherited from Twig_TokenParser
 $parser
 

Additional Inherited Members

- Static Public Member Functions inherited from Twig_Extensions_SimpleTokenParser
static parseGrammar ($str, $main=true)
 
- Protected Member Functions inherited from Twig_Extensions_SimpleTokenParser
 getGrammar ()
 Gets the grammar as an object or as a string. More...
 
 getNode (array $values, $line)
 Gets the nodes based on the parsed values. More...
 
 getAttribute ($node, $attribute, $arguments=array(), $type=Twig_Node_Expression_GetAttr::TYPE_ANY, $line=-1)
 
 call ($node, $attribute, $arguments=array(), $line=-1)
 
 markAsSafe (Twig_Node $node, $line=-1)
 
 output (Twig_Node $node, $line=-1)
 
 getNodeValues (array $values)
 

Detailed Description

Definition at line 12 of file SimpleTokenParser.php.

Constructor & Destructor Documentation

◆ __construct()

SimpleTokenParser::__construct (   $tag,
  $grammar 
)

Definition at line 17 of file SimpleTokenParser.php.

References $grammar, and $tag.

18  {
19  $this->tag = $tag;
20  $this->grammar = $grammar;
21  }

Member Function Documentation

◆ getGrammar()

SimpleTokenParser::getGrammar ( )

Definition at line 23 of file SimpleTokenParser.php.

References $grammar.

24  {
25  return $this->grammar;
26  }

◆ getNode()

SimpleTokenParser::getNode ( array  $values,
  $line 
)

Definition at line 33 of file SimpleTokenParser.php.

References array.

34  {
35  $nodes = array();
36  $nodes[] = new Twig_Node_Print(new Twig_Node_Expression_Constant('|', $line), $line);
37  foreach ($values as $value) {
38  if ($value instanceof Twig_Node) {
39  if ($value instanceof Twig_Node_Expression_Array) {
40  $nodes[] = new Twig_Node_Print(new Twig_Node_Expression_Function('dump', $value, $line), $line);
41  } else {
42  $nodes[] = new Twig_Node_Print($value, $line);
43  }
44  } else {
45  $nodes[] = new Twig_Node_Print(new Twig_Node_Expression_Constant($value, $line), $line);
46  }
47  $nodes[] = new Twig_Node_Print(new Twig_Node_Expression_Constant('|', $line), $line);
48  }
49 
50  return new Twig_Node($nodes);
51  }
Represents a node in the AST.
Definition: Node.php:18
Represents a node that outputs an expression.
Definition: Print.php:18
Create styles array
The data for the language used.

◆ getTag()

SimpleTokenParser::getTag ( )

Gets the tag name associated with this token parser.

Returns
string The tag name

Implements Twig_TokenParserInterface.

Definition at line 28 of file SimpleTokenParser.php.

References $tag.

29  {
30  return $this->tag;
31  }

Field Documentation

◆ $grammar

SimpleTokenParser::$grammar
protected

Definition at line 15 of file SimpleTokenParser.php.

Referenced by __construct(), and getGrammar().

◆ $tag

SimpleTokenParser::$tag
protected

Definition at line 14 of file SimpleTokenParser.php.

Referenced by __construct(), and getTag().


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