Collected pos, line, and column into a Mark struct

This commit is contained in:
Jesse Beder
2009-07-27 02:56:18 +00:00
parent 9b78bd459b
commit b1ce042535
17 changed files with 145 additions and 137 deletions

View File

@@ -179,7 +179,7 @@ namespace YAML
}
Stream::Stream(std::istream& input)
: pos(0), line(0), column(0), m_input(input), m_nPushedBack(0),
: m_input(input), m_nPushedBack(0),
m_pPrefetched(new unsigned char[YAML_PREFETCH_SIZE]),
m_nPrefetchedAvailable(0), m_nPrefetchedUsed(0)
{
@@ -248,11 +248,11 @@ namespace YAML
{
char ch = peek();
AdvanceCurrent();
column++;
m_mark.column++;
if(ch == '\n') {
column = 0;
line++;
m_mark.column = 0;
m_mark.line++;
}
return ch;
@@ -282,7 +282,7 @@ namespace YAML
if (!m_readahead.empty())
{
m_readahead.pop_front();
++pos;
m_mark.pos++;
}
ReadAheadTo(0);