Function parse_and

Source
pub fn parse_and(input: &str) -> IResult<&str, LogicalAnd>
Expand description

Parses logical AND operations (&, &&) according to left associativity, or falls back to parsing equality expressions.

§Arguments

  • input - The input string slice to parse

§Returns

A IResult containing the remaining input and parsed LogicalAnd expression.

§Grammar

and := equality (S? ('&' | "&&") S? equality)*

Where S represents optional whitespace.

§Examples

use aimx::expressions::logical::parse_and;

// Simple AND
let result = parse_and("true & false");
assert!(result.is_ok());

// Chained AND operations (left associative)
let result = parse_and("true & false & true");
assert!(result.is_ok());
// Parsed as (true & false) & true

// With whitespace
let result = parse_and("true && false");
assert!(result.is_ok());