From 845bcf8db09c536c157a7575981daa42b6e6e938 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Thu, 10 Sep 2015 14:26:34 +0200 Subject: - added tests to test empty comment - fixed skipSingleLineComment - some style fixes --- libsolidity/Parser.cpp | 7 ++++--- libsolidity/Scanner.cpp | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'libsolidity') diff --git a/libsolidity/Parser.cpp b/libsolidity/Parser.cpp index e001d0f1..7f779ed0 100644 --- a/libsolidity/Parser.cpp +++ b/libsolidity/Parser.cpp @@ -69,7 +69,7 @@ ASTPointer Parser::parse(shared_ptr const& _scanner) m_scanner = _scanner; ASTNodeFactory nodeFactory(*this); vector> nodes; - while (_scanner->currentToken() != Token::EOS) + while (m_scanner->currentToken() != Token::EOS) { switch (m_scanner->currentToken()) { @@ -1076,8 +1076,9 @@ ASTPointer Parser::createEmptyParameterList() ParserError Parser::createParserError(string const& _description) const { - return ParserError() << errinfo_sourceLocation(SourceLocation(position(), position(), sourceName())) - << errinfo_comment(_description); + return ParserError() << + errinfo_sourceLocation(SourceLocation(position(), position(), sourceName())) << + errinfo_comment(_description); } diff --git a/libsolidity/Scanner.cpp b/libsolidity/Scanner.cpp index 374f78e4..d67b6423 100644 --- a/libsolidity/Scanner.cpp +++ b/libsolidity/Scanner.cpp @@ -224,7 +224,9 @@ Token::Value Scanner::skipSingleLineComment() // to be part of the single-line comment; it is recognized // separately by the lexical grammar and becomes part of the // stream of input elements for the syntactic grammar - while (advance() && !isLineTerminator(m_char)) { }; + while (!isLineTerminator(m_char)) + if (!advance()) break; + return Token::Whitespace; } -- cgit v1.2.3