diff --git a/libsolidity/parsing/DocStringParser.cpp b/libsolidity/parsing/DocStringParser.cpp index 33cdbd937..9f6f13f94 100644 --- a/libsolidity/parsing/DocStringParser.cpp +++ b/libsolidity/parsing/DocStringParser.cpp @@ -94,19 +94,12 @@ void DocStringParser::parse(string const& _docString, ErrorReporter& _errorRepor { // we found a tag auto tagNameEndPos = firstWhitespaceOrNewline(tagPos, end); - if (tagNameEndPos == end) - { - m_errorReporter->docstringParsingError( - 9222_error, - "End of tag " + string(tagPos, tagNameEndPos) + " not found" - ); - break; - } - - currPos = parseDocTag(tagNameEndPos + 1, end, string(tagPos + 1, tagNameEndPos)); + auto tagName = string(tagPos + 1, tagNameEndPos); + auto tagDataPos = (tagNameEndPos != end) ? tagNameEndPos + 1 : tagNameEndPos; + currPos = parseDocTag(tagDataPos, end, tagName); } else if (!!m_lastTag) // continuation of the previous tag - currPos = appendDocTag(currPos, end); + currPos = parseDocTagLine(currPos, end, true); else if (currPos != end) { // if it begins without a tag then consider it as @notice @@ -127,7 +120,7 @@ DocStringParser::iter DocStringParser::parseDocTagLine(iter _pos, iter _end, boo { solAssert(!!m_lastTag, ""); auto nlPos = find(_pos, _end, '\n'); - if (_appending && _pos < _end && *_pos != ' ' && *_pos != '\t') + if (_appending && _pos != _end && *_pos != ' ' && *_pos != '\t') m_lastTag->content += " "; else if (!_appending) _pos = skipWhitespace(_pos, _end); @@ -179,13 +172,7 @@ DocStringParser::iter DocStringParser::parseDocTag(iter _pos, iter _end, string } } else - return appendDocTag(_pos, _end); -} - -DocStringParser::iter DocStringParser::appendDocTag(iter _pos, iter _end) -{ - solAssert(!!m_lastTag, ""); - return parseDocTagLine(_pos, _end, true); + return parseDocTagLine(_pos, _end, true); } void DocStringParser::newTag(string const& _tagName) diff --git a/libsolidity/parsing/DocStringParser.h b/libsolidity/parsing/DocStringParser.h index eaf18503b..d5ebd2383 100644 --- a/libsolidity/parsing/DocStringParser.h +++ b/libsolidity/parsing/DocStringParser.h @@ -50,7 +50,6 @@ private: iter parseDocTagParam(iter _pos, iter _end); iter appendDocTagParam(iter _pos, iter _end); void parseDocString(std::string const& _string); - iter appendDocTag(iter _pos, iter _end); /// Parses the doc tag named @a _tag, adds it to m_docTags and returns the position /// after the tag. iter parseDocTag(iter _pos, iter _end, std::string const& _tag); diff --git a/test/libsolidity/syntaxTests/natspec/docstring_empty_tag.sol b/test/libsolidity/syntaxTests/natspec/docstring_empty_tag.sol index e014104da..5ab6b8260 100644 --- a/test/libsolidity/syntaxTests/natspec/docstring_empty_tag.sol +++ b/test/libsolidity/syntaxTests/natspec/docstring_empty_tag.sol @@ -3,4 +3,4 @@ abstract contract C { function vote(uint id) public {} } // ---- -// DocstringParsingError 9222: End of tag @param not found +// DocstringParsingError 3335: No param name given