summaryrefslogtreecommitdiff
path: root/src/parse/tokenstream.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2017-08-19 23:14:31 +0800
committerJohn Hodge <tpg@ucc.asn.au>2017-08-19 23:14:31 +0800
commita205fad703a40c3018c2958cd4b52898dd30b1a8 (patch)
tree1cf0acf09a4eef146c1193bea85979ee9cff39c5 /src/parse/tokenstream.cpp
parent9d683a9b23fb30a6b08cb85b29135960f88d2721 (diff)
parent54eda831fff08ef95f8d2e06b1557b75f90f6f93 (diff)
downloadmrust-a205fad703a40c3018c2958cd4b52898dd30b1a8.tar.gz
Merge branch 'master' of https://github.com/thepowersgang/mrustc
Diffstat (limited to 'src/parse/tokenstream.cpp')
-rw-r--r--src/parse/tokenstream.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/parse/tokenstream.cpp b/src/parse/tokenstream.cpp
index 2975a523..901312a3 100644
--- a/src/parse/tokenstream.cpp
+++ b/src/parse/tokenstream.cpp
@@ -12,6 +12,7 @@
const bool DEBUG_PRINT_TOKENS = false;
//const bool DEBUG_PRINT_TOKENS = true;
//#define DEBUG_PRINT_TOKENS debug_enabled("Lexer Tokens")
+//#define FULL_TRACE
TokenStream::TokenStream():
m_cache_valid(false)
@@ -33,7 +34,9 @@ Token TokenStream::getToken()
{
if( m_cache_valid )
{
- //DEBUG("<<< " << m_cache << " (cache)");
+#ifdef FULL_TRACE
+ DEBUG("<<< " << m_cache << " (cache)");
+#endif
m_cache_valid = false;
return mv$(m_cache);
}
@@ -42,7 +45,9 @@ Token TokenStream::getToken()
Token ret = mv$( m_lookahead.front().first );
m_hygiene = m_lookahead.front().second;
m_lookahead.erase(m_lookahead.begin());
- //DEBUG("<<< " << ret << " (lookahead)");
+#ifdef FULL_TRACE
+ DEBUG("<<< " << ret << " (lookahead)");
+#endif
if( DEBUG_PRINT_TOKENS ) {
::std::cout << "getToken[" << typeid(*this).name() << "] - " << ret.get_pos() << "-" << ret << ::std::endl;
}
@@ -52,7 +57,9 @@ Token TokenStream::getToken()
{
Token ret = this->innerGetToken();
m_hygiene = this->realGetHygiene();
- //DEBUG("<<< " << ret << " (new)");
+#ifdef FULL_TRACE
+ DEBUG("<<< " << ret << " (new)");
+#endif
if( DEBUG_PRINT_TOKENS ) {
::std::cout << "getToken[" << typeid(*this).name() << "] - " << ret.get_pos() << "-" << ret << ::std::endl;
}
@@ -68,7 +75,9 @@ void TokenStream::putback(Token tok)
}
else
{
- //DEBUG(">>> " << tok);
+#ifdef FULL_TRACE
+ DEBUG(">>> " << tok);
+#endif
m_cache_valid = true;
m_cache = mv$(tok);
}