mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #1454 from ethereum/end-of-comment
parser: recognize an end of comment of the form `**/`
This commit is contained in:
commit
5d1d81d270
@ -327,7 +327,12 @@ Token::Value Scanner::scanMultiLineDocComment()
|
|||||||
if (isLineTerminator(m_char))
|
if (isLineTerminator(m_char))
|
||||||
{
|
{
|
||||||
skipWhitespace();
|
skipWhitespace();
|
||||||
if (!m_source.isPastEndOfInput(1) && m_source.get(0) == '*' && m_source.get(1) != '/')
|
if (!m_source.isPastEndOfInput(1) && m_source.get(0) == '*' && m_source.get(1) == '*')
|
||||||
|
{ // it is unknown if this leads to the end of the comment
|
||||||
|
addCommentLiteralChar('*');
|
||||||
|
advance();
|
||||||
|
}
|
||||||
|
else if (!m_source.isPastEndOfInput(1) && m_source.get(0) == '*' && m_source.get(1) != '/')
|
||||||
{ // skip first '*' in subsequent lines
|
{ // skip first '*' in subsequent lines
|
||||||
if (charsAdded)
|
if (charsAdded)
|
||||||
addCommentLiteralChar('\n');
|
addCommentLiteralChar('\n');
|
||||||
|
@ -8378,6 +8378,18 @@ BOOST_AUTO_TEST_CASE(inline_assembly_invalidjumplabel)
|
|||||||
BOOST_CHECK(callContractFunction("f()") == encodeArgs());
|
BOOST_CHECK(callContractFunction("f()") == encodeArgs());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(contracts_separated_with_comment)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract C1 {}
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
contract C2 {}
|
||||||
|
)";
|
||||||
|
compileAndRun(sourceCode, 0, "C1");
|
||||||
|
compileAndRun(sourceCode, 0, "C2");
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -962,6 +962,19 @@ BOOST_AUTO_TEST_CASE(empty_comment)
|
|||||||
BOOST_CHECK(successParse(text));
|
BOOST_CHECK(successParse(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(comment_end_with_double_star)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract C1 {
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
}
|
||||||
|
contract C2 {}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK(successParse(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(library_simple)
|
BOOST_AUTO_TEST_CASE(library_simple)
|
||||||
{
|
{
|
||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
|
Loading…
Reference in New Issue
Block a user