From 5d59aa3e9dffe2912215335ce0b76c67ebbe5a4e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 1 Dec 2016 15:51:52 -0700 Subject: 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. --- src/options.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/options.cpp') 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 ) Parser parser( lex ); Expression *pExp = parser.parse(); ScriptEngine se; - Number n = se.exec( pExp ); - Bu::println( n.toString() ); + se.sigError = Bu::slot( this, &Options::printError ); + se.sigNumResult = Bu::slot( this, &Options::printNumber ); + se.exec( pExp ); exit( 0 ); return aArgs.getSize(); } @@ -328,3 +329,13 @@ int Options::grind( Bu::StringArray aArgs ) return 0; } +void Options::printError( const Bu::String &sMsg ) +{ + Bu::println("ERROR: %1").arg( sMsg ); +} + +void Options::printNumber( const class Number &rNum ) +{ + Bu::println("%1").arg( rNum ); +} + -- cgit v1.2.3