#pragma once #include #include #include #include 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 T *ScanToken(T *pToken); private: // the stream std::istream& INPUT; int m_column; // the output (tokens) std::queue m_tokens; // state info bool m_startedStream; bool m_simpleKeyAllowed; int m_flowLevel; // number of unclosed '[' and '{' indicators std::stack m_indents; }; }