mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
commit
8355c0ad40
@ -69,7 +69,7 @@ ASTPointer<SourceUnit> Parser::parse(shared_ptr<Scanner> const& _scanner)
|
||||
m_scanner = _scanner;
|
||||
ASTNodeFactory nodeFactory(*this);
|
||||
vector<ASTPointer<ASTNode>> nodes;
|
||||
while (_scanner->currentToken() != Token::EOS)
|
||||
while (m_scanner->currentToken() != Token::EOS)
|
||||
{
|
||||
switch (m_scanner->currentToken())
|
||||
{
|
||||
@ -1076,8 +1076,9 @@ ASTPointer<ParameterList> 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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -527,6 +527,22 @@ BOOST_AUTO_TEST_CASE(natspec_multiline_notice_without_tag)
|
||||
checkNatspec(sourceCode, natspec, true);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(empty_comment)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
//
|
||||
contract test
|
||||
{}
|
||||
)";
|
||||
char const* natspec = R"ABCDEF(
|
||||
{
|
||||
"methods" : {}
|
||||
}
|
||||
)ABCDEF";
|
||||
|
||||
checkNatspec(sourceCode, natspec, true);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
@ -914,6 +914,16 @@ BOOST_AUTO_TEST_CASE(location_specifiers_with_var)
|
||||
BOOST_CHECK_THROW(parseText(text), ParserError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(empty_comment)
|
||||
{
|
||||
char const* text = R"(
|
||||
//
|
||||
contract test
|
||||
{}
|
||||
)";
|
||||
BOOST_CHECK_NO_THROW(parseText(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
@ -281,6 +281,16 @@ BOOST_AUTO_TEST_CASE(time_after)
|
||||
BOOST_CHECK_EQUAL(scanner.currentToken(), Token::After);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(empty_comment)
|
||||
{
|
||||
Scanner scanner(CharStream("//\ncontract{}"));
|
||||
BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), "");
|
||||
BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Contract);
|
||||
BOOST_CHECK_EQUAL(scanner.next(), Token::LBrace);
|
||||
BOOST_CHECK_EQUAL(scanner.next(), Token::RBrace);
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user