diff options
author | Mike Buland <eichlan@xagasoft.com> | 2016-12-19 15:52:04 -0700 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2016-12-19 15:52:04 -0700 |
commit | 0580d6a85fda454b05620aa4415a53f3dbcd3475 (patch) | |
tree | ef257f03b3c395f7eb2177177bbafef9e5de8265 /src/main.cpp | |
parent | f7035d970fc629e3e95f03dd5f4e9618cb3230d7 (diff) | |
download | clic-0580d6a85fda454b05620aa4415a53f3dbcd3475.tar.gz clic-0580d6a85fda454b05620aa4415a53f3dbcd3475.tar.bz2 clic-0580d6a85fda454b05620aa4415a53f3dbcd3475.tar.xz clic-0580d6a85fda454b05620aa4415a53f3dbcd3475.zip |
It actually sorta' works again!newparser
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 667d19a..1365f1f 100644 --- a/src/main.cpp +++ b/src/main.cpp | |||
@@ -5,6 +5,8 @@ | |||
5 | #include "token.h" | 5 | #include "token.h" |
6 | #include "parser.h" | 6 | #include "parser.h" |
7 | #include "options.h" | 7 | #include "options.h" |
8 | #include "scriptengine.h" | ||
9 | |||
8 | #include <math.h> | 10 | #include <math.h> |
9 | #include <sys/time.h> | 11 | #include <sys/time.h> |
10 | 12 | ||
@@ -14,6 +16,21 @@ | |||
14 | #include <bu/streamstack.h> | 16 | #include <bu/streamstack.h> |
15 | using namespace Bu; | 17 | using namespace Bu; |
16 | 18 | ||
19 | void numResult( const class Number &num ) | ||
20 | { | ||
21 | println("==> %1").arg( num ); | ||
22 | } | ||
23 | |||
24 | void dispError( const Bu::String &sMsg ) | ||
25 | { | ||
26 | println(sMsg); | ||
27 | } | ||
28 | |||
29 | void dispMessage( const Bu::String &sMsg ) | ||
30 | { | ||
31 | println(sMsg); | ||
32 | } | ||
33 | |||
17 | int main( int argc, char *argv[] ) | 34 | int main( int argc, char *argv[] ) |
18 | { | 35 | { |
19 | try | 36 | try |
@@ -28,7 +45,17 @@ int main( int argc, char *argv[] ) | |||
28 | lex.setScale( opt.getScale() ); | 45 | lex.setScale( opt.getScale() ); |
29 | lex.setRadix( opt.getRadix() ); | 46 | lex.setRadix( opt.getRadix() ); |
30 | Parser parser( lex ); | 47 | Parser parser( lex ); |
31 | parser.parse(); | 48 | |
49 | ScriptEngine se; | ||
50 | se.sigNumResult = Bu::slot(numResult); | ||
51 | se.sigError = Bu::slot(dispError); | ||
52 | se.sigMessage = Bu::slot(dispMessage); | ||
53 | for(;;) | ||
54 | { | ||
55 | Expression *pExpr = parser.parse(); | ||
56 | se.exec( pExpr ); | ||
57 | delete pExpr; | ||
58 | } | ||
32 | } | 59 | } |
33 | catch( std::exception &e ) | 60 | catch( std::exception &e ) |
34 | { | 61 | { |