aboutsummaryrefslogtreecommitdiff
path: root/source/base
diff options
context:
space:
mode:
Diffstat (limited to 'source/base')
-rw-r--r--source/base/definition.d35
1 files changed, 20 insertions, 15 deletions
diff --git a/source/base/definition.d b/source/base/definition.d
index 4c0f50c..d37ad20 100644
--- a/source/base/definition.d
+++ b/source/base/definition.d
@@ -10,8 +10,27 @@ import base.stack;
alias Words = Stack!Token[string];
+Words words;
+
+bool handle(Token token) {
+ return token.visit!(
+ (int value) => handle(value),
+ (bool value) => handle(value),
+ (string word ) => handle(word)
+ );
+}
+
+Stack!Token get(string word) {
+ if ( word in words ) {
+ return words[word].dup;
+ } else {
+ return Stack!Token(Token(word));
+ }
+}
+
+private {
+
Nullable!(DList!Token) definition;
-Words words;
void register(DList!Token definition) {
string wordToBeDefined;
@@ -62,18 +81,4 @@ bool handle(string word) {
}
}
-bool handle(Token token) {
- return token.visit!(
- (int value) => handle(value),
- (bool value) => handle(value),
- (string word ) => handle(word)
- );
-}
-
-Stack!Token get(string word) {
- if ( word in words ) {
- return words[word].dup;
- } else {
- return Stack!Token(Token(word));
- }
}