matching now even less awkward
This commit is contained in:
parent
c3e2dbc1b8
commit
baa981c224
2 changed files with 16 additions and 0 deletions
|
@ -716,6 +716,12 @@ func _'match-else-error { |
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _'match-else-push { |
|
||||||
|
if {
|
||||||
|
pop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def _'has-been-called 0 =_'has-been-called
|
def _'has-been-called 0 =_'has-been-called
|
||||||
func _ { |
|
func _ { |
|
||||||
_'has-been-called not if {
|
_'has-been-called not if {
|
||||||
|
|
10
src/lexer.rs
10
src/lexer.rs
|
@ -260,6 +260,13 @@ fn read_block_dyn(
|
||||||
"=" => {
|
"=" => {
|
||||||
if str_words[i + 1] == ">" {
|
if str_words[i + 1] == ">" {
|
||||||
i += 1;
|
i += 1;
|
||||||
|
let pushing = if str_words[i + 1] == "?" {
|
||||||
|
i += 1;
|
||||||
|
words.push(Word::Call("dup".to_owned(), false, 0));
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
};
|
||||||
let throwing = if str_words[i + 1] == "!" {
|
let throwing = if str_words[i + 1] == "!" {
|
||||||
i += 1;
|
i += 1;
|
||||||
true
|
true
|
||||||
|
@ -291,6 +298,9 @@ fn read_block_dyn(
|
||||||
if throwing {
|
if throwing {
|
||||||
words.push(Word::Call("_'match-else-error".to_owned(), false, 0));
|
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 {
|
} else {
|
||||||
words.push(Word::Call("=".to_owned(), false, 0));
|
words.push(Word::Call("=".to_owned(), false, 0));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue