Fixed bug in anchors with no content. This involved refactoring the 'implicit sequence' concept (where a map and a sequence start on the same indent, but we read the sequence as more indented since the '-' is visually an indent).

This commit is contained in:
jbeder
2009-08-24 22:56:54 +00:00
parent fc22d55b53
commit c7ed85a4ac
12 changed files with 183 additions and 36 deletions

View File

@@ -34,14 +34,26 @@ namespace YAML
void ClearAnchors();
private:
struct IndentMarker {
enum INDENT_TYPE { MAP, SEQ, NONE };
IndentMarker(int column_, INDENT_TYPE type_): column(column_), type(type_) {}
int column;
INDENT_TYPE type;
};
private:
// scanning
void EnsureTokensInQueue();
void ScanNextToken();
void ScanToNextToken();
void StartStream();
void EndStream();
Token *PushIndentTo(int column, bool sequence);
void PopIndentTo(int column);
Token *PushIndentTo(int column, IndentMarker::INDENT_TYPE type);
void PopIndentToHere();
void PopAllIndents();
void PopIndent();
int GetTopIndent() const;
// checking input
void InsertSimpleKey();
@@ -94,7 +106,7 @@ namespace YAML
int m_flowLevel; // number of unclosed '[' and '{' indicators
bool m_isLastKeyValid;
std::stack <SimpleKey> m_simpleKeys;
std::stack <int> m_indents;
std::stack <IndentMarker> m_indents;
std::map <std::string, const Node *> m_anchors;
};
}