1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
use from_u32;
use unconst;
use crateInterval;
use crateRepr;
use crateIntegral;
/*
/// An abstraction over input used in the matching engines.
impl Context<char> {
/// Return true if the given empty width instruction matches at the
/// input position given.
pub fn yes(&self, index: usize, look: &Zero) -> bool {
match look {
Zero::StartLine => {
let c = &self[index - 1];
index == 0 || c == &'\n'
}
Zero::EndLine => {
let c = &self[index + 1];
index == self.len() || c == &'\n'
}
Zero::StartText => index == 0,
Zero::EndText => index == self.len(),
Zero::WordBoundary => {
let (c1, c2) = (&self[index - 1], &self[index + 1]);
is_word_char(c1) != is_word_char(c2)
}
Zero::NotWordBoundary => {
let (c1, c2) = (&self[index - 1], &self[index + 1]);
is_word_char(c1) == is_word_char(c2)
}
Zero::WordBoundaryAscii => {
let (c1, c2) = (&self[index - 1], &self[index + 1]);
is_word_byte(c1) != is_word_byte(c2)
}
Zero::NotWordBoundaryAscii => {
let (c1, c2) = (&self[index - 1], &self[index + 1]);
is_word_byte(c1) == is_word_byte(c2)
}
Zero::Any => unimplemented!()
}
}
}
*/
/// Returns true iff the character is a word character.
///
/// If the character is absent, then false is returned.
pub const
/// Returns true iff the byte is a word byte.
///
/// If the byte is absent, then false is returned.
pub const