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
//! `replace` — a patched method's whole body.

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

pub static WORD: Word = Word {
    text: "replace",
    doc: "Replaces a patched method's whole body: `replace canEat(ignoreHunger: Bool) -> Bool { … }`. \
          Exclusive: two mods replacing one method is a conflict named at launch with both mods.",
    reserved: false,
    roles: &[Role::PatchItem { parse }],
};

fn parse(p: &mut Parser) -> PResult<PatchItem> {
    p.bump();
    let method = p.method()?;
    Ok(PatchItem::Replace { method, body: p.block()? })
}