aboutsummaryrefslogtreecommitdiff
path: root/source/primitives
diff options
context:
space:
mode:
Diffstat (limited to 'source/primitives')
-rw-r--r--source/primitives/conditional.d2
-rw-r--r--source/primitives/eval.d20
2 files changed, 14 insertions, 8 deletions
diff --git a/source/primitives/conditional.d b/source/primitives/conditional.d
index 08c0f52..e5ba591 100644
--- a/source/primitives/conditional.d
+++ b/source/primitives/conditional.d
@@ -16,7 +16,7 @@ void capture(Token token) {
}
}
-bool drop(Token token) {
+bool handle(Token token) {
if ( concluded && buffer.isNull ) {
return false;
}
diff --git a/source/primitives/eval.d b/source/primitives/eval.d
index 0ddd65a..0cb45b7 100644
--- a/source/primitives/eval.d
+++ b/source/primitives/eval.d
@@ -4,6 +4,8 @@ import std.variant;
import base.stack;
import primitives.core;
+
+import definition = base.definition;
import conditional = primitives.conditional;
bool evaluate_primitive(string word) {
@@ -33,15 +35,19 @@ bool evaluate_primitive(string word) {
}
bool evaluate(Token token) {
- if ( conditional.drop(token) ) {
+ if ( definition.handle(token) ) {
+ return true;
+ }
+
+ if ( conditional.handle(token) ) {
return true;
- } else {
- return token.visit!(
- (int value) => false,
- (bool value) => false,
- (string word ) => evaluate_primitive(word)
- );
}
+
+ return token.visit!(
+ (int value) => false,
+ (bool value) => false,
+ (string word ) => evaluate_primitive(word)
+ );
}
Stack!Token result() {