Moved the input stream, together with line/column info, into its own class, which allowed some other stuff just to pass the stream, and not have to be a member of Scanner.

This commit is contained in:
Jesse Beder
2008-06-29 06:32:13 +00:00
parent 0d5a97bffe
commit ff99f85a6d
13 changed files with 162 additions and 142 deletions

View File

@@ -6,6 +6,7 @@
#include <stack>
#include <set>
#include "regex.h"
#include "stream.h"
namespace YAML
{
@@ -31,11 +32,6 @@ namespace YAML
void Scan();
private:
char GetChar();
std::string GetChar(int n);
void Eat(int n = 1);
void EatLineBreak();
bool IsWhitespaceToBeEaten(char ch);
bool IsDocumentStart();
bool IsDocumentEnd();
@@ -44,9 +40,6 @@ namespace YAML
bool IsValue();
bool IsPlainScalar();
void GetBlockIndentation(int& indent, std::string& breaks);
std::string ScanScalar(RegEx end, bool eatEnd, int indent, char escape, bool fold, bool eatLeadingWhitespace, bool trimTrailingSpaces, int chomp);
struct SimpleKey {
SimpleKey(int pos_, int line_, int column_, int flowLevel_);
@@ -63,8 +56,7 @@ namespace YAML
private:
// the stream
std::istream& INPUT;
int m_line, m_column;
Stream INPUT;
// the output (tokens)
std::queue <Token *> m_tokens;