summaryrefslogtreecommitdiff
path: root/src/token.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2016-11-30 14:52:39 -0700
committerMike Buland <eichlan@xagasoft.com>2016-11-30 14:52:39 -0700
commit2297488eae424197dce4ed6b1dc50ae67c093074 (patch)
treec28956f193f9ee8bdde083f780984736d48a5e41 /src/token.cpp
parent0321e6e39b8cf24718cf853c28f0f35443753264 (diff)
downloadclic-2297488eae424197dce4ed6b1dc50ae67c093074.tar.gz
clic-2297488eae424197dce4ed6b1dc50ae67c093074.tar.bz2
clic-2297488eae424197dce4ed6b1dc50ae67c093074.tar.xz
clic-2297488eae424197dce4ed6b1dc50ae67c093074.zip
I managed to confuse myself pretty well.
I'm doing some reading up on LR(n) parsers, I just sort of started without thinking about it this time, not a great approach. I feel like it can't hurt to have an update on how this works anyway. I think the idea was solid, but I was trying to do too much at once. One question is what my goal should be for this. I could just solve the equation as we go, or I could generate code that will let us solve the equation. The later is obviously attractive in that it will let us run an expression more than once, and maybe even define functions. I like that.
Diffstat (limited to 'src/token.cpp')
-rw-r--r--src/token.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/token.cpp b/src/token.cpp
index 30f3566..c591e6a 100644
--- a/src/token.cpp
+++ b/src/token.cpp
@@ -55,6 +55,32 @@ Token::~Token()
55 } 55 }
56} 56}
57 57
58Token &Token::operator=( const Token &rhs )
59{
60 switch( eType )
61 {
62 case tNumber:
63 delete nVal;
64 break;
65
66 case tVariable:
67 case tCommand:
68 case tString:
69 delete sVal;
70 break;
71
72 default:
73 break;
74 }
75 eType = rhs.eType;
76 sVal = rhs.sVal;
77
78 Token &rMod = const_cast<Token &>(rhs);
79 rMod.sVal = 0;
80
81 return *this;
82}
83
58Bu::Formatter &operator<<( Bu::Formatter &f, Token::Type eType ) 84Bu::Formatter &operator<<( Bu::Formatter &f, Token::Type eType )
59{ 85{
60 switch( eType ) 86 switch( eType )