diff options
author | Adrian Kummerlaender | 2017-04-16 13:17:22 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2017-04-16 13:17:22 +0200 |
commit | 44f419264898f84fe5536f3ea159c18b381e6083 (patch) | |
tree | 5fc32c362f3cb854c114b7d75260de87f654efaa /source/primitives/core.d | |
parent | c06a6ade2d144cd8042392e597ead385756bcbc7 (diff) | |
download | slang-44f419264898f84fe5536f3ea159c18b381e6083.tar slang-44f419264898f84fe5536f3ea159c18b381e6083.tar.gz slang-44f419264898f84fe5536f3ea159c18b381e6083.tar.bz2 slang-44f419264898f84fe5536f3ea159c18b381e6083.tar.lz slang-44f419264898f84fe5536f3ea159c18b381e6083.tar.xz slang-44f419264898f84fe5536f3ea159c18b381e6083.tar.zst slang-44f419264898f84fe5536f3ea159c18b381e6083.zip |
Extract variable management, move into `state` package
Diffstat (limited to 'source/primitives/core.d')
-rw-r--r-- | source/primitives/core.d | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/source/primitives/core.d b/source/primitives/core.d index cae577b..75783ed 100644 --- a/source/primitives/core.d +++ b/source/primitives/core.d @@ -2,12 +2,10 @@ module primitives.core; import std.stdio; -import base.stack; +import state.stack; bool handle(string word) { switch ( word ) { - case "$" : binary_op_variable_bind; break; - case "@" : unary_op_variable_resolve; break; case "+" : binary_op_add; break; case "*" : binary_op_multiply; break; case "/" : binary_op_divide; break; @@ -28,22 +26,6 @@ bool handle(string word) { private { -Token[string] variables; - -void binary_op_variable_bind() { - string name = stack.pop.get!string; - Token value = stack.pop; - variables[name] = value; -} - -void unary_op_variable_resolve() { - string name = stack.pop.get!string; - - if ( name in variables ) { - stack.push(variables[name]); - } -} - void binary_op_add() { int b = stack.pop.get!int; int a = stack.pop.get!int; |