mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Started the scanner.
This commit is contained in:
55
scanner.h
Normal file
55
scanner.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include <ios>
|
||||
#include <string>
|
||||
#include <queue>
|
||||
#include <stack>
|
||||
|
||||
namespace YAML
|
||||
{
|
||||
class Token;
|
||||
|
||||
namespace Keys
|
||||
{
|
||||
const char Comment = '#';
|
||||
}
|
||||
|
||||
class Scanner
|
||||
{
|
||||
public:
|
||||
Scanner(std::istream& in);
|
||||
~Scanner();
|
||||
|
||||
Token *ScanNextToken();
|
||||
void ScanToNextToken();
|
||||
|
||||
void Scan();
|
||||
|
||||
private:
|
||||
char GetChar();
|
||||
void EatLineBreak();
|
||||
void EatDocumentStart();
|
||||
void EatDocumentEnd();
|
||||
|
||||
bool IsWhitespaceToBeEaten();
|
||||
bool IsLineBreak();
|
||||
bool IsBlank();
|
||||
bool IsDocumentStart();
|
||||
bool IsDocumentEnd();
|
||||
template <typename T> T *ScanToken(T *pToken);
|
||||
|
||||
private:
|
||||
// the stream
|
||||
std::istream& INPUT;
|
||||
int m_column;
|
||||
|
||||
// the output (tokens)
|
||||
std::queue <Token *> m_tokens;
|
||||
|
||||
// state info
|
||||
bool m_startedStream;
|
||||
bool m_simpleKeyAllowed;
|
||||
int m_flowLevel; // number of unclosed '[' and '{' indicators
|
||||
std::stack <int> m_indents;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user