summaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp27
1 files changed, 3 insertions, 24 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index f97078a..72f7bb3 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -1,6 +1,7 @@
1#include "parser.h" 1#include "parser.h"
2#include "lexer.h" 2#include "lexer.h"
3#include "number.h" 3#include "number.h"
4#include "datafiles.h"
4 5
5#include <bu/sio.h> 6#include <bu/sio.h>
6#include <stdlib.h> 7#include <stdlib.h>
@@ -35,6 +36,7 @@ void Parser::parse()
35 if( !tsTerminal.isEmpty() ) 36 if( !tsTerminal.isEmpty() )
36 { 37 {
37 Bu::println( rOut, "%1").arg( deref( tsTerminal.peek() ) ); 38 Bu::println( rOut, "%1").arg( deref( tsTerminal.peek() ) );
39 hVars.insert("ans", deref( tsTerminal.peek() ) );
38 } 40 }
39 tsTerminal.clear(); 41 tsTerminal.clear();
40 lex.setMode( Lexer::modeNormal ); 42 lex.setMode( Lexer::modeNormal );
@@ -118,30 +120,7 @@ void Parser::parse()
118 } 120 }
119 else if( *t.sVal == "help" || *t.sVal == "h" || *t.sVal == "?" ) 121 else if( *t.sVal == "help" || *t.sVal == "h" || *t.sVal == "?" )
120 { 122 {
121 Bu::println( rOut, 123 Bu::println( rOut, Datafiles::getString("parserhelp.txt") );
122 "All commands start with a '\\'. The following commands are defined:\n"
123 " \\help, \\h, \\? - This help\n"
124 " \\exit, \\quit - Exit the program\n"
125 " \\radix - Display the current radix (base)\n"
126 " \\radix <num> - Set the radix to anything between 2 and 36 (inclusive)\n"
127 " \\scale - Display the current scale\n"
128 " \\scale <num> - Set the current scale\n"
129 " \\vars - List all defined variables\n"
130 "\n"
131 "All variables must prefixed with a $ but otherwise can be used anywhere a\n"
132 "number can be used. To assign a variable use =, i.e.:\n"
133 " $amnt = $rate * 144000.09\n"
134 "\n"
135 "When using a radix greater than 10 all extended digits are lowercase letters\n"
136 "starting with 'a'. Upper case is not currently supported.\n"
137 "\n"
138 "All numeric command parameters (i.e. \\scale, \\radix) are in base 10 no\n"
139 "matter what radix is currently set. These are also displayed in base 10\n"
140 "at all times.\n"
141 "\n"
142 "Changing the radix always clears all variables.\n"
143 );
144
145 } 124 }
146 else 125 else
147 { 126 {