classWeightRule
final class WeightRule
Lowers WEIGHT_STRING with its cast, its LEVEL clause of MySQL 5.6 and 5.7, and its internal form.
Rule: MYSQL-CALL-WEIGHT-001. Scope: the WEIGHT_STRING alternatives of function_call_conflict, ws_nweights, ws_num_codepoints, opt_ws_levels, ws_level_list_or_range, ws_level_list, ws_level_list_item, ws_level_range, ws_level_number, ws_level_flags, ws_level_flag_desc, ws_level_flag_reverse. Constructs: WeightString, WeightStringParameters, WeightLevel, WeightLevelRange. Terminates: the level list is flattened in a loop; every other child is a strict subtree. Source: https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_weight-string, https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_weight-string. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
public function claims(string $signature): boolTells whether a production is one of this rule.
Parameters
$signature | string |
Returns
boolTest cases 1
Called from 1
Calls 2
- class-const WeightRule::CASTS() line 69
- function-call
in_arrayline 69
Lowers a production this rule claims.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 2
Called from 1
Calls 8
- method-call Form::node() line 82
- class-const WeightRule::CASTS() line 83
- method-call WeightRule::length() line 85
- function-call
countline 86 - method-call WeightRule::levels() line 86
- new WeightString line 88
- new WeightStringParameters line 95
- static-call ImplementationGap::production() line 101
Lowers the length of the cast: a node of ws_nweights or ws_num_codepoints.
Parameters
$length | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 2
- method-call Lowering::form() line 112
- static-call ImplementationGap::production() line 114
public function levels(Node $clause): array{list<WeightLevel>, WeightLevelRange|null}Lowers the optional LEVEL clause: a node of opt_ws_levels.
Parameters
$clause | Node |
Returns
array{list<WeightLevel>, WeightLevelRange|null}Throws
ImplementationGap When a production has no ruleTest cases 1
Called from 2
Calls 7
- method-call Lowering::form() line 128
- static-call ImplementationGap::production() line 133
- new WeightLevelRange line 140
- method-call WeightRule::number() line 140
- method-call Lists::items() line 148
- new Lists line 148
- method-call WeightRule::level() line 149
public function level(Node $item): WeightLevelLowers one level with its flags: a node of ws_level_list_item.
Parameters
$item | Node |
Returns
Throws
ImplementationGap When a production has no ruleTest cases 1
Called from 1
Calls 7
- method-call Lowering::form() line 162
- class-const WeightRule::FLAGS() line 165
- static-call ImplementationGap::production() line 165
- function-call
countline 167 - new WeightLevel line 170
- method-call WeightRule::number() line 170
- method-call WeightRule::direction() line 170
Lowers the ASC or DESC flag of a level: a node of ws_level_flag_desc.
Parameters
$flag | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 4
- method-call Lowering::form() line 180
- class-const Direction::Ascending() line 183
- class-const Direction::Descending() line 184
- static-call ImplementationGap::production() line 185
Lowers a level number: a node of ws_level_number.
Parameters
$number | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 2
Calls 1
- method-call Lowering::form() line 196
Private surface 3§
Implementation details, listed for orientation only.
private const CASTS = ['function_call_conflict: WEIGHT_STRING_SYM ( expr AS CHAR_SYM ws_nweights opt_…private const FLAGS = ['ws_level_flags:' => [null, false], 'ws_level_flags: ws_level_flag_desc' => [t…private Lowering $loweringTest cases 8§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 8
WeightRuleTest::testCallLowersEveryFormcallsWeightRuleTest::testCallReportsAProductionOutsideTheRulecallsWeightRuleTest::testClaimsTellsTheProductionsOfTheRulecallsWeightRuleTest::testDirectionLowersAscendingcallsWeightRuleTest::testLengthLowersTheLengthOfTheCastcallsWeightRuleTest::testLevelLowersTheFlagscallsWeightRuleTest::testLevelsLowersARangecallsWeightRuleTest::testNumberLowersALevelNumbercalls