ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
|
Lexes a template string. More...
Public Member Functions | |
__construct (Twig_Environment $env, array $options=array()) | |
tokenize ($code, $name=null) | |
Tokenizes a source code. More... | |
Data Fields | |
const | STATE_DATA = 0 |
const | STATE_BLOCK = 1 |
const | STATE_VAR = 2 |
const | STATE_STRING = 3 |
const | STATE_INTERPOLATION = 4 |
const | REGEX_NAME = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A' |
const | REGEX_NUMBER = '/[0-9]+(?:\.[0-9]+)?/A' |
const | REGEX_STRING = '/"([^#"\\\\]*(?:\\\\.[^#"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As' |
const | REGEX_DQ_STRING_DELIM = '/"/A' |
const | REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As' |
const | PUNCTUATION = '()[]{}?:.,|' |
Protected Member Functions | |
lexData () | |
lexBlock () | |
lexVar () | |
lexExpression () | |
lexRawData ($tag) | |
lexComment () | |
lexString () | |
lexInterpolation () | |
pushToken ($type, $value='') | |
moveCursor ($text) | |
getOperatorRegex () | |
pushState ($state) | |
popState () | |
Protected Attributes | |
$tokens | |
$code | |
$cursor | |
$lineno | |
$end | |
$state | |
$states | |
$brackets | |
$env | |
$filename | |
$options | |
$regexes | |
$position | |
$positions | |
$currentVarBlockLine | |
Private Attributes | |
$source | |
Twig_Lexer::__construct | ( | Twig_Environment | $env, |
array | $options = array() |
||
) |
Definition at line 52 of file Lexer.php.
References $env, $options, array, and getOperatorRegex().
|
protected |
Definition at line 381 of file Lexer.php.
Referenced by __construct().
|
protected |
Definition at line 209 of file Lexer.php.
References Twig_Token\BLOCK_END_TYPE, lexExpression(), moveCursor(), popState(), and pushToken().
Referenced by tokenize().
|
protected |
Definition at line 319 of file Lexer.php.
References moveCursor().
Referenced by lexData().
|
protected |
Definition at line 153 of file Lexer.php.
References $end, $lineno, $position, $text, Twig_Token\BLOCK_START_TYPE, lexComment(), lexRawData(), moveCursor(), pushState(), pushToken(), Twig_Token\TEXT_TYPE, and Twig_Token\VAR_START_TYPE.
Referenced by tokenize().
|
protected |
Definition at line 231 of file Lexer.php.
References $cursor, $lineno, array, moveCursor(), Twig_Token\NAME_TYPE, Twig_Token\NUMBER_TYPE, Twig_Token\OPERATOR_TYPE, Twig_Token\PUNCTUATION_TYPE, pushState(), pushToken(), and Twig_Token\STRING_TYPE.
Referenced by lexBlock(), lexInterpolation(), and lexVar().
|
protected |
Definition at line 352 of file Lexer.php.
References Twig_Token\INTERPOLATION_END_TYPE, lexExpression(), moveCursor(), popState(), and pushToken().
Referenced by tokenize().
|
protected |
Definition at line 299 of file Lexer.php.
References $tag, $text, moveCursor(), pushToken(), and Twig_Token\TEXT_TYPE.
Referenced by lexData().
|
protected |
Definition at line 328 of file Lexer.php.
References $cursor, $lineno, array, Twig_Token\INTERPOLATION_START_TYPE, moveCursor(), popState(), pushState(), pushToken(), and Twig_Token\STRING_TYPE.
Referenced by tokenize().
|
protected |
Definition at line 220 of file Lexer.php.
References lexExpression(), moveCursor(), popState(), pushToken(), and Twig_Token\VAR_END_TYPE.
Referenced by tokenize().
|
protected |
Definition at line 375 of file Lexer.php.
References $text.
Referenced by lexBlock(), lexComment(), lexData(), lexExpression(), lexInterpolation(), lexRawData(), lexString(), and lexVar().
|
protected |
Definition at line 417 of file Lexer.php.
Referenced by lexBlock(), lexInterpolation(), lexString(), and lexVar().
|
protected |
Definition at line 411 of file Lexer.php.
References $state.
Referenced by lexData(), lexExpression(), and lexString().
|
protected |
Definition at line 365 of file Lexer.php.
References $type, and Twig_Token\TEXT_TYPE.
Referenced by lexBlock(), lexData(), lexExpression(), lexInterpolation(), lexRawData(), lexString(), lexVar(), and tokenize().
Twig_Lexer::tokenize | ( | $code, | |
$name = null |
|||
) |
Tokenizes a source code.
string | Twig_Source | $code | The source code |
string | $name | A unique identifier for the source code |
Twig_Error_Syntax | When the code is syntactically wrong |
Implements Twig_LexerInterface.
Definition at line 78 of file Lexer.php.
References $code, $lineno, $name, array, Twig_Token\EOF_TYPE, lexBlock(), lexData(), lexInterpolation(), lexString(), lexVar(), and pushToken().
|
protected |
Definition at line 21 of file Lexer.php.
Referenced by tokenize().
|
protected |
Definition at line 22 of file Lexer.php.
Referenced by lexExpression(), and lexString().
|
protected |
Definition at line 28 of file Lexer.php.
Referenced by __construct().
|
protected |
Definition at line 23 of file Lexer.php.
Referenced by lexData(), lexExpression(), lexString(), and tokenize().
|
protected |
Definition at line 31 of file Lexer.php.
Referenced by __construct().
|
protected |
Definition at line 25 of file Lexer.php.
Referenced by pushState().
const Twig_Lexer::REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As' |
const Twig_Lexer::REGEX_NAME = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A' |
Definition at line 45 of file Lexer.php.
Referenced by Twig_ExpressionParser\parsePrimaryExpression(), and Twig_ExpressionParser\parseSubscriptExpression().
const Twig_Lexer::REGEX_STRING = '/"([^#"\\\\]*(?:\\\\.[^#"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As' |