final class TagParser extends TagParserData

Parser for PHP-like expression language used in tags.

Based on works by Nikita Popov, Moriyoshi Koizumi and Masato Bito.

Constants

private SchemaExpression

private SchemaArguments

private SchemaFilters

private SchemaForeach

private SymbolNone

Properties

$stream
$text
protected ArrayNode> $shortArrays

Methods

__construct(array $tokens)

No description

parseExpression()

Parses PHP-like expression.

parseArguments()

Parses optional list of arguments. Named and variadic arguments are also supported.

parseModifier()

Parses optional list of filters.

parseUnquotedStringOrExpression(bool $colon = true)

Parses unquoted string or PHP-like expression.

SuperiorTypeNode|null
parseType()

Parses optional type declaration.

array
parseForeach()

Parses variables used in foreach.

Token|null
tryConsumeTokenBeforeUnquotedString(string ...$kind)

Consumes optional token followed by whitespace. Suitable before parseUnquotedStringOrExpression().

Token|null
tryConsumeModifier(string ...$kind) deprecated

No description

bool
isEnd()

No description

throwReservedKeywordException(Token $token)

No description

checkFunctionName(FunctionCallableNode $func)

No description

static IdentifierNode
handleBuiltinTypes(NameNode $name)

No description

static IntegerNode
parseOffset(string $str, Position $position)

No description

InterpolatedStringNode
parseDocString(string $startToken, array $parts, string $endToken, Position $startPos, Position $endPos)

No description

convertArrayToList(ArrayNode $array)

No description

Details

at line 43
__construct(array $tokens)

No description

Parameters

array $tokens

at line 54
ExpressionNode parseExpression()

Parses PHP-like expression.

Return Value

ExpressionNode

at line 63
ArrayNode parseArguments()

Parses optional list of arguments. Named and variadic arguments are also supported.

Return Value

ArrayNode

at line 72
ModifierNode parseModifier()

Parses optional list of filters.

Return Value

ModifierNode

at line 83
ExpressionNode parseUnquotedStringOrExpression(bool $colon = true)

Parses unquoted string or PHP-like expression.

Parameters

bool $colon

Return Value

ExpressionNode

at line 106
SuperiorTypeNode|null parseType()

Parses optional type declaration.

Return Value

SuperiorTypeNode|null

at line 126
array parseForeach()

internal  
 

Parses variables used in foreach.

Return Value

array

at line 135
Token|null tryConsumeTokenBeforeUnquotedString(string ...$kind)

Consumes optional token followed by whitespace. Suitable before parseUnquotedStringOrExpression().

Parameters

string ...$kind

Return Value

Token|null

at line 146
Token|null tryConsumeModifier(string ...$kind) deprecated

deprecated use tryConsumeTokenBeforeUnquotedString()

No description

Parameters

string ...$kind

Return Value

Token|null

at line 152
bool isEnd()

No description

Return Value

bool

at line 290
throwReservedKeywordException(Token $token)

No description

Parameters

Token $token

at line 296
protected ExpressionNode checkFunctionName(FunctionCallableNode $func)

No description

Parameters

FunctionCallableNode $func

Return Value

ExpressionNode

at line 307
static protected IdentifierNode handleBuiltinTypes(NameNode $name)

No description

Parameters

NameNode $name

Return Value

IdentifierNode

at line 321
static protected IntegerNode parseOffset(string $str, Position $position)

No description

Parameters

string $str
Position $position

Return Value

IntegerNode

at line 337
protected InterpolatedStringNode parseDocString(string $startToken, array $parts, string $endToken, Position $startPos, Position $endPos)

No description

Parameters

string $startToken
array $parts
string $endToken
Position $startPos
Position $endPos

Return Value

InterpolatedStringNode

at line 425
ListNode convertArrayToList(ArrayNode $array)

No description

Parameters

ArrayNode $array

Return Value

ListNode