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

jbeder's avatar
jbeder committed
3
4
5
6
#ifndef PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66


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

namespace YAML
{
	class Scanner;
18
	struct ParserState;
19
20
	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
		void PrintTokens(std::ostream& out);

	private:
		void ParseDirectives();
36
37
38
		void HandleDirective(const Token& token);
		void HandleYamlDirective(const Token& token);
		void HandleTagDirective(const Token& token);
39
40

	private:
41
		std::auto_ptr<Scanner> m_pScanner;
42
		std::auto_ptr<ParserState> m_pState;
43
44
	};
}
jbeder's avatar
jbeder committed
45
46

#endif // PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66