cfg_predict_sets/
cfg_sets_ext.rs1use cfg_grammar::Cfg;
2
3use crate::{FirstSets, FollowSets, PredictSets};
4
5pub trait CfgSetsExt {
6 fn first_sets(&self) -> FirstSets;
7 fn follow_sets(&self) -> FollowSets;
8 fn follow_sets_with_first(&self, first_sets: &FirstSets) -> FollowSets;
9}
10
11impl CfgSetsExt for Cfg {
12 fn first_sets(&self) -> FirstSets {
13 FirstSets::new(self)
14 }
15
16 fn follow_sets(&self) -> FollowSets {
17 FollowSets::new(self, self.first_sets().predict_sets())
18 }
19
20 fn follow_sets_with_first(&self, first_sets: &FirstSets) -> FollowSets {
21 FollowSets::new(self, first_sets.predict_sets())
22 }
23}