classPrimaryRule
final class PrimaryRule
Lowers the simple_expr level: names, literals, parameters, variables, calls and the prefix and postfix operators.
Rule: MYSQL-SIMPLE-EXPR-001. Scope: simple_expr, not2. COLLATE and the concatenation || of PIPES_AS_CONCAT are left recursive; the left spine is walked in a loop. A function-like form is handed to the call family, a name, literal, parameter or variable to the leaf rules, and the bracketed, subquery and keyword forms to MYSQL-SIMPLE-FORM-001 and MYSQL-CONSTRUCT-001. Under HIGH_NOT_PRECEDENCE the keyword NOT is the tight negation !. Constructs: Collated, Concatenation, Unary. Terminates: the spine loop descends one left child per step; every other child is a strict subtree. Source: https://dev.mysql.com/doc/refman/8.4/en/expressions.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
Lowers a node of simple_expr.
Parameters
$expression | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 3
- method-call SqlSemantics\Platform\MySql\Lowering\Expression\ExpressionRules::simpleExpression() packages/sql-semantics-mysql/src/Lowering/Expression/ExpressionRules.php:64
- method-call SqlSemantics\Platform\MySql\Lowering\Expression\PrimaryRule::simpleExpression() packages/sql-semantics-mysql/src/Lowering/Expression/PrimaryRule.php:90
- method-call SqlSemantics\Platform\MySql\Lowering\Expression\PrimaryRule::unit() packages/sql-semantics-mysql/src/Lowering/Expression/PrimaryRule.php:116
Calls 7
- method-call Lowering::form() line 82
- class-const PrimaryRule::POSTFIX() line 83
- method-call PrimaryRule::unit() line 87
- function-call
array_reverseline 88 - new Concatenation line 90
- method-call PrimaryRule::simpleExpression() line 90
- new Collated line 91
Lowers a simple_expr production that is not left recursive.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleTest cases 1
Called from 1
Calls 11
- class-const PrimaryRule::CALLS() line 104
- method-call Form::node() line 105
- class-const PrimaryRule::LEAVES() line 107
- method-call PrimaryRule::leaf() line 108
- class-const PrimaryRule::PREFIX() line 110
- class-const UnaryOperator::Not() line 112
- method-call PrimaryRule::negation() line 113
- new Unary line 116
- method-call PrimaryRule::simpleExpression() line 116
- method-call FormRule::lower() line 119
- new FormRule line 119
public function negation(Node $keyword): voidConfirms the tight negation keyword: !, or NOT under HIGH_NOT_PRECEDENCE.
Parameters
$keyword | Node |
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 2
- method-call Lowering::form() line 142
- static-call ImplementationGap::production() line 144
Private surface 5§
Implementation details, listed for orientation only.
private const CALLS = ['simple_expr: function_call_keyword' => true, 'simple_expr: function_call_nonk…private const LEAVES = ['simple_expr: simple_ident' => 'column', 'simple_expr: literal' => 'literal', …private const PREFIX = ['simple_expr: + simple_expr' => \SqlSemantics\Platform\MySql\Statement\Express…private const POSTFIX = ['simple_expr: simple_expr COLLATE_SYM ident_or_text' => true, 'simple_expr: si…private Lowering $loweringTest cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.