diff options
author | Mike Buland <eichlan@xagasoft.com> | 2016-12-01 15:51:52 -0700 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2016-12-01 15:51:52 -0700 |
commit | 5d59aa3e9dffe2912215335ce0b76c67ebbe5a4e (patch) | |
tree | fa4f7b73f912b0b5ff87280c0bc4dc118a82392d /src/options.cpp | |
parent | 17a39c19e5bff97c3b3d2bc888a3bb5ded7c1b96 (diff) | |
download | clic-5d59aa3e9dffe2912215335ce0b76c67ebbe5a4e.tar.gz clic-5d59aa3e9dffe2912215335ce0b76c67ebbe5a4e.tar.bz2 clic-5d59aa3e9dffe2912215335ce0b76c67ebbe5a4e.tar.xz clic-5d59aa3e9dffe2912215335ce0b76c67ebbe5a4e.zip |
Signals solve many problems.
The command structures will be changed, I think. I want the lexer to actually
lex the command names into tokens, then the parser and the engine can both use
them to update their state when necesarry. It will be less ambiguous and easier
for both sides to stay synchronized.
Diffstat (limited to '')
-rw-r--r-- | src/options.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/options.cpp b/src/options.cpp index 672858a..3ed2336 100644 --- a/src/options.cpp +++ b/src/options.cpp | |||
@@ -201,8 +201,9 @@ int Options::execute( Bu::StringArray aArgs ) | |||
201 | Parser parser( lex ); | 201 | Parser parser( lex ); |
202 | Expression *pExp = parser.parse(); | 202 | Expression *pExp = parser.parse(); |
203 | ScriptEngine se; | 203 | ScriptEngine se; |
204 | Number n = se.exec( pExp ); | 204 | se.sigError = Bu::slot( this, &Options::printError ); |
205 | Bu::println( n.toString() ); | 205 | se.sigNumResult = Bu::slot( this, &Options::printNumber ); |
206 | se.exec( pExp ); | ||
206 | exit( 0 ); | 207 | exit( 0 ); |
207 | return aArgs.getSize(); | 208 | return aArgs.getSize(); |
208 | } | 209 | } |
@@ -328,3 +329,13 @@ int Options::grind( Bu::StringArray aArgs ) | |||
328 | return 0; | 329 | return 0; |
329 | } | 330 | } |
330 | 331 | ||
332 | void Options::printError( const Bu::String &sMsg ) | ||
333 | { | ||
334 | Bu::println("ERROR: %1").arg( sMsg ); | ||
335 | } | ||
336 | |||
337 | void Options::printNumber( const class Number &rNum ) | ||
338 | { | ||
339 | Bu::println("%1").arg( rNum ); | ||
340 | } | ||
341 | |||