syntax
Syntactic analysis of search templates.
This module provides the lexical and syntactic parsing layer for Context-Fabric search templates. It tokenizes template strings into structured representations that can be validated and executed by the semantic analysis layer.
The module handles: - Template line parsing (atoms, relations, features, operators) - Quantifier detection and nesting (where/have/without/with/or) - Feature value parsing (equality, regex, numeric comparisons) - Escape sequence processing
See Also -------- cfabric.search.semantics : Semantic validation of parsed templates cfabric.search.search : High-level search API
Functions
cleanParent(atom: str, parentName: str) → str | NoneClean an atom line by replacing empty names with the parent name.
Parameters
atom: strparentName: str
deContext(quantifier: tuple[(str, list[list[str]], int)], parentName: str) → tuple[(str, list[str], str, int)]Transform a quantifier by resolving parent references.
Parameters
quantifier: tuple[(str, list[list[str]], int)]parentName: str
parseFeatureVals(searchExe: SearchExe, featStr: str, features: dict[(str, Any)], i: int, asEdge: bool = False) → boolParse a feature value specification and add it to the features dict.
Parameters
searchExe: SearchExefeatStr: strfeatures: dict[(str, Any)]i: intasEdge: bool= False
parseLine(line: str) → tuple[(str, tuple[(Any, ...)])]Parse a single line of a search template.
Parameters
line: str
syntax(searchExe: SearchExe) → NonePerform syntactic analysis on a search template.
Parameters
searchExe: SearchExe