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

Function ismatch_here

src/rgx.rs:131–175  ·  view source on GitHub ↗
(re: &[char], text: &[char], end: &mut usize)

Source from the content-addressed store, hash-verified

129}
130
131fn ismatch_here(re: &[char], text: &[char], end: &mut usize) -> bool
132{
133 if re.len() == 0
134 {
135 return true;
136 }
137 if re[0] == '$'
138 {
139 return text.len() == 0;
140 }
141 let (mc, i) = if re.len() > 1 && re[0] == '\\'
142 {
143 (MetaCharacter::fromesc(re[1]), 1)
144 }
145 else
146 {
147 (MetaCharacter::from(re[0]), 0)
148 };
149 if re.len() > i + 1
150 {
151 let lazy = re.len() > i + 2 && re[i + 2] == '?';
152 let j = if lazy
153 {
154 i + 3
155 }
156 else
157 {
158 i + 2
159 };
160 match re[i + 1]
161 {
162 '*' => return ismatch_star(lazy, mc, &re[j..], text, end),
163 '+' => return ismatch_plus(lazy, mc, &re[j..], text, end),
164 '?' => return ismatch_qst(lazy, mc, &re[j..], text, end),
165 _ => {}
166 }
167 }
168 if text.len() != 0 && mc.contains(text[0])
169 {
170 *end += 1;
171 let j = i + 1;
172 return ismatch_here(&re[j..], &text[1..], end);
173 }
174 false
175}
176
177fn ismatch_star(lazy: bool, mc: MetaCharacter, re: &[char], text: &[char], end: &mut usize) -> bool
178{

Callers 2

ismatchFunction · 0.85
ismatch_charFunction · 0.85

Calls 5

ismatch_starFunction · 0.85
ismatch_plusFunction · 0.85
ismatch_qstFunction · 0.85
containsMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected