pub fn parse_reference(input: &str) -> IResult<&str, Arc<Reference>>Expand description
Parse a reference chain: identifier ('.' identifier){0,3}.
Supports up to four segments and uses the global FunctionRegistry to
distinguish between:
- plain references (e.g.
foo.bar) - function/method calls (e.g.
foo()orfoo.bar()), which are handled by higher-level postfix parsing.
Behavior highlights:
- A bare
_is rejected as an invalid reference. - If the first identifier is a known function and is immediately followed by
(, parsing fails so that the caller can treat it as a function call. - For chained references, if a later segment is a known function and is
followed by
(, the parser “rolls back” to the shorter reference so that constructs likeobject.method()are parsed as a reference toobjectfollowed by a method call.
Errors are reported via the nom::IResult error variants; resolution-time
errors (e.g. undefined reference) occur later when evaluating.