Newline right after doctag is now a valid natspec entry

- Plus tests for that
This commit is contained in:
Lefteris Karapetsas 2014-12-05 12:27:18 +01:00
parent 11cac68cf4
commit 27ef18865d

View File

@ -137,8 +137,8 @@ void InterfaceHandler::resetDev()
m_params.clear(); m_params.clear();
} }
std::string::const_iterator skipLineOrEOS(std::string::const_iterator _nlPos, static inline std::string::const_iterator skipLineOrEOS(std::string::const_iterator _nlPos,
std::string::const_iterator _end) std::string::const_iterator _end)
{ {
return (_nlPos == _end) ? _end : ++_nlPos; return (_nlPos == _end) ? _end : ++_nlPos;
} }
@ -239,6 +239,14 @@ std::string::const_iterator InterfaceHandler::appendDocTag(std::string::const_it
} }
} }
static inline std::string::const_iterator getFirstSpaceOrNl(std::string::const_iterator _pos,
std::string::const_iterator _end)
{
auto spacePos = std::find(_pos, _end, ' ');
auto nlPos = std::find(_pos, _end, '\n');
return (spacePos < nlPos) ? spacePos : nlPos;
}
void InterfaceHandler::parseDocString(std::string const& _string) void InterfaceHandler::parseDocString(std::string const& _string)
{ {
auto currPos = _string.begin(); auto currPos = _string.begin();
@ -252,7 +260,7 @@ void InterfaceHandler::parseDocString(std::string const& _string)
if (tagPos != end && tagPos < nlPos) if (tagPos != end && tagPos < nlPos)
{ {
// we found a tag // we found a tag
auto tagNameEndPos = std::find(tagPos, end, ' '); auto tagNameEndPos = getFirstSpaceOrNl(tagPos, end);
if (tagNameEndPos == end) if (tagNameEndPos == end)
BOOST_THROW_EXCEPTION(DocstringParsingError() << BOOST_THROW_EXCEPTION(DocstringParsingError() <<
errinfo_comment("End of tag " + std::string(tagPos, tagNameEndPos) + "not found")); errinfo_comment("End of tag " + std::string(tagPos, tagNameEndPos) + "not found"));