yog_script_analyze/words/
replace.rs1use crate::ast::PatchItem;
4use crate::parser::{PResult, Parser};
5use crate::words::{Role, Word};
6
7pub static WORD: Word = Word {
8 text: "replace",
9 doc: "The patched method's whole body (`@Overwrite`): `replace bool CanEat(bool ignoreHunger) { … }`. \
10 Exclusive: a second mod replacing it is a conflict reported at launch with both mods' names.",
11 reserved: false,
12 roles: &[Role::PatchItem { parse }],
13};
14
15fn parse(p: &mut Parser) -> PResult<PatchItem> {
16 p.bump();
17 let method = p.target()?;
18 let body = p.block()?;
19 Ok(PatchItem::Replace { method, body })
20}