2008-09-03 22:20:39 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
2009-07-29 22:27:20 +00:00
|
|
|
#ifndef PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
|
|
|
|
#define PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
|
|
|
|
|
|
|
|
|
|
2009-10-19 22:40:46 +00:00
|
|
|
#include "node.h"
|
|
|
|
|
#include "noncopyable.h"
|
2008-09-03 22:20:39 +00:00
|
|
|
#include <ios>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <map>
|
2009-10-19 22:40:46 +00:00
|
|
|
#include <memory>
|
2008-09-03 22:20:39 +00:00
|
|
|
|
|
|
|
|
namespace YAML
|
|
|
|
|
{
|
|
|
|
|
class Scanner;
|
2009-10-29 15:48:06 +00:00
|
|
|
class ParserState;
|
2008-09-03 22:20:39 +00:00
|
|
|
struct Token;
|
|
|
|
|
|
2009-10-19 22:40:46 +00:00
|
|
|
class Parser: private noncopyable
|
2008-09-03 22:20:39 +00:00
|
|
|
{
|
|
|
|
|
public:
|
2009-10-19 22:40:46 +00:00
|
|
|
Parser();
|
2008-09-03 22:20:39 +00:00
|
|
|
Parser(std::istream& in);
|
|
|
|
|
~Parser();
|
|
|
|
|
|
|
|
|
|
operator bool() const;
|
|
|
|
|
|
|
|
|
|
void Load(std::istream& in);
|
2009-09-29 18:25:11 +00:00
|
|
|
bool GetNextDocument(Node& document);
|
2008-09-03 22:20:39 +00:00
|
|
|
void PrintTokens(std::ostream& out);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void ParseDirectives();
|
2009-10-29 15:48:06 +00:00
|
|
|
void HandleDirective(const Token& token);
|
|
|
|
|
void HandleYamlDirective(const Token& token);
|
|
|
|
|
void HandleTagDirective(const Token& token);
|
2008-09-03 22:20:39 +00:00
|
|
|
|
|
|
|
|
private:
|
2009-10-19 22:40:46 +00:00
|
|
|
std::auto_ptr<Scanner> m_pScanner;
|
2009-10-29 15:48:06 +00:00
|
|
|
std::auto_ptr<ParserState> m_pState;
|
2008-09-03 22:20:39 +00:00
|
|
|
};
|
|
|
|
|
}
|
2009-07-29 22:27:20 +00:00
|
|
|
|
|
|
|
|
#endif // PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|