Skip to content

Commit

Permalink
Fix enterXXX listener calls for alternative labels (#13)
Browse files Browse the repository at this point in the history
Fixes #12.

* Move the trigger of enter rule events from `enter_rule` and `enter_recursion_rule` to `enter_outer_alt`
  • Loading branch information
Hikaru Terazono authored Sep 14, 2020
1 parent 56f0269 commit 31b0344
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,6 @@ impl<T, Ext> BaseParser<Ext, T>
if self.build_parse_trees {
self.add_context_to_parse_tree()
}
self.trigger_enter_rule_event();
}

pub fn exit_rule(&mut self) {
Expand Down Expand Up @@ -404,8 +403,10 @@ impl<T, Ext> BaseParser<Ext, T>
}
}

self.ctx = Some(new_ctx)
self.ctx = Some(new_ctx);
}

self.trigger_enter_rule_event();
}


Expand All @@ -415,7 +416,6 @@ impl<T, Ext> BaseParser<Ext, T>
localctx.set_start(self.input.lt(1).map(Token::to_owned));
//println!("{}",self.input.lt(1).map(Token::to_owned).unwrap());
self.ctx = Some(localctx);
self.trigger_enter_rule_event()
}

pub fn push_new_recursion_context(&mut self, localctx: Rc<dyn ParserRuleContext>, state: isize, _rule_index: usize) {
Expand Down

0 comments on commit 31b0344

Please sign in to comment.