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

Function object_after

nodedb-sql/src/ddl_ast/graph_parse/helpers.rs:39–45  ·  view source on GitHub ↗

Extract a brace-balanced object literal (`{…}`, braces included) that immediately follows `keyword`. Used for `PERSONALIZATION {…}` in `GRAPH ALGO`. Returns `None` when the keyword is absent or is not followed by an object token.

(toks: &[Tok<'_>], keyword: &str)

Source from the content-addressed store, hash-verified

37/// `GRAPH ALGO`. Returns `None` when the keyword is absent or is not followed
38/// by an object token.
39pub(super) fn object_after(toks: &[Tok<'_>], keyword: &str) -> Option<String> {
40 let pos = find_keyword(toks, keyword)?;
41 match toks.get(pos + 1)? {
42 Tok::Object(s) => Some((*s).to_string()),
43 _ => None,
44 }
45}
46
47pub(super) fn word_after(toks: &[Tok<'_>], keyword: &str) -> Option<String> {
48 let pos = find_keyword(toks, keyword)?;

Callers 1

parse_algoFunction · 0.85

Calls 3

to_stringMethod · 0.80
find_keywordFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected