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

Function parse_or

nodedb-sql/src/functions/fts_ops/tsquery_parser.rs:103–117  ·  view source on GitHub ↗
(tokens: &[String], pos: &mut usize)

Source from the content-addressed store, hash-verified

101// ── Recursive-descent parser ──────────────────────────────────────────────────
102
103fn parse_or(tokens: &[String], pos: &mut usize) -> Result<FtsQuery> {
104 let mut left = parse_and(tokens, pos)?;
105 while *pos < tokens.len() && tokens[*pos] == "|" {
106 *pos += 1;
107 let right = parse_and(tokens, pos)?;
108 left = match left {
109 FtsQuery::Or(mut parts) => {
110 parts.push(right);
111 FtsQuery::Or(parts)
112 }
113 other => FtsQuery::Or(vec![other, right]),
114 };
115 }
116 Ok(left)
117}
118
119fn parse_and(tokens: &[String], pos: &mut usize) -> Result<FtsQuery> {
120 let mut left = parse_not(tokens, pos)?;

Callers 2

parse_tsqueryFunction · 0.70
parse_atomFunction · 0.70

Calls 3

parse_andFunction · 0.70
lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected