From 4804893a6616a312ac8028e42d2aa990018ffbe6 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Wed, 12 Apr 2017 16:58:18 +0200 Subject: Modularize primitives implementation, add stack manipulators --- repl.d | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'repl.d') diff --git a/repl.d b/repl.d index 4938a11..e3aef2b 100644 --- a/repl.d +++ b/repl.d @@ -8,12 +8,12 @@ import std.container : SList; import src.stack; -static import src.definition; -static import src.primitives; +static import definition = src.definition; +static import primitives = src.primitives.eval; void process(int x) { try { - if ( !src.primitives.evaluate(x) ) { + if ( !primitives.evaluate(x) ) { stack.push(x); } } @@ -24,9 +24,9 @@ void process(int x) { void process(string word) { try { - if ( !src.primitives.evaluate(word) ) { - if ( word in src.definition.words ) { - foreach ( token; src.definition.words[word] ) { + if ( !primitives.evaluate(word) ) { + if ( word in definition.words ) { + foreach ( token; definition.words[word] ) { process(token); } } else { @@ -52,11 +52,11 @@ void main() { if ( token.isNumeric ) { immutable int value = parse!int(token); - if ( !src.definition.handle(value) ) { + if ( !definition.handle(value) ) { process(value); } } else { - if ( !src.definition.handle(token) ) { + if ( !definition.handle(token) ) { process(token); } } -- cgit v1.2.3