diff options
author | Melody Horn <melody@boringcactus.com> | 2021-04-05 12:05:32 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-04-05 12:05:32 -0600 |
commit | 6a41b2ac4a2d171917126e56b741b16a184897c7 (patch) | |
tree | 105f2c63ad4971450bd0c1a7cb5d914cb9070c9e /src/makefile | |
parent | 52c5c7f8376c42f8ed4702b60754332864daabf3 (diff) | |
download | makers-6a41b2ac4a2d171917126e56b741b16a184897c7.tar.gz makers-6a41b2ac4a2d171917126e56b741b16a184897c7.zip |
implement function `error`
Diffstat (limited to 'src/makefile')
-rw-r--r-- | src/makefile/functions.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/makefile/functions.rs b/src/makefile/functions.rs index 46caca5..2098334 100644 --- a/src/makefile/functions.rs +++ b/src/makefile/functions.rs @@ -113,6 +113,11 @@ pub fn expand_call( origin(macros, &args[0]) } + "error" => { + assert_eq!(args.len(), 1); + meta::error(macros, &args[0]) + } + "shell" => { assert_eq!(args.len(), 1); shell(macros, &args[0]) @@ -415,6 +420,15 @@ pub fn origin(macros: &MacroSet, variable: &TokenString) -> Result<String> { Ok(macros.origin(&variable).to_owned()) } +mod meta { + use super::*; + + pub fn error(macros: &MacroSet, text: &TokenString) -> Result<String> { + let text = macros.expand(text)?; + bail!("{}", text); + } +} + pub fn shell(macros: &MacroSet, command: &TokenString) -> Result<String> { // TODO bring this in from command_line let command = macros.expand(command)?; |