diff options
author | Lefteris Karapetsas <lefteris@refu.co> | 2014-11-21 06:56:24 +0800 |
---|---|---|
committer | Lefteris Karapetsas <lefteris@refu.co> | 2014-11-21 06:56:24 +0800 |
commit | cda2532de6886a1b6735387b807490b5ff4556ae (patch) | |
tree | 18c1a3211f38409b35e27d4783a6efc7db92a8e5 /Scanner.cpp | |
parent | a93916b5f9df5a71c890150ad705147d040264df (diff) | |
download | dexon-solidity-cda2532de6886a1b6735387b807490b5ff4556ae.tar.gz dexon-solidity-cda2532de6886a1b6735387b807490b5ff4556ae.tar.zst dexon-solidity-cda2532de6886a1b6735387b807490b5ff4556ae.zip |
cleaning up the external interface of Scanner::next(). No special cases
Diffstat (limited to 'Scanner.cpp')
-rw-r--r-- | Scanner.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Scanner.cpp b/Scanner.cpp index 934b30dc..d3000099 100644 --- a/Scanner.cpp +++ b/Scanner.cpp @@ -109,7 +109,11 @@ void Scanner::reset(CharStream const& _source) m_char = m_source.get(); skipWhitespace(); foundDocComment = scanToken(); - next(foundDocComment); + + // special version of Scanner:next() taking the previous scanToken() result into account + m_current_token = m_next_token; + if (scanToken() || foundDocComment) + m_skipped_comment = m_next_skipped_comment; } @@ -135,10 +139,10 @@ bool Scanner::scanHexByte(char& o_scannedByte) // Ensure that tokens can be stored in a byte. BOOST_STATIC_ASSERT(Token::NUM_TOKENS <= 0x100); -Token::Value Scanner::next(bool _changeSkippedComment) +Token::Value Scanner::next() { m_current_token = m_next_token; - if (scanToken() || _changeSkippedComment) + if (scanToken()) m_skipped_comment = m_next_skipped_comment; return m_current_token.token; } |