diff --git a/libsolidity/Scanner.h b/libsolidity/Scanner.h index 0a6778ecd..94c67840a 100644 --- a/libsolidity/Scanner.h +++ b/libsolidity/Scanner.h @@ -118,7 +118,7 @@ public: /// Returns the next token and advances input. If called from reset() /// and ScanToken() found a documentation token then next should be called - /// with _change_skipped_comment=true + /// with _changeSkippedComment=true Token::Value next(bool _changeSkippedComment = false); ///@{ diff --git a/test/solidityScanner.cpp b/test/solidityScanner.cpp index 1a2299f37..573affe6d 100644 --- a/test/solidityScanner.cpp +++ b/test/solidityScanner.cpp @@ -174,6 +174,7 @@ BOOST_AUTO_TEST_CASE(comment_before_eos) { Scanner scanner(CharStream("//")); BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::EOS); + BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), ""); } BOOST_AUTO_TEST_CASE(documentation_comment_before_eos) @@ -183,6 +184,16 @@ BOOST_AUTO_TEST_CASE(documentation_comment_before_eos) BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), ""); } +BOOST_AUTO_TEST_CASE(comments_mixed_in_sequence) +{ + Scanner scanner(CharStream("hello_world ///documentation comment \n" + "//simple comment \n" + "<<")); + BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::IDENTIFIER); + BOOST_CHECK_EQUAL(scanner.next(), Token::SHL); + BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), "documentation comment "); +} + BOOST_AUTO_TEST_SUITE_END() }