blob: 3c9aa26697907d72ce7874ef64e29f5513caaad5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// check-pass
struct CNFParser {
token: char,
}
impl CNFParser {
fn is_whitespace(c: char) -> bool {
c == ' ' || c == '\n'
}
fn consume_whitespace(&mut self) {
self.consume_while(&(CNFParser::is_whitespace))
}
fn consume_while(&mut self, p: &dyn Fn(char) -> bool) {
while p(self.token) {
return
}
}
}
fn main() {}
|