parser.h 927 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
#include "noncopyable.h"
8
#include <ios>
9
#include <memory>
10
11
12

namespace YAML
{
13
14
	struct Directives;
	struct Mark;
15
	struct Token;
16
17
18
	class EventHandler;
	class Node;
	class Scanner;
19

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

		operator bool() const;

		void Load(std::istream& in);
30
31
		bool HandleNextDocument(EventHandler& eventHandler);
		
32
		bool GetNextDocument(Node& document);
33
34
35
36
		void PrintTokens(std::ostream& out);

	private:
		void ParseDirectives();
37
38
39
		void HandleDirective(const Token& token);
		void HandleYamlDirective(const Token& token);
		void HandleTagDirective(const Token& token);
40
		
41
	private:
42
		std::auto_ptr<Scanner> m_pScanner;
43
		std::auto_ptr<Directives> m_pDirectives;
44
45
	};
}
46
47

#endif // PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66