summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2016-12-19 13:41:42 -0700
committerMike Buland <eichlan@xagasoft.com>2016-12-19 13:41:42 -0700
commitf7035d970fc629e3e95f03dd5f4e9618cb3230d7 (patch)
tree6cfa1cd977dde6680189b1c1c3bf0589cdad377c
parent3bb307b470876561509904172d3aaede10e5eb62 (diff)
downloadclic-f7035d970fc629e3e95f03dd5f4e9618cb3230d7.tar.gz
clic-f7035d970fc629e3e95f03dd5f4e9618cb3230d7.tar.bz2
clic-f7035d970fc629e3e95f03dd5f4e9618cb3230d7.tar.xz
clic-f7035d970fc629e3e95f03dd5f4e9618cb3230d7.zip
Parsing commands is almost there.
-rw-r--r--src/lexer.cpp2
-rw-r--r--src/token.cpp11
2 files changed, 11 insertions, 2 deletions
diff --git a/src/lexer.cpp b/src/lexer.cpp
index 9c8b36a..3739a01 100644
--- a/src/lexer.cpp
+++ b/src/lexer.cpp
@@ -238,7 +238,7 @@ Token Lexer::nextTokenCommand()
238 238
239 sTmp->append( sBuf[iBufPos] ); 239 sTmp->append( sBuf[iBufPos] );
240 } 240 }
241 return Token( Token::tString, sTmp ); 241 return Token( Token::tCmdParam, sTmp );
242 } 242 }
243 break; 243 break;
244 } 244 }
diff --git a/src/token.cpp b/src/token.cpp
index ff04e94..7ec9b98 100644
--- a/src/token.cpp
+++ b/src/token.cpp
@@ -103,6 +103,12 @@ Bu::Formatter &operator<<( Bu::Formatter &f, Token::Type eType )
103 case Token::tNegate: return f << "neg"; 103 case Token::tNegate: return f << "neg";
104 case Token::tUninitialized: return f << "<->"; 104 case Token::tUninitialized: return f << "<->";
105 case Token::tComputedValue: return f << "cmp"; 105 case Token::tComputedValue: return f << "cmp";
106 case Token::tCmdExit: return f << "cmd (exit)";
107 case Token::tCmdScale: return f << "cmd (scale)";
108 case Token::tCmdRadix: return f << "cmd (radix)";
109 case Token::tCmdExtended: return f << "cmd (ext)";
110 case Token::tCmdParam: return f << "cpr";
111 case Token::tCmdEndParams: return f << "cpe";
106 112
107 default: return f << "???"; 113 default: return f << "???";
108 } 114 }
@@ -113,7 +119,10 @@ Bu::Formatter &operator<<( Bu::Formatter &f, const Token &t )
113 f << t.eType; 119 f << t.eType;
114 if( t.eType == Token::tNumber ) 120 if( t.eType == Token::tNumber )
115 f << "(" << (t.nVal?t.nVal->toString():"<null>") << ")"; 121 f << "(" << (t.nVal?t.nVal->toString():"<null>") << ")";
116 else if( t.eType == Token::tString || t.eType == Token::tVariable ) 122 else if( t.eType == Token::tString ||
123 t.eType == Token::tVariable ||
124 t.eType == Token::tCmdExtended ||
125 t.eType == Token::tCmdParam )
117 f << "(" << (t.sVal?*(t.sVal):"<null>") << ")"; 126 f << "(" << (t.sVal?*(t.sVal):"<null>") << ")";
118 return f; 127 return f;
119} 128}