classExpressionRule
final class ExpressionRule
Lowers expression productions into scalar structure.
Rule: SQLITE-EXPR-001. Scope: expr (the forms that are no operator and no function call), exprlist, nexprlist, paren_exprlist, where_opt, case_operand, case_exprlist, case_else. Operands keep their written order and every parenthesis pair is kept as a grouping, so the structure states the evaluation order the parser chose. An unqualified word is a column use, a double-quoted word or a truth word by how it is written (SQLITE-DOUBLE-QUOTED-WORD-001, SQLITE-TRUTH-WORD-001). Terminates: every operand is a strict subtree and lists are flattened iteratively. Source: https://sqlite.org/lang_expr.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
Calls 1
- new OperatorRule line 54
Lowers one expression.
Parameters
$expression | Node |
Returns
Called from 10
- method-call SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::expression() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:67
- method-call SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::expression() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:72
- method-call SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::expression() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:73
- method-call SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::expression() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:74
- method-call SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::expression() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:79
- method-call SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::conditional() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:147
- method-call SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::conditional() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:151
- method-call SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::conditional() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:153
- method-call SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::items() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:188
- method-call SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::where() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:222
Calls 17
- method-call ExpressionRule::term() line 66
- new Grouped line 67
- method-call ExpressionRule::expression() line 67
- method-call ExpressionRule::word() line 68
- method-call ExpressionRule::column() line 69
- method-call ExpressionRule::parameter() line 71
- new Collate line 72
- new Cast line 73
- new RowExpression line 74
- method-call ExpressionRule::items() line 74
- new ScalarSubquery line 75
- new Exists line 76
- method-call ExpressionRule::conditional() line 77
- new Raise line 78
- class-const RaiseAction::Ignore() line 78
- static-call RaiseAction::from() line 79
- method-call OperatorRule::expression() line 80
Lowers an unqualified word by how it is written: in double quotes, as bare TRUE or FALSE, or as any other name.
Parameters
$token | Token |
Returns
Called from 1
Lowers a qualified column use from its name nodes: the column, the table and the optional schema.
Returns
Called from 2
- method-call SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::expression() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:69
- method-call SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::expression() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:70
Calls 2
- new ColumnUse line 119
- new QualifiedName line 119
public function parameter(Token $token): BindParameterLowers a bind parameter token and records it as an operand leaf.
Parameters
$token | Token |
Returns
Called from 1
Calls 3
- new BindParameter line 127
- static-call ParameterPrefix::from() line 127
- function-call
substrline 127
public function conditional(Node $operand, Node $branches, Node $otherwise): CaseExpressionLowers a CASE expression from its operand, branches and ELSE part.
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 8
- function-call
in_arrayline 141 - static-call ImplementationGap::production() line 142
- method-call Lists::items() line 144
- new Lists line 144
- function-call
countline 146 - new CaseBranch line 147
- method-call ExpressionRule::expression() line 147
- new CaseExpression line 150
public function list(Node $exprlist): list<Scalar>Lowers an exprlist into its expressions in written order.
Parameters
$exprlist | Node |
Returns
list<Scalar>Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 2
- method-call ExpressionRule::items() line 169
- static-call ImplementationGap::production() line 170
public function items(Node $nexprlist): list<Scalar>Lowers a nexprlist into its expressions in written order.
Parameters
$nexprlist | Node |
Returns
list<Scalar>Throws
ImplementationGap When the production has no ruleCalled from 2
- method-call SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::expression() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:74
- method-call SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::list() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:169
Calls 4
- static-call ImplementationGap::production() line 184
- method-call Lists::items() line 187
- new Lists line 187
- method-call ExpressionRule::expression() line 188
public function optionalList(Node $list): list<Scalar>|nullLowers a paren_exprlist: the expressions, or null when no parentheses are written.
Parameters
$list | Node |
Returns
list<Scalar>|nullThrows
ImplementationGap When the production has no ruleCalls 2
- method-call ExpressionRule::list() line 206
- static-call ImplementationGap::production() line 207
Lowers a where_opt: the predicate, or null when the clause is absent.
Parameters
$where | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalls 2
- method-call ExpressionRule::expression() line 222
- static-call ImplementationGap::production() line 223
Private surface 2§
Implementation details, listed for orientation only.
private OperatorRule $operatorsprivate Lowering $loweringTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
ExpressionRuleTestcalls