parser.h 707 Bytes
Newer Older
1
2
3
#pragma once

#include <ios>
4
5
6
#include <string>
#include <vector>
#include <map>
7
#include "node.h"
8
#include "parserstate.h"
9
10
11
12

namespace YAML
{
	class Node;
13
	class Scanner;
14
15
16
17
18
19
20

	class Parser
	{
	public:
		Parser(std::istream& in);
		~Parser();

21
22
		operator bool() const;

23
		void GetNextDocument(Node& document);
24
25
26
27
28
29
30
		void PrintTokens(std::ostream& out);

	private:
		void ParseDirectives();
		void HandleDirective(const std::string& name, const std::vector <std::string>& params);
		void HandleYamlDirective(const std::vector <std::string>& params);
		void HandleTagDirective(const std::vector <std::string>& params);
31
32

	private:
33
		Scanner *m_pScanner;
34
		ParserState m_state;
35
36
	};
}