summaryrefslogtreecommitdiff
path: root/src/parse/lex.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2015-03-14 22:29:51 +0800
committerJohn Hodge <tpg@mutabah.net>2015-03-14 22:29:51 +0800
commitbf14a518b591b8f43a92c13d85b1ae5db8965703 (patch)
treea01c5a6183093fe8f6d8e1f63f4c1d33f631ad52 /src/parse/lex.cpp
parent2cd588ca7d71b00c93429c733ce28d78cdd415eb (diff)
downloadmrust-bf14a518b591b8f43a92c13d85b1ae5db8965703.tar.gz
Fixed macros, added range syntax and other tweaks
Diffstat (limited to 'src/parse/lex.cpp')
-rw-r--r--src/parse/lex.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/parse/lex.cpp b/src/parse/lex.cpp
index b290b3f1..d469d46d 100644
--- a/src/parse/lex.cpp
+++ b/src/parse/lex.cpp
@@ -623,6 +623,7 @@ SERIALISE_TYPE_S(Token, {
TTStream::TTStream(const TokenTree& input_tt):
m_input_tt(input_tt)
{
+ DEBUG("input_tt = [" << input_tt << "]");
m_stack.push_back( ::std::make_pair(0, &input_tt) );
}
TTStream::~TTStream()
@@ -671,6 +672,14 @@ TokenStream::~TokenStream()
{
}
+Token TokenStream::innerGetToken()
+{
+ Token ret = this->realGetToken();
+ if( ret.get_pos().filename.size() == 0 )
+ ret.set_pos( this->getPosition() );
+ //DEBUG("ret.get_pos() = " << ret.get_pos());
+ return ret;
+}
Token TokenStream::getToken()
{
if( m_cache_valid )
@@ -687,7 +696,7 @@ Token TokenStream::getToken()
}
else
{
- Token ret = this->realGetToken();
+ Token ret = this->innerGetToken();
::std::cout << "getToken[" << typeid(*this).name() << "] - " << ret << ::std::endl;
return ret;
}
@@ -723,7 +732,7 @@ eTokenType TokenStream::lookahead(unsigned int i)
while( i >= m_lookahead.size() )
{
DEBUG("lookahead - read #" << m_lookahead.size());
- m_lookahead.push_back( this->realGetToken() );
+ m_lookahead.push_back( this->innerGetToken() );
}
return m_lookahead[i].type();