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

Function has_operator_outside_literals

nodedb-sql/src/parser/preprocess/lex.rs:223–232  ·  view source on GitHub ↗

Return `true` if `op` appears verbatim inside any `Text` segment of `sql`. The comparison is byte-exact (case-sensitive). Occurrences inside string literals, quoted identifiers, or comments are ignored.

(sql: &str, op: &str)

Source from the content-addressed store, hash-verified

221/// The comparison is byte-exact (case-sensitive). Occurrences inside string
222/// literals, quoted identifiers, or comments are ignored.
223pub fn has_operator_outside_literals(sql: &str, op: &str) -> bool {
224 for seg in segments(sql) {
225 if let SqlSegment::Text(t) = seg
226 && t.contains(op)
227 {
228 return true;
229 }
230 }
231 false
232}
233
234/// Return the byte positions (relative to the start of `sql`) of every
235/// occurrence of `op` that falls inside a `Text` segment.

Callers 3

preprocessFunction · 0.85
rewrite_binary_opFunction · 0.85

Calls 2

segmentsFunction · 0.85
containsMethod · 0.45

Tested by

no test coverage detected