mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-14 10:48:36 +12:00
Started the scanner.
This commit is contained in:
parent
bcbca461de
commit
8ae7b48188
5 changed files with 358 additions and 4 deletions
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;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue