summaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
new file mode 100644
index 0000000..7015070
--- /dev/null
+++ b/src/parser.cpp
@@ -0,0 +1,43 @@
1#include "bu/parser.h"
2#include "bu/lexer.h"
3
4#include "bu/sio.h"
5using namespace Bu;
6
7Bu::Parser::Parser()
8{
9}
10
11Bu::Parser::~Parser()
12{
13}
14
15void Bu::Parser::pushLexer( Lexer *pLex )
16{
17 sLexer.push( pLex );
18}
19
20void Bu::Parser::popLexer()
21{
22 delete sLexer.peekPop();
23}
24
25void Bu::Parser::parse()
26{
27 for(;;)
28 {
29 Bu::Lexer::Token *pToken = sLexer.peek()->nextToken();
30 sio << sLexer.peek()->tokenToString( *pToken ) << sio.nl;
31 if( pToken->iToken < 0 )
32 {
33 delete sLexer.peekPop();
34 if( sLexer.isEmpty() )
35 {
36 delete pToken;
37 return;
38 }
39 }
40 delete pToken;
41 }
42}
43