17
17
/// 1..<1024: Terminal number + 1
18
18
priv type EncodedLookaheadSet @small_int_set .T derive (Eq , Compare , Hash )
19
19
20
- ///|
21
- fn EncodedLookaheadSet ::is_empty (self : EncodedLookaheadSet ) -> Bool {
22
- self ._.is_empty ()
23
- }
24
-
25
20
///|
26
21
fn EncodedLookaheadSet ::is_singleton (
27
22
self : EncodedLookaheadSet ,
28
23
key : Lookahead
29
24
) -> Bool {
30
- self ._.is_singleton (
25
+ self
26
+ .inner ()
27
+ .is_singleton (
31
28
match key {
32
29
EndOfInput => 0
33
30
Input (key ) => key .num + 1
34
31
},
35
32
)
36
33
}
37
34
38
- ///|
39
- fn EncodedLookaheadSet ::contains (
40
- self : EncodedLookaheadSet ,
41
- lookahead : Lookahead
42
- ) -> Bool {
43
- match lookahead {
44
- Input (t ) => self ._.contains (t .num + 1 )
45
- EndOfInput => self ._.contains (0 )
46
- }
47
- }
48
-
49
35
///|
50
36
fn EncodedLookaheadSet ::empty () -> EncodedLookaheadSet {
51
37
@small_int_set .empty ()
52
38
}
53
39
54
- ///|
55
- fn EncodedLookaheadSet ::default () -> EncodedLookaheadSet {
56
- EncodedLookaheadSet ::empty ()
57
- }
58
-
59
- ///|
60
- fn EncodedLookaheadSet ::from_iter (
61
- iter : Iter [Lookahead ]
62
- ) -> EncodedLookaheadSet {
63
- @small_int_set .from_iter (
64
- iter .map (fn (lookahead ) {
65
- match lookahead {
66
- Input (t ) => t .num + 1
67
- EndOfInput => 0
68
- }
69
- }),
70
- )
71
- }
72
-
73
40
///|
74
41
fn EncodedLookaheadSet ::terminal (t : @grm .Terminal ) -> EncodedLookaheadSet {
75
42
@small_int_set .singleton (t .num + 1 )
@@ -93,7 +60,8 @@ fn EncodedLookaheadSet::decode_iter(
93
60
self : EncodedLookaheadSet ,
94
61
grammar : @grm .Grammar
95
62
) -> Iter [Lookahead ] {
96
- self ._
63
+ self
64
+ .inner ()
97
65
.iter ()
98
66
.map (fn (t ) {
99
67
if t == 0 {
@@ -109,21 +77,21 @@ fn EncodedLookaheadSet::union(
109
77
self : EncodedLookaheadSet ,
110
78
other : EncodedLookaheadSet
111
79
) -> EncodedLookaheadSet {
112
- self ._ .union (other ._ )
80
+ self .inner () .union (other .inner () )
113
81
}
114
82
115
83
///|
116
84
fn EncodedLookaheadSet ::disjoint (
117
85
self : EncodedLookaheadSet ,
118
86
other : EncodedLookaheadSet
119
87
) -> Bool {
120
- self ._ .disjoint (other ._ )
88
+ self .inner () .disjoint (other .inner () )
121
89
}
122
90
123
91
///|
124
92
fn EncodedLookaheadSet ::subset (
125
93
self : EncodedLookaheadSet ,
126
94
other : EncodedLookaheadSet
127
95
) -> Bool {
128
- self ._ .subset (other ._ )
96
+ self .inner () .subset (other .inner () )
129
97
}
0 commit comments