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
//! `of` — what slots hold.

use crate::ast::Type;
use crate::parser::{PResult, Parser};
use crate::words::{Role, Word};

pub static WORD: Word = Word {
    text: "of",
    doc: "What slots hold: `slots inventory[4] of Battery`; anything without it.",
    reserved: false,
    roles: &[Role::Part],
};

/// `of Type`, or nothing.
pub(crate) fn ty(p: &mut Parser) -> PResult<Option<Type>> {
    if !p.eat_word(&WORD) {
        return Ok(None);
    }
    p.ty_plain().map(Some)
}