cfg_predict_sets/
cfg_sets_ext.rs1use cfg_grammar::Cfg;
4
5use crate::{FirstSets, FollowSets, PredictSets};
6
7pub trait CfgSetsExt {
9 fn first_sets(&self) -> FirstSets;
11 fn follow_sets(&self) -> FollowSets;
13 fn follow_sets_with_first(&self, first_sets: &FirstSets) -> FollowSets;
16}
17
18impl CfgSetsExt for Cfg {
19 fn first_sets(&self) -> FirstSets {
20 FirstSets::new(self)
21 }
22
23 fn follow_sets(&self) -> FollowSets {
24 FollowSets::new(self, self.first_sets().predict_sets())
25 }
26
27 fn follow_sets_with_first(&self, first_sets: &FirstSets) -> FollowSets {
28 FollowSets::new(self, first_sets.predict_sets())
29 }
30}