Browse Source

Fixing multiline comment parsing in solidity

cl-refactor
Lefteris Karapetsas 10 years ago
parent
commit
170ff1a07f
  1. 6
      libsolidity/Scanner.cpp
  2. 2
      libsolidity/Scanner.h
  3. 2
      test/solidityParser.cpp

6
libsolidity/Scanner.cpp

@ -193,8 +193,8 @@ Token::Value Scanner::scanDocumentationComment()
m_source.get(2) == '/' &&
!m_source.isPastEndOfInput(3))
{
m_source.advanceBy(3);
addCommentLiteralChar('\n');
m_char = m_source.advanceBy(3);
}
else
break; // next line is not a documentation comment, we are done
@ -793,12 +793,14 @@ char CharStream::advanceAndGet()
return get();
}
void CharStream::advanceBy(size_t _chars)
char CharStream::advanceBy(size_t _chars)
{
if (asserts(!isPastEndOfInput(_chars)))
BOOST_THROW_EXCEPTION(InternalCompilerError());
m_pos += _chars;
return m_source[m_pos];
}
char CharStream::rollback(size_t _amount)

2
libsolidity/Scanner.h

@ -77,7 +77,7 @@ public:
bool isPastEndOfInput(size_t _charsForward = 0) const { return (m_pos + _charsForward) >= m_source.size(); }
char get(size_t _charsForward = 0) const { return m_source[m_pos + _charsForward]; }
char advanceAndGet();
void advanceBy(size_t _chars);
char advanceBy(size_t _chars);
char rollback(size_t _amount);
///@{

2
test/solidityParser.cpp

@ -153,7 +153,6 @@ BOOST_AUTO_TEST_CASE(multiple_functions_natspec_documentation)
BOOST_CHECK_EQUAL(function->getDocumentation(), " This is test function 4");
}
#if 0 /* Work in progress - currently fails*/
BOOST_AUTO_TEST_CASE(multiline_function_documentation)
{
ASTPointer<ContractDefinition> contract;
@ -172,7 +171,6 @@ BOOST_AUTO_TEST_CASE(multiline_function_documentation)
" This is a test function\n"
" and it has 2 lines");
}
#endif
BOOST_AUTO_TEST_CASE(struct_definition)
{

Loading…
Cancel
Save