matching now even less awkward

This commit is contained in:
Daniella / Tove 2024-11-15 14:39:36 +01:00
parent c3e2dbc1b8
commit 24f32fb4cb
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
2 changed files with 15 additions and 0 deletions

View file

@ -716,6 +716,12 @@ func _'match-else-error { |
}
}
func _'match-else-push { |
if {
pop
}
}
def _'has-been-called 0 =_'has-been-called
func _ { |
_'has-been-called not if {

View file

@ -260,6 +260,12 @@ fn read_block_dyn(
"=" => {
if str_words[i + 1] == ">" {
i += 1;
let pushing = if str_words[i + 1] == "?" {
i += 1;
true
} else {
false
};
let throwing = if str_words[i + 1] == "!" {
i += 1;
true
@ -291,6 +297,9 @@ fn read_block_dyn(
if throwing {
words.push(Word::Call("_'match-else-error".to_owned(), false, 0));
}
if pushing {
words.push(Word::Call("_'match-else-push".to_owned(), false, 0));
}
} else {
words.push(Word::Call("=".to_owned(), false, 0));
}