Expand description
Rhue’s parser. Hand-written recursive descent for statements, Pratt parsing for expressions.
This is part of Rhue’s guts. If you’re embedding
Rhue, use the rhue crate, that’s the API that stays stable.
It recovers from errors at statement boundaries, so one run can report a bunch of separate mistakes.
Modules§
Constants§
- MAX_
DEPTH - Max nesting (recursion plus left-associative operator chains) before the parser gives up, so hostile input can’t build an endlessly deep tree.
- MAX_
ERRORS - Stop collecting after this many errors, the later ones are usually cascades anyway.
Functions§
- parse_
chunk - Parses a whole chunk (a file or
Engine::evalsource). On failure you get every error it found (up toMAX_ERRORS), in source order. - parse_
expr - Parses one expression and wraps it as
return <expr>so it goes through the same pipeline as a chunk (REPL /eval_expr). - parse_
type - Parses a type by itself (
(number, string) -> boolean), the way host declarations and definition strings are written.