parser.cpp 518 Bytes
Newer Older
1
#include "parser.h"
2
#include "scanner.h"
3
4
#include "token.h"
#include <iostream>
5
6
7

namespace YAML
{
8
	Parser::Parser(std::istream& in): m_pScanner(0)
9
	{
10
		m_pScanner = new Scanner(in);
11
12
13
14
	}

	Parser::~Parser()
	{
15
		delete m_pScanner;
16
17
	}

Jesse Beder's avatar
Jesse Beder committed
18
	void Parser::GetNextDocument(Document& document)
19
	{
20
		document.Parse(m_pScanner);
21
	}
22
23
24
25
26
27
28
29
30
31
32

	void Parser::PrintTokens()
	{
		while(1) {
			Token *pToken = m_pScanner->GetNextToken();
			if(!pToken)
				break;

			std::cout << *pToken << std::endl;
		}
	}
33
}