From 3015ea4677201060777435cf76815e898d221f8c Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 1 Dec 2016 09:31:45 -0700 Subject: The parser works. There's still more to do, however. It doesn't do math anymore, it produces a script that can then be executed. Now we have to capture that script and execute it. --- src/token.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/token.cpp') diff --git a/src/token.cpp b/src/token.cpp index 1eaa92a..0c7bda1 100644 --- a/src/token.cpp +++ b/src/token.cpp @@ -100,8 +100,20 @@ Bu::Formatter &operator<<( Bu::Formatter &f, Token::Type eType ) case Token::tEndOfLine: return f << "eol"; case Token::tEndOfInput: return f << "eoi"; case Token::tNegate: return f << "neg"; + case Token::tUninitialized: return f << "<->"; + case Token::tComputedValue: return f << "cmp"; default: return f << "???"; } } +Bu::Formatter &operator<<( Bu::Formatter &f, const Token &t ) +{ + f << t.eType; + if( t.eType == Token::tNumber ) + f << "(" << (t.nVal?t.nVal->toString():"") << ")"; + else if( t.eType == Token::tString || t.eType == Token::tVariable ) + f << "(" << (t.sVal?*(t.sVal):"") << ")"; + return f; +} + -- cgit v1.2.3