blob: 7015070345cd0e7c12ac4dcf3c785a849f2e689c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#include "bu/parser.h"
#include "bu/lexer.h"
#include "bu/sio.h"
using namespace Bu;
Bu::Parser::Parser()
{
}
Bu::Parser::~Parser()
{
}
void Bu::Parser::pushLexer( Lexer *pLex )
{
sLexer.push( pLex );
}
void Bu::Parser::popLexer()
{
delete sLexer.peekPop();
}
void Bu::Parser::parse()
{
for(;;)
{
Bu::Lexer::Token *pToken = sLexer.peek()->nextToken();
sio << sLexer.peek()->tokenToString( *pToken ) << sio.nl;
if( pToken->iToken < 0 )
{
delete sLexer.peekPop();
if( sLexer.isEmpty() )
{
delete pToken;
return;
}
}
delete pToken;
}
}
|