able-script/src/parser.rs

18 lines
376 B
Rust
Raw Normal View History

2021-04-11 17:22:06 -05:00
use crate::tokens::{ABOOL, TOKENS};
2021-04-11 15:11:23 -05:00
2021-04-11 17:22:06 -05:00
pub fn abool2num(abool: ABOOL) -> i32 {
match abool {
ABOOL::NEVER => -1,
ABOOL::SOMETIMES => 0,
ABOOL::ALWAYS => 1,
}
}
pub fn num2abool(number: i32) -> ABOOL {
match number {
-1 => ABOOL::NEVER,
0 => ABOOL::SOMETIMES,
1 => ABOOL::ALWAYS,
_ => ABOOL::SOMETIMES,
2021-04-11 15:11:23 -05:00
}
}