able-script/src/parser.rs
2021-04-13 17:43:54 +02:00

18 lines
366 B
Rust

use crate::tokens::Abool;
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,
}
}