| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Bridge helpers for the optional Rust MySQL lexer/parser extension. |
| 5 |
* PHP keeps the grammar object, while Rust owns the exported parser state. |
| 6 |
*/ |
| 7 |
|
| 8 |
/** |
| 9 |
* Export grammar internals for the native parser. |
| 10 |
* |
| 11 |
* @access private |
| 12 |
* |
| 13 |
* @param WP_Parser_Grammar $grammar Parser grammar. |
| 14 |
* @return array<string, mixed> |
| 15 |
*/ |
| 16 |
function wp_sqlite_mysql_native_export_grammar( WP_Parser_Grammar $grammar ): array { |
| 17 |
return array( |
| 18 |
'highest_terminal_id' => $grammar->highest_terminal_id, |
| 19 |
'rules' => $grammar->rules, |
| 20 |
'lookahead_is_match_possible' => $grammar->lookahead_is_match_possible, |
| 21 |
'rule_names' => $grammar->rule_names, |
| 22 |
'fragment_ids' => $grammar->fragment_ids, |
| 23 |
); |
| 24 |
} |
| 25 |
|