summaryrefslogtreecommitdiff
path: root/src/token.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2016-12-01 09:31:45 -0700
committerMike Buland <eichlan@xagasoft.com>2016-12-01 09:31:45 -0700
commit3015ea4677201060777435cf76815e898d221f8c (patch)
tree8415fcef57ed5456ec03b2ea115ebd3789fd8c10 /src/token.cpp
parent5b8df4e1ab3faffe5c010222ff3f8ce3a4ff810c (diff)
downloadclic-3015ea4677201060777435cf76815e898d221f8c.tar.gz
clic-3015ea4677201060777435cf76815e898d221f8c.tar.bz2
clic-3015ea4677201060777435cf76815e898d221f8c.tar.xz
clic-3015ea4677201060777435cf76815e898d221f8c.zip
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.
Diffstat (limited to '')
-rw-r--r--src/token.cpp12
1 files changed, 12 insertions, 0 deletions
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 )
100 case Token::tEndOfLine: return f << "eol"; 100 case Token::tEndOfLine: return f << "eol";
101 case Token::tEndOfInput: return f << "eoi"; 101 case Token::tEndOfInput: return f << "eoi";
102 case Token::tNegate: return f << "neg"; 102 case Token::tNegate: return f << "neg";
103 case Token::tUninitialized: return f << "<->";
104 case Token::tComputedValue: return f << "cmp";
103 105
104 default: return f << "???"; 106 default: return f << "???";
105 } 107 }
106} 108}
107 109
110Bu::Formatter &operator<<( Bu::Formatter &f, const Token &t )
111{
112 f << t.eType;
113 if( t.eType == Token::tNumber )
114 f << "(" << (t.nVal?t.nVal->toString():"<null>") << ")";
115 else if( t.eType == Token::tString || t.eType == Token::tVariable )
116 f << "(" << (t.sVal?*(t.sVal):"<null>") << ")";
117 return f;
118}
119