Skip to main content

parse_expr

Function parse_expr 

Source
pub fn parse_expr(input: &str) -> Result<Expr, ExprError>
Expand description

Parse a string expression into an Expr AST.

Syntax: expr → or_expr or_expr → and_expr ( “or” and_expr )* and_expr → not_expr ( “and” not_expr )* not_expr → “not” not_expr | comparison comparison → add_expr ( (“==” | “!=” | “>” | “>=” | “<” | “<=”) add_expr | (“in” | “not” “in”) list_literal )? add_expr → mul_expr ( (“+” | “-”) mul_expr )* mul_expr → unary_expr ( (“” | “/” | “//” | “%”) unary_expr ) unary_expr → (“+” | “-”) unary_expr | pow_expr pow_expr → atom ( “**” unary_expr )? atom → primary ( “.” METHOD_CALL )* primary → NUMBER | STRING | BOOL | IDENT | LOCAL | “abs” “(” expr “)” | “(” expr “)”