yog-script-analyze 0.1.0

Yog Script (.ys, .yns) analyzed: its lexer, parser and syntax tree, names resolved, the class index model — what the build and the editors read a source with.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! `or`.

use crate::ast::{BinOp, Expr};
use crate::parser::{PResult, Parser};
use crate::words::{Level, Role, Word};

pub static WORD: Word = Word {
    text: "or",
    doc: "Either holds: `a or b` (or `a || b`); `b` is evaluated only when `a` doesn't.",
    reserved: true,
    roles: &[Role::Infix { level: Level::Or, parse, negatable: false }],
};

fn parse(p: &mut Parser, left: Expr, _negated: bool) -> PResult<Expr> {
    p.bump();
    let right = p.binary(Level::Or.tighter())?;
    Ok(Parser::binary_node(BinOp::Or, left, right))
}