classActionCode
final class ActionCode
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
The integer encoding of one parse-table action.
A shift or goto is the target state, zero or more. A reduce is the rule negated and shifted by one, so reducing by rule zero, the accept, is minus one. The smallest 32-bit integer marks a token the state rejects outright.
Constants§
public const ERROR = -2147483648The code of an explicit error, as a non-associative operator leaves behind.
public const ACCEPT = -1The code that accepts the input: a reduction by the augmented start rule.
Methods§
public static function shift(int $state): intEncodes a shift or goto.
Parameters
$state | int | Target state |
Returns
int The action codeTest cases 3
Called from 4
- static-call SqlParser\Automaton\ConflictResolver::resolve() packages/sql-parser/src/Automaton/ConflictResolver.php:45
- static-call SqlParser\Automaton\ConflictResolver::shiftOrReduce() packages/sql-parser/src/Automaton/ConflictResolver.php:100
- static-call SqlParser\Automaton\ConflictResolver::shiftOrReduce() packages/sql-parser/src/Automaton/ConflictResolver.php:104
- static-call SqlParser\Automaton\ParseTableBuilder::build() packages/sql-parser/src/Automaton/ParseTableBuilder.php:60
public static function reduce(int $rule): intEncodes a reduction.
Parameters
$rule | int | Rule to reduce by |
Returns
int The action codeTest cases 12
ConflictResolverTest::testResolveCountsAReduceReduceConflictAndKeepsTheEarlierRulecallsConflictResolverTest::testResolveKeepsPlainShiftsAndReductionscallsConflictResolverTest::testResolveLetsAHigherRankedLaterRuleWinUnderLemonsPolicycallsConflictResolverTest::testShiftOrReducecallsParseTableBuilderTest::testBuildMakesANonAssociativeOperatorAnErrorcallsParseTableBuilderTest::testBuildSettlesAnAmbiguousGrammarWithPrecedencecallsParseTableBuilderTest::testWithoutDefaultcallsActionCodeTest::testReducecallsActionCodeTest::testRulecallsParseTableTest::testActionFallsBackThenUsesTheWildcardThenTheDefaultcallsParseTableTest::testActionPrefersTheExplicitEntrycallsTableCodecTest::testEncodeAndDecodeRoundTripcalls
Called from 6
- static-call SqlParser\Automaton\ConflictResolver::resolve() packages/sql-parser/src/Automaton/ConflictResolver.php:56
- static-call SqlParser\Automaton\ConflictResolver::resolve() packages/sql-parser/src/Automaton/ConflictResolver.php:74
- static-call SqlParser\Automaton\ConflictResolver::shiftOrReduce() packages/sql-parser/src/Automaton/ConflictResolver.php:100
- static-call SqlParser\Automaton\ConflictResolver::shiftOrReduce() packages/sql-parser/src/Automaton/ConflictResolver.php:105
- static-call SqlParser\Automaton\ParseTableBuilder::build() packages/sql-parser/src/Automaton/ParseTableBuilder.php:68
- static-call SqlParser\Automaton\ParseTableBuilder::withoutDefault() packages/sql-parser/src/Automaton/ParseTableBuilder.php:124
public static function isShift(int $code): boolReports whether a code is a shift or goto.
Parameters
$code | int | Action code |
Returns
bool True for a shiftTest cases 4
public static function isReduce(int $code): boolReports whether a code is a reduction, the accept included.
Parameters
$code | int | Action code |
Returns
bool True for a reductionTest cases 1
Called from 2
Calls 1
- class-const ActionCode::ERROR() line 73
public static function rule(int $code): intAnswers the rule a reduction code reduces by.
Parameters
$code | int | A reduction code |
Returns
int The rule indexTest cases 1
ActionCodeTest::testRulecalls
Called from 3
- static-call SqlParser\Automaton\ConflictResolver::resolve() packages/sql-parser/src/Automaton/ConflictResolver.php:69
- static-call SqlParser\Automaton\ConflictResolver::resolve() packages/sql-parser/src/Automaton/ConflictResolver.php:73
- static-call SqlParser\Parser\LrParser::parse() packages/sql-parser/src/Parser/LrParser.php:61
Test cases 23§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
Other tests reaching this symbol 18
ConflictResolverTest::testResolveCountsAReduceReduceConflictAndKeepsTheEarlierRulecallsConflictResolverTest::testResolveKeepsPlainShiftsAndReductionscallsConflictResolverTest::testResolveLetsAHigherRankedLaterRuleWinUnderLemonsPolicycallsConflictResolverTest::testShiftOrReducecallsParseTableBuilderTest::testBuildKeepsReductionsExplicitWhereTheWildcardActscallsParseTableBuilderTest::testBuildMakesANonAssociativeOperatorAnErrorcallsParseTableBuilderTest::testBuildSettlesAnAmbiguousGrammarWithPrecedencecallsParseTableBuilderTest::testBuildSpellsTokenClassesOutToTheirMemberscallsParseTableBuilderTest::testWithoutDefaultcallsMySqlParserTestcallsLrParserTestcallsPostgreSqlParserTestcallsSqliteParserTestcallsParseTableTest::testActionFallsBackThenUsesTheWildcardThenTheDefaultcallsParseTableTest::testActionPrefersTheExplicitEntrycallsParseTableTest::testExpectedTerminalscallsParseTableTest::testStateCountcallsTableCodecTest::testEncodeAndDecodeRoundTripcalls
Relations§
Static calls 17
- static-call SqlParser\Automaton\ConflictResolver::resolve() packages/sql-parser/src/Automaton/ConflictResolver.php:45
- static-call SqlParser\Automaton\ConflictResolver::resolve() packages/sql-parser/src/Automaton/ConflictResolver.php:56
- static-call SqlParser\Automaton\ConflictResolver::resolve() packages/sql-parser/src/Automaton/ConflictResolver.php:58
- static-call SqlParser\Automaton\ConflictResolver::resolve() packages/sql-parser/src/Automaton/ConflictResolver.php:64
- static-call SqlParser\Automaton\ConflictResolver::resolve() packages/sql-parser/src/Automaton/ConflictResolver.php:68
- static-call SqlParser\Automaton\ConflictResolver::resolve() packages/sql-parser/src/Automaton/ConflictResolver.php:69
- static-call SqlParser\Automaton\ConflictResolver::resolve() packages/sql-parser/src/Automaton/ConflictResolver.php:73
- static-call SqlParser\Automaton\ConflictResolver::resolve() packages/sql-parser/src/Automaton/ConflictResolver.php:74
- static-call SqlParser\Automaton\ConflictResolver::shiftOrReduce() packages/sql-parser/src/Automaton/ConflictResolver.php:100
- static-call SqlParser\Automaton\ConflictResolver::shiftOrReduce() packages/sql-parser/src/Automaton/ConflictResolver.php:100
- static-call SqlParser\Automaton\ConflictResolver::shiftOrReduce() packages/sql-parser/src/Automaton/ConflictResolver.php:104
- static-call SqlParser\Automaton\ConflictResolver::shiftOrReduce() packages/sql-parser/src/Automaton/ConflictResolver.php:105
- static-call SqlParser\Automaton\ParseTableBuilder::build() packages/sql-parser/src/Automaton/ParseTableBuilder.php:60
- static-call SqlParser\Automaton\ParseTableBuilder::build() packages/sql-parser/src/Automaton/ParseTableBuilder.php:68
- static-call SqlParser\Automaton\ParseTableBuilder::withoutDefault() packages/sql-parser/src/Automaton/ParseTableBuilder.php:124
- static-call SqlParser\Parser\LrParser::parse() packages/sql-parser/src/Parser/LrParser.php:55
- static-call SqlParser\Parser\LrParser::parse() packages/sql-parser/src/Parser/LrParser.php:61
Constant reads 8
- class-const SqlParser\Automaton\ConflictResolver::resolve() packages/sql-parser/src/Automaton/ConflictResolver.php:62
- class-const SqlParser\Automaton\ConflictResolver::resolve() packages/sql-parser/src/Automaton/ConflictResolver.php:63
- class-const SqlParser\Automaton\ConflictResolver::shiftOrReduce() packages/sql-parser/src/Automaton/ConflictResolver.php:106
- class-const SqlParser\Automaton\ParseTableBuilder::build() packages/sql-parser/src/Automaton/ParseTableBuilder.php:68
- class-const SqlParser\Parser\LrParser::parse() packages/sql-parser/src/Parser/LrParser.php:52
- class-const SqlParser\Parser\LrParser::parse() packages/sql-parser/src/Parser/LrParser.php:67
- class-const SqlParser\Table\ParseTable::action() packages/sql-parser/src/Table/ParseTable.php:61
- class-const SqlParser\Table\ParseTable::expectedTerminals() packages/sql-parser/src/Table/ParseTable.php:75