Fix false negative in token conflict detection
Co-Authored-By: Timothy Clem <timothy.clem@gmail.com>
This commit is contained in:
parent
10fb9b0e20
commit
c9f46b8242
2 changed files with 16 additions and 2 deletions
|
|
@ -1,9 +1,9 @@
|
|||
use crate::generate::build_tables::item::{TokenSetDisplay};
|
||||
use crate::generate::build_tables::item::TokenSetDisplay;
|
||||
use crate::generate::grammars::{LexicalGrammar, SyntaxGrammar};
|
||||
use crate::generate::nfa::{CharacterSet, NfaCursor, NfaTransition};
|
||||
use crate::generate::rules::TokenSet;
|
||||
use std::collections::HashSet;
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::HashSet;
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
|
|
|
|||
|
|
@ -266,6 +266,13 @@ fn compare_chars(left: &Vec<char>, right: &Vec<char>) -> SetComparision {
|
|||
result.common = true;
|
||||
}
|
||||
}
|
||||
|
||||
match (i, j) {
|
||||
(Some(_), _) => result.left_only = true,
|
||||
(_, Some(_)) => result.right_only = true,
|
||||
_ => {}
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
|
|
@ -810,5 +817,12 @@ mod tests {
|
|||
);
|
||||
assert!(a.does_intersect(&b));
|
||||
assert!(b.does_intersect(&a));
|
||||
|
||||
let (a, b) = (
|
||||
CharacterSet::Include(vec!['c']),
|
||||
CharacterSet::Exclude(vec!['a']),
|
||||
);
|
||||
assert!(a.does_intersect(&b));
|
||||
assert!(b.does_intersect(&a));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue