summaryrefslogtreecommitdiff
path: root/src/lexer.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2016-12-13 12:46:09 -0700
committerMike Buland <eichlan@xagasoft.com>2016-12-13 12:46:09 -0700
commit7e0edb6c2db17c87415fbd041ef7add9dfb467e5 (patch)
tree2feddf5d1dde80d97b2eefdd299cbebc0d2e30d4 /src/lexer.cpp
parent5d59aa3e9dffe2912215335ce0b76c67ebbe5a4e (diff)
downloadclic-7e0edb6c2db17c87415fbd041ef7add9dfb467e5.tar.gz
clic-7e0edb6c2db17c87415fbd041ef7add9dfb467e5.tar.bz2
clic-7e0edb6c2db17c87415fbd041ef7add9dfb467e5.tar.xz
clic-7e0edb6c2db17c87415fbd041ef7add9dfb467e5.zip
Corrected negation and single value parse bugs.
Discovered arithmetic bug in the Number class, -4 + 5 is coming back as -1, not 1. It's getting the sign wrong somehow. I'll have to hunt that down.
Diffstat (limited to 'src/lexer.cpp')
-rw-r--r--src/lexer.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lexer.cpp b/src/lexer.cpp
index 87d603a..9c8b36a 100644
--- a/src/lexer.cpp
+++ b/src/lexer.cpp
@@ -96,7 +96,13 @@ Token Lexer::nextTokenNormal()
96 { 96 {
97 sTmp->append( sBuf[iBufPos] ); 97 sTmp->append( sBuf[iBufPos] );
98 } 98 }
99 return Token( Token::tCommand, sTmp ); 99 if( *sTmp == "quit" || *sTmp == "exit" )
100 return Token( Token::tCmdExit );
101 else if( *sTmp == "scale" )
102 return Token( Token::tCmdScale );
103 else if( *sTmp == "radix" )
104 return Token( Token::tCmdRadix );
105 return Token( Token::tCmdExtended, sTmp );
100 } 106 }
101 break; 107 break;
102 108
@@ -196,13 +202,13 @@ Token Lexer::nextTokenCommand()
196 if( iBufPos >= sBuf.getSize() ) 202 if( iBufPos >= sBuf.getSize() )
197 { 203 {
198 iBufPos = -1; 204 iBufPos = -1;
199 return Token( Token::tEndOfLine ); 205 return Token( Token::tCmdEndParams );
200 } 206 }
201 207
202 if( iBufPos < 0 ) 208 if( iBufPos < 0 )
203 { 209 {
204 if( rIn.isEos() ) 210 if( rIn.isEos() )
205 return Token( Token::tEndOfInput ); 211 return Token( Token::tCmdEndParams );
206 212
207 sBuf = rIn.readLine(); 213 sBuf = rIn.readLine();
208 if( sBuf.getSize() == 0 ) 214 if( sBuf.getSize() == 0 )