MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / consume_quoted

Function consume_quoted

nodedb-sql/src/ddl_ast/graph_parse/tokenizer.rs:42–65  ·  view source on GitHub ↗
(sql: &'a str, bytes: &[u8], start: usize, out: &mut Vec<Tok<'a>>)

Source from the content-addressed store, hash-verified

40}
41
42fn consume_quoted<'a>(sql: &'a str, bytes: &[u8], start: usize, out: &mut Vec<Tok<'a>>) -> usize {
43 let content_start = start + 1;
44 let mut j = content_start;
45 let mut has_escape = false;
46 while j < bytes.len() {
47 if bytes[j] == b'\'' {
48 if j + 1 < bytes.len() && bytes[j + 1] == b'\'' {
49 has_escape = true;
50 j += 2;
51 continue;
52 }
53 break;
54 }
55 j += 1;
56 }
57 let slice = &sql[content_start..j];
58 let content = if has_escape {
59 Cow::Owned(slice.replace("''", "'"))
60 } else {
61 Cow::Borrowed(slice)
62 };
63 out.push(Tok::Quoted(content));
64 if j < bytes.len() { j + 1 } else { j }
65}
66
67fn consume_object<'a>(sql: &'a str, bytes: &[u8], start: usize, out: &mut Vec<Tok<'a>>) -> usize {
68 let mut depth = 0i32;

Callers 1

tokenizeFunction · 0.85

Calls 3

replaceMethod · 0.80
lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected