Moved the simple key validation to before each token scan (plus at newlines of scalars).

This commit is contained in:
Jesse Beder 2008-06-28 16:46:37 +00:00
parent 11706abbb7
commit c63ebbd878
4 changed files with 66 additions and 34 deletions

View file

@ -16,6 +16,8 @@ namespace YAML
Scanner(std::istream& in);
~Scanner();
Token *GetNextToken();
void ScanNextToken();
void ScanToNextToken();
Token *PushIndentTo(int column, bool sequence);
@ -55,12 +57,12 @@ namespace YAML
};
struct SimpleKey {
SimpleKey(int pos_, int line_, int column_);
SimpleKey(int pos_, int line_, int column_, int flowLevel_);
void Validate();
void Invalidate();
int pos, line, column;
int pos, line, column, flowLevel;
bool required;
Token *pMapStart, *pKey;
};
@ -81,6 +83,7 @@ namespace YAML
bool m_startedStream, m_endedStream;
bool m_simpleKeyAllowed;
int m_flowLevel; // number of unclosed '[' and '{' indicators
bool m_isLastKeyValid;
std::stack <SimpleKey> m_simpleKeys;
std::stack <int> m_indents;
};