classOptionRule
final class OptionRule
Lowers the optional keywords, synonym keywords and empty marker rules that several statement families share.
Rule: MYSQL-OPTION-001. Scope: opt_as, opt_if_not_exists, if_exists, opt_temporary, opt_ignore, opt_all, opt_default, opt_equal, equal, opt_wild, opt_storage, opt_table, opt_comma, optional_braces, opt_no_write_to_binlog, opt_key_or_index, key_or_index, keys_or_index, table_or_tables, not, charset, character_set, opt_restrict, and the empty marker rules remember_name, remember_end, init_lex_create_info, clear_privileges, clear_password_expire_options, get_select_lex, subselect_start, subselect_end, have_partitioning, init_key_options, sp_init_param, no_definer and empty_select_options. An optional keyword lowers to whether it is written; RESTRICT and CASCADE to the keyword written. A synonym or marker rule holds no operand: skip() confirms the production is one of them. Which of the keywords are noise or synonyms for the token correspondence is stated in LeafNoise. Terminates: constant work. Source: the statement pages cited in LeafNoise. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
public function present(Node $option): boolTells whether an optional keyword is written.
Parameters
$option | Node |
Returns
boolThrows
ImplementationGap When the production has no ruleTest cases 2
Calls 2
- class-const OptionRule::PRESENT() line 79
- static-call ImplementationGap::production() line 79
public function skip(Node $inert): voidConfirms that a node is a synonym keyword or an empty marker and holds no operand.
Parameters
$inert | Node |
Throws
ImplementationGap When the production has no ruleTest cases 1
Calls 2
- class-const OptionRule::INERT() line 90
- static-call ImplementationGap::production() line 91
public function dropBehavior(Node $behavior): ?DropBehaviorLowers the optional RESTRICT or CASCADE keyword of a DROP.
Parameters
$behavior | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Calls 3
- class-const DropBehavior::Restrict() line 106
- class-const DropBehavior::Cascade() line 107
- static-call ImplementationGap::production() line 108
Private surface 3§
Implementation details, listed for orientation only.
private const PRESENT = ['opt_as:' => false, 'opt_as: AS' => true, 'opt_if_not_exists:' => false, 'opt_…private const INERT = ['key_or_index: KEY_SYM' => true, 'key_or_index: INDEX_SYM' => true, 'keys_or_i…private Lowering $loweringTest cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.