HumHub Documentation (unofficial)

ExpressionParser
in package

Parses expressions.

This parser implements a "Precedence climbing" algorithm.

Tags
see
https://www.engr.mun.ca/~theo/Misc/exp_parsing.htm
see
https://en.wikipedia.org/wiki/Operator-precedence_parser
author

Fabien Potencier fabien@symfony.com

Table of Contents

Constants

OPERATOR_LEFT  = 1
OPERATOR_RIGHT  = 2

Properties

$binaryOperators  : array<string, AbstractBinary>, associativity: self::OPERATOR_*}>
$env  : mixed
$parser  : mixed
$unaryOperators  : array<string, AbstractUnary>}>

Methods

__construct()  : mixed
getFunctionNode()  : mixed
parseArguments()  : Node
Parses arguments.
parseArrayExpression()  : mixed
parseAssignmentExpression()  : mixed
parseExpression()  : mixed
parseFilterExpression()  : mixed
parseFilterExpressionRaw()  : mixed
parseHashExpression()  : mixed
parseMultitargetExpression()  : mixed
parsePostfixExpression()  : mixed
parsePrimaryExpression()  : mixed
parseStringExpression()  : mixed
parseSubscriptExpression()  : mixed
checkConstantExpression()  : bool
getFilterNodeClass()  : string
getFunctionNodeClass()  : string
getPrimary()  : AbstractExpression
getTest()  : array<string|int, mixed>
getTestNodeClass()  : string
isBinary()  : bool
isUnary()  : bool
parseArrow()  : ArrowFunctionExpression|null
parseConditionalExpression()  : AbstractExpression
parseNotTestExpression()  : NotUnary
parseTestExpression()  : TestExpression

Constants

Properties

$binaryOperators

private array<string, AbstractBinary>, associativity: self::OPERATOR_*}> $binaryOperators

Methods

getFunctionNode()

public getFunctionNode(mixed $name, mixed $line) : mixed
Parameters
$name : mixed
$line : mixed

parseArguments()

Parses arguments.

public parseArguments([bool $namedArguments = false ][, bool $definition = false ][, mixed $allowArrow = false ]) : Node
Parameters
$namedArguments : bool = false

Whether to allow named arguments or not

$definition : bool = false

Whether we are parsing arguments for a function definition

$allowArrow : mixed = false
Tags
throws
SyntaxError
Return values
Node

parseExpression()

public parseExpression([mixed $precedence = 0 ][, mixed $allowArrow = false ]) : mixed
Parameters
$precedence : mixed = 0
$allowArrow : mixed = false

parseFilterExpression()

public parseFilterExpression(mixed $node) : mixed
Parameters
$node : mixed

parseFilterExpressionRaw()

public parseFilterExpressionRaw(mixed $node[, mixed $tag = null ]) : mixed
Parameters
$node : mixed
$tag : mixed = null

parseMultitargetExpression()

public parseMultitargetExpression() : mixed

parsePostfixExpression()

public parsePostfixExpression(mixed $node) : mixed
Parameters
$node : mixed

parseSubscriptExpression()

public parseSubscriptExpression(mixed $node) : mixed
Parameters
$node : mixed

checkConstantExpression()

private checkConstantExpression(Node $node) : bool
Parameters
$node : Node
Return values
bool

getFilterNodeClass()

private getFilterNodeClass(string $name, int $line) : string
Parameters
$name : string
$line : int
Return values
string

getFunctionNodeClass()

private getFunctionNodeClass(string $name, int $line) : string
Parameters
$name : string
$line : int
Return values
string

getTest()

private getTest(int $line) : array<string|int, mixed>
Parameters
$line : int
Return values
array<string|int, mixed>

        
On this page

Search results