diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 8ecb03e..a94feaa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,6 +13,7 @@ mod tests; const HELP_TEXT: &str = "LITERALS\n\ 0-9 integers\n\ + . decimal point\n\ _ toggle sign (or, as a command, negate the top item on the stack)\n\ [...] string\n\ (...) named command (see below)\n\ @@ -292,6 +293,14 @@ fn make_command_character_readtable() -> ReadTable { Ok(()) }); + result.set_action('.', move |_, state| { + state.mode = Mode::Decimal; + state.num = dec!(0); + state.decimal_offset = dec!(1); + + Ok(()) + }); + result.set_action('_', move |_, state| { state.mode = Mode::Integer; state.num = dec!(0); |