aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2014-11-19 23:21:42 +0800
committerLefteris Karapetsas <lefteris@refu.co>2014-11-19 23:21:42 +0800
commit6275b1ee93e5f4174a0ddd6da525dd9ca74edc09 (patch)
tree847c4782b72ca2c1250f52df986bd049144f7620
parenta461498300624766da2a3637e3b4bd483b67a01a (diff)
downloaddexon-solidity-6275b1ee93e5f4174a0ddd6da525dd9ca74edc09.tar.gz
dexon-solidity-6275b1ee93e5f4174a0ddd6da525dd9ca74edc09.tar.zst
dexon-solidity-6275b1ee93e5f4174a0ddd6da525dd9ca74edc09.zip
documentation comments are now always skipped but saved as special tokens at the Scanner
-rw-r--r--solidityScanner.cpp25
1 files changed, 5 insertions, 20 deletions
diff --git a/solidityScanner.cpp b/solidityScanner.cpp
index 28f52d3a..1a2299f3 100644
--- a/solidityScanner.cpp
+++ b/solidityScanner.cpp
@@ -155,15 +155,9 @@ BOOST_AUTO_TEST_CASE(ambiguities)
BOOST_AUTO_TEST_CASE(documentation_comments_parsed_begin)
{
- Scanner scanner(CharStream("/// Send $(value / 1000) chocolates to the user"), false);
- BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::COMMENT_LITERAL);
- BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), " Send $(value / 1000) chocolates to the user");
-}
-
-BOOST_AUTO_TEST_CASE(documentation_comments_skipped_begin)
-{
Scanner scanner(CharStream("/// Send $(value / 1000) chocolates to the user"));
BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::EOS);
+ BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), " Send $(value / 1000) chocolates to the user");
}
BOOST_AUTO_TEST_CASE(documentation_comments_parsed)
@@ -171,18 +165,9 @@ BOOST_AUTO_TEST_CASE(documentation_comments_parsed)
Scanner scanner(CharStream("some other tokens /// Send $(value / 1000) chocolates to the user"));
BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::IDENTIFIER);
BOOST_CHECK_EQUAL(scanner.next(), Token::IDENTIFIER);
- BOOST_CHECK_EQUAL(scanner.next(false), Token::IDENTIFIER);
- BOOST_CHECK_EQUAL(scanner.next(false), Token::COMMENT_LITERAL);
- BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), " Send $(value / 1000) chocolates to the user");
-}
-
-BOOST_AUTO_TEST_CASE(documentation_comments_skipped)
-{
- Scanner scanner(CharStream("some other tokens /// Send $(value / 1000) chocolates to the user"));
- BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::IDENTIFIER);
- BOOST_CHECK_EQUAL(scanner.next(), Token::IDENTIFIER);
BOOST_CHECK_EQUAL(scanner.next(), Token::IDENTIFIER);
BOOST_CHECK_EQUAL(scanner.next(), Token::EOS);
+ BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), " Send $(value / 1000) chocolates to the user");
}
BOOST_AUTO_TEST_CASE(comment_before_eos)
@@ -193,9 +178,9 @@ BOOST_AUTO_TEST_CASE(comment_before_eos)
BOOST_AUTO_TEST_CASE(documentation_comment_before_eos)
{
- Scanner scanner(CharStream("///"), false);
- BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::COMMENT_LITERAL);
- BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), "");
+ Scanner scanner(CharStream("///"));
+ BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::EOS);
+ BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), "");
}
BOOST_AUTO_TEST_SUITE_END()