MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / ismatch_char

Function ismatch_char

src/rgx.rs:192–231  ·  view source on GitHub ↗
(lazy: bool, mc: MetaCharacter, re: &[char], text: &[char], range: T, end: &mut usize)

Source from the content-addressed store, hash-verified

190}
191
192fn ismatch_char<T: RangeBounds<usize>>(lazy: bool, mc: MetaCharacter, re: &[char], text: &[char], range: T, end: &mut usize) -> bool
193{
194 let mut i = 0;
195 let n = text.len();
196 if !lazy
197 {
198 loop
199 {
200 if i == n || !(mc.contains(text[i]))
201 {
202 break;
203 }
204 i += 1;
205 }
206 }
207 loop
208 {
209 if ismatch_here(re, &text[i..], end) && range.contains(&i)
210 {
211 *end += i;
212 return true;
213 }
214 if lazy
215 {
216 if i == n || !(mc.contains(text[i]))
217 {
218 return false;
219 }
220 i += i;
221 }
222 else
223 {
224 if i == 0
225 {
226 return false;
227 }
228 i -= 1;
229 }
230 }
231}

Callers 3

ismatch_starFunction · 0.85
ismatch_plusFunction · 0.85
ismatch_qstFunction · 0.85

Calls 3

ismatch_hereFunction · 0.85
containsMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected