Generator::add_parse_table: Store entries in hash map
This avoids a quadratic behaviour due to repeatedly using `find` on a growing `Vec`.
This commit is contained in:
parent
cf69a2c94c
commit
965e3c9e5e
2 changed files with 16 additions and 11 deletions
|
|
@ -10,7 +10,7 @@ use std::hash::BuildHasherDefault;
|
|||
use indexmap::IndexMap;
|
||||
use rustc_hash::FxHasher;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub(crate) enum ParseAction {
|
||||
Accept,
|
||||
Shift {
|
||||
|
|
@ -33,7 +33,7 @@ pub(crate) enum GotoAction {
|
|||
ShiftExtra,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub(crate) struct ParseTableEntry {
|
||||
pub actions: Vec<ParseAction>,
|
||||
pub reusable: bool,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue