@ -148,6 +148,11 @@ namespace Compiler
return false;
}
bool Parser::parseComment (const std::string& comment, const TokenLoc& loc, Scanner& scanner)
{
return true;
// Handle an EOF token.
//
// - Default-implementation: Report an error.
@ -82,6 +82,13 @@ namespace Compiler
///
/// - Default-implementation: Report an error.
virtual bool parseComment (const std::string& comment, const TokenLoc& loc,
Scanner& scanner);
///< Handle comment token.
/// \return fetch another token?
/// - Default-implementation: ignored (and return true).
virtual void parseEOF (Scanner& scanner);
///< Handle EOF token.
@ -88,6 +88,10 @@ namespace Compiler
else if (c==';')
std::string comment;
comment += c;
while (get (c))
if (c=='\n')
@ -95,11 +99,14 @@ namespace Compiler
putback (c);
break;
else
TokenLoc loc (mLoc);
mLoc.mLiteral.clear();
return parser.parseComment (comment, loc, *this);
else if (isWhitespace (c))