parser.h 858 Bytes
Newer Older
1
2
#pragma once

3
4
5
6
#ifndef PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66


7
8
9
#include "node.h"
#include "parserstate.h"
#include "noncopyable.h"
10
11
12
13
#include <ios>
#include <string>
#include <vector>
#include <map>
14
#include <memory>
15
16
17
18
19
20

namespace YAML
{
	class Scanner;
	struct Token;

21
	class Parser: private noncopyable
22
23
	{
	public:
24
		Parser();
25
26
27
28
29
30
		Parser(std::istream& in);
		~Parser();

		operator bool() const;

		void Load(std::istream& in);
31
		bool GetNextDocument(Node& document);
32
33
34
35
36
37
38
39
40
		void PrintTokens(std::ostream& out);

	private:
		void ParseDirectives();
		void HandleDirective(Token *pToken);
		void HandleYamlDirective(Token *pToken);
		void HandleTagDirective(Token *pToken);

	private:
41
		std::auto_ptr<Scanner> m_pScanner;
42
43
44
		ParserState m_state;
	};
}
45
46

#endif // PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66