From f7035d970fc629e3e95f03dd5f4e9618cb3230d7 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 19 Dec 2016 13:41:42 -0700 Subject: Parsing commands is almost there. --- src/lexer.cpp | 2 +- src/token.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src') 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() sTmp->append( sBuf[iBufPos] ); } - return Token( Token::tString, sTmp ); + return Token( Token::tCmdParam, sTmp ); } break; } 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 ) case Token::tNegate: return f << "neg"; case Token::tUninitialized: return f << "<->"; case Token::tComputedValue: return f << "cmp"; + case Token::tCmdExit: return f << "cmd (exit)"; + case Token::tCmdScale: return f << "cmd (scale)"; + case Token::tCmdRadix: return f << "cmd (radix)"; + case Token::tCmdExtended: return f << "cmd (ext)"; + case Token::tCmdParam: return f << "cpr"; + case Token::tCmdEndParams: return f << "cpe"; default: return f << "???"; } @@ -113,7 +119,10 @@ 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 ) + else if( t.eType == Token::tString || + t.eType == Token::tVariable || + t.eType == Token::tCmdExtended || + t.eType == Token::tCmdParam ) f << "(" << (t.sVal?*(t.sVal):"") << ")"; return f; } -- cgit v1.2.3