From 1ee5f374ed986333d5cdbbf41390f1c4c755a8e3 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 12 Oct 2010 06:09:48 +0000 Subject: This commit has a minor tweak to the variant class to make it easier to use, and introduces the parser and lexer classes. I also made a test for parser and put it in the tools directory. That is silly, it shouldn't be. However, it's necesarry right now, because I don't want to do a full build to compile all the parser tests. However, this commit doesn't actually build yet. It will soon, I just wanted to get it all committed. --- src/lexer.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/lexer.cpp (limited to 'src/lexer.cpp') diff --git a/src/lexer.cpp b/src/lexer.cpp new file mode 100644 index 0000000..c7a6fcb --- /dev/null +++ b/src/lexer.cpp @@ -0,0 +1,31 @@ +#include "bu/lexer.h" + +Bu::Lexer::Lexer() +{ +} + +Bu::Lexer::~Lexer() +{ +} + +Bu::Lexer::Token::Token() : + iToken( -1 ) +{ +} + +Bu::Lexer::Token::Token( int iToken ) : + iToken( iToken ) +{ +} + +Bu::FString Bu::Lexer::tokenToString( const Bu::Lexer::Token &t ) +{ + Bu::MemBuf mb; + Bu::Formatter f( mb ); + f << "<" << t.iToken << ">"; + if( t.vExtra.isSet() ) + f << " (" << t.vExtra << ")"; + + return mb.getString(); +} + -- cgit v1.2.3