mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
cleaning up the external interface of Scanner::next(). No special cases
This commit is contained in:
parent
a93916b5f9
commit
cda2532de6
10
Scanner.cpp
10
Scanner.cpp
@ -109,7 +109,11 @@ void Scanner::reset(CharStream const& _source)
|
|||||||
m_char = m_source.get();
|
m_char = m_source.get();
|
||||||
skipWhitespace();
|
skipWhitespace();
|
||||||
foundDocComment = scanToken();
|
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.
|
// Ensure that tokens can be stored in a byte.
|
||||||
BOOST_STATIC_ASSERT(Token::NUM_TOKENS <= 0x100);
|
BOOST_STATIC_ASSERT(Token::NUM_TOKENS <= 0x100);
|
||||||
|
|
||||||
Token::Value Scanner::next(bool _changeSkippedComment)
|
Token::Value Scanner::next()
|
||||||
{
|
{
|
||||||
m_current_token = m_next_token;
|
m_current_token = m_next_token;
|
||||||
if (scanToken() || _changeSkippedComment)
|
if (scanToken())
|
||||||
m_skipped_comment = m_next_skipped_comment;
|
m_skipped_comment = m_next_skipped_comment;
|
||||||
return m_current_token.token;
|
return m_current_token.token;
|
||||||
}
|
}
|
||||||
|
@ -116,10 +116,8 @@ public:
|
|||||||
/// Resets the scanner as if newly constructed with _input as input.
|
/// Resets the scanner as if newly constructed with _input as input.
|
||||||
void reset(CharStream const& _source);
|
void reset(CharStream const& _source);
|
||||||
|
|
||||||
/// Returns the next token and advances input. If called from reset()
|
/// Returns the next token and advances input
|
||||||
/// and ScanToken() found a documentation token then next should be called
|
Token::Value next();
|
||||||
/// with _changeSkippedComment=true
|
|
||||||
Token::Value next(bool _changeSkippedComment = false);
|
|
||||||
|
|
||||||
///@{
|
///@{
|
||||||
///@name Information about the current token
|
///@name Information about the current token
|
||||||
|
Loading…
Reference in New Issue
Block a user