mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-10 04:51:17 +00:00
Added simple keys.
There's a bug (and question): should we test simple keys' validity BEFORE stuff or AFTER stuff?
This commit is contained in:
21
scanner.h
21
scanner.h
@@ -18,11 +18,15 @@ namespace YAML
|
||||
|
||||
void ScanNextToken();
|
||||
void ScanToNextToken();
|
||||
void PushIndentTo(int column, bool sequence);
|
||||
Token *PushIndentTo(int column, bool sequence);
|
||||
void PopIndentTo(int column);
|
||||
void IncreaseFlowLevel();
|
||||
void DecreaseFlowLevel();
|
||||
|
||||
void InsertSimpleKey();
|
||||
bool ValidateSimpleKey();
|
||||
void ValidateAllSimpleKeys();
|
||||
|
||||
void Scan();
|
||||
|
||||
private:
|
||||
@@ -41,6 +45,7 @@ namespace YAML
|
||||
|
||||
struct WhitespaceInfo {
|
||||
WhitespaceInfo();
|
||||
|
||||
void AddBlank(char ch);
|
||||
void AddBreak(const std::string& line);
|
||||
std::string Join();
|
||||
@@ -49,13 +54,24 @@ namespace YAML
|
||||
std::string whitespace, leadingBreaks, trailingBreaks;
|
||||
};
|
||||
|
||||
struct SimpleKey {
|
||||
SimpleKey(int pos_, int line_, int column_);
|
||||
|
||||
void Validate();
|
||||
void Invalidate();
|
||||
|
||||
int pos, line, column;
|
||||
bool required;
|
||||
Token *pMapStart, *pKey;
|
||||
};
|
||||
|
||||
template <typename T> void ScanAndEnqueue(T *pToken);
|
||||
template <typename T> T *ScanToken(T *pToken);
|
||||
|
||||
private:
|
||||
// the stream
|
||||
std::istream& INPUT;
|
||||
int m_column;
|
||||
int m_line, m_column;
|
||||
|
||||
// the output (tokens)
|
||||
std::queue <Token *> m_tokens;
|
||||
@@ -65,6 +81,7 @@ namespace YAML
|
||||
bool m_startedStream, m_endedStream;
|
||||
bool m_simpleKeyAllowed;
|
||||
int m_flowLevel; // number of unclosed '[' and '{' indicators
|
||||
std::stack <SimpleKey> m_simpleKeys;
|
||||
std::stack <int> m_indents;
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user