summaryrefslogtreecommitdiff
path: root/src/lexer.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-10-12 06:09:48 +0000
committerMike Buland <eichlan@xagasoft.com>2010-10-12 06:09:48 +0000
commit1ee5f374ed986333d5cdbbf41390f1c4c755a8e3 (patch)
tree67b02598d3dca87a82263629a1290bd7b7a79006 /src/lexer.cpp
parent313e28df2a8776c82f5493aef6fe44ad40f1935a (diff)
downloadlibbu++-1ee5f374ed986333d5cdbbf41390f1c4c755a8e3.tar.gz
libbu++-1ee5f374ed986333d5cdbbf41390f1c4c755a8e3.tar.bz2
libbu++-1ee5f374ed986333d5cdbbf41390f1c4c755a8e3.tar.xz
libbu++-1ee5f374ed986333d5cdbbf41390f1c4c755a8e3.zip
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.
Diffstat (limited to 'src/lexer.cpp')
-rw-r--r--src/lexer.cpp31
1 files changed, 31 insertions, 0 deletions
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 @@
1#include "bu/lexer.h"
2
3Bu::Lexer::Lexer()
4{
5}
6
7Bu::Lexer::~Lexer()
8{
9}
10
11Bu::Lexer::Token::Token() :
12 iToken( -1 )
13{
14}
15
16Bu::Lexer::Token::Token( int iToken ) :
17 iToken( iToken )
18{
19}
20
21Bu::FString Bu::Lexer::tokenToString( const Bu::Lexer::Token &t )
22{
23 Bu::MemBuf mb;
24 Bu::Formatter f( mb );
25 f << "<" << t.iToken << ">";
26 if( t.vExtra.isSet() )
27 f << " (" << t.vExtra << ")";
28
29 return mb.getString();
30}
31