MCPcopy Create free account
hub / github.com/davidblewett/rure-python / notate

Method notate

regex/regex-syntax/src/error.rs:211–228  ·  view source on GitHub ↗

Notate the pattern string with carents (`^`) pointing at each span location. This only applies to spans that occur within a single line.

(&self)

Source from the content-addressed store, hash-verified

209 /// Notate the pattern string with carents (`^`) pointing at each span
210 /// location. This only applies to spans that occur within a single line.
211 fn notate(&self) -> String {
212 let mut notated = String::new();
213 for (i, line) in self.pattern.lines().enumerate() {
214 if self.line_number_width > 0 {
215 notated.push_str(&self.left_pad_line_number(i + 1));
216 notated.push_str(": ");
217 } else {
218 notated.push_str(" ");
219 }
220 notated.push_str(line);
221 notated.push('\n');
222 if let Some(notes) = self.notate_line(i) {
223 notated.push_str(&notes);
224 notated.push('\n');
225 }
226 }
227 notated
228 }
229
230 /// Return notes for the line indexed at `i` (zero-based). If there are no
231 /// spans for the given line, then `None` is returned. Otherwise, an

Callers 1

fmtMethod · 0.80

Calls 3

left_pad_line_numberMethod · 0.80
notate_lineMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected