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 SymbolNone

Properties

$stream
$text

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.

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

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

No description

Details

at line 40
__construct(array $tokens)

No description

Parameters

array $tokens

at line 51
ExpressionNode parseExpression()

Parses PHP-like expression.

Return Value

ExpressionNode

at line 60
ArrayNode parseArguments()

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

Return Value

ArrayNode

at line 69
ModifierNode parseModifier()

Parses optional list of filters.

Return Value

ModifierNode

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

Parses unquoted string or PHP-like expression.

Parameters

bool $colon

Return Value

ExpressionNode

at line 103
SuperiorTypeNode|null parseType()

Parses optional type declaration.

Return Value

SuperiorTypeNode|null

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

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

Parameters

string ...$kind

Return Value

Token|null

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

deprecated use tryConsumeTokenBeforeUnquotedString()

No description

Parameters

string ...$kind

Return Value

Token|null

at line 139
bool isEnd()

No description

Return Value

bool

at line 275
throwReservedKeywordException(Token $token)

No description

Parameters

Token $token

at line 281
protected ExpressionNode checkFunctionName(FunctionCallableNode $func)

No description

Parameters

FunctionCallableNode $func

Return Value

ExpressionNode

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

No description

Parameters

NameNode $name

Return Value

IdentifierNode

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

No description

Parameters

string $str
Position $position

Return Value

IntegerNode

at line 322
protected EncapsedStringNode 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

EncapsedStringNode

Traits

Better OOP experience.