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

Function ismatch

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

Source from the content-addressed store, hash-verified

100
101
102fn ismatch(re: &[char], text: &[char], start: &mut usize, end: &mut usize) -> bool
103{
104 if re.len() == 0
105 {
106 return true;
107 }
108 if re[0] == '^'
109 {
110 *end = 1;
111 return ismatch_here(&re[1..], text, end);
112 }
113 let mut i = 0;
114 let n = text.len();
115 loop
116 {
117 *start = i;
118 *end = i;
119 if ismatch_here(re, &text[i..], end)
120 {
121 return true;
122 }
123 if i == n
124 {
125 return false;
126 }
127 i += 1;
128 }
129}
130
131fn ismatch_here(re: &[char], text: &[char], end: &mut usize) -> bool
132{

Callers 1

findMethod · 0.85

Calls 2

ismatch_hereFunction · 0.85
lenMethod · 0.45

Tested by

no test coverage detected