Function parse_or

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

Parse a logical OR expression.

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

§Arguments

  • input - The input string slice to parse

§Returns

A IResult containing the remaining input and parsed LogicalOr expression.

§Grammar

or := and (S? ('|' | "||") S? and)*

Where S represents optional whitespace.

§Examples

use aimx::expressions::logical::parse_or;

// Simple OR
let result = parse_or("true | false");
assert!(result.is_ok());

// Chained OR operations (left associative)
let result = parse_or("true | false | true");
assert!(result.is_ok());
// Parsed as (true | false) | true

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

// With higher precedence operations
let result = parse_or("x > 0 | y < 10");
assert!(result.is_ok());