added comment token (for use in syntax colouring)

actorid
Marc Zinnschlag 12 years ago
parent 74145410f2
commit 6d3a2cd5a0

@ -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
comment += c;
}
TokenLoc loc (mLoc);
mLoc.mLiteral.clear();
return true;
return parser.parseComment (comment, loc, *this);
}
else if (isWhitespace (c))
{

Loading…
Cancel
Save