Skip to content

Commit d762567

Browse files
committed
Remove parser failed-match memoization
1 parent cad9d21 commit d762567

1 file changed

Lines changed: 0 additions & 7 deletions

File tree

packages/mysql-on-sqlite/src/parser/class-wp-parser.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ class WP_Parser {
2020
private $highest_terminal_id;
2121
private $select_statement_rule_id;
2222
private $token_count;
23-
private $failed_matches;
2423

2524
public function __construct( WP_Parser_Grammar $grammar, array $tokens ) {
2625
$this->grammar = $grammar;
@@ -40,7 +39,6 @@ public function parse() {
4039
foreach ( $this->tokens as $token ) {
4140
$this->token_ids[] = $token->id;
4241
}
43-
$this->failed_matches = array();
4442

4543
// @TODO: Make the starting rule lookup non-grammar-specific.
4644
$query_rule_id = $this->grammar->get_rule_id( 'query' );
@@ -66,9 +64,6 @@ private function parse_recursive( $rule_id ) {
6664
}
6765

6866
$starting_position = $this->position;
69-
if ( isset( $this->failed_matches[ $starting_position ][ $rule_id ] ) ) {
70-
return false;
71-
}
7267

7368
$branches = $this->rules[ $rule_id ];
7469

@@ -84,7 +79,6 @@ private function parse_recursive( $rule_id ) {
8479
$single_branch_index = is_int( $branch_indexes ) ? $branch_indexes : null;
8580

8681
if ( null === $single_branch_index && ! count( $branch_indexes ) ) {
87-
$this->failed_matches[ $starting_position ][ $rule_id ] = true;
8882
return false;
8983
}
9084

@@ -143,7 +137,6 @@ private function parse_recursive( $rule_id ) {
143137

144138
if ( ! $branch_matches ) {
145139
$this->position = $starting_position;
146-
$this->failed_matches[ $starting_position ][ $rule_id ] = true;
147140
return false;
148141
}
149142

0 commit comments

Comments
 (0)