Fix token conflict detection bugs

This commit is contained in:
Max Brunsfeld 2019-01-16 20:56:36 -08:00
parent ae07d2d6e4
commit e4b9d9dfa9
4 changed files with 8 additions and 9 deletions

View file

@ -236,7 +236,7 @@ impl<'a> ParseItemSet<'a> {
Err(i) => {
self.entries.insert(i, (item, lookaheads.clone()));
&mut self.entries[i].1
},
}
Ok(i) => {
self.entries[i].1.insert_all(lookaheads);
&mut self.entries[i].1
@ -248,8 +248,9 @@ impl<'a> ParseItemSet<'a> {
let mut previous_variable_index = u32::MAX;
let mut previous_step_index = u32::MAX;
for (item, _) in self.entries.iter() {
if item.step().is_none() && item.variable_index != previous_variable_index
|| item.step_index != previous_step_index
if item.step().is_some()
&& (item.variable_index != previous_variable_index
|| item.step_index != previous_step_index)
{
h.write_u32(item.variable_index);
h.write_u32(item.step_index);

View file

@ -228,8 +228,9 @@ impl<'a> Minimizer<'a> {
// Do not add a token if it conflicts with an existing token.
if token.is_terminal() {
for existing_token in state.terminal_entries.keys() {
if (is_word_token && self.keywords.contains(existing_token))
|| is_keyword && self.syntax_grammar.word_token.as_ref() == Some(existing_token)
if (is_word_token || is_keyword)
&& (self.keywords.contains(existing_token)
|| self.syntax_grammar.word_token.as_ref() == Some(existing_token))
{
continue;
}

View file

@ -232,7 +232,7 @@ fn identify_keywords(
.filter(|token| {
for other_token in keywords.iter() {
if other_token != *token
&& token_conflict_map.does_match_same_string(token.index, other_token.index)
&& token_conflict_map.does_match_same_string(other_token.index, token.index)
{
info!(
"Keywords - exclude {} because it matches the same string as {}",

View file

@ -167,9 +167,6 @@ impl Loader {
}
if cfg!(windows) {
if !BUILD_TARGET.contains("64") {
command.env("Platform", "x86");
}
command
.args(&["/nologo", "/LD", "/I"])
.arg(header_path)