syntax colouring for comments

actorid
Marc Zinnschlag 12 years ago
parent 6d3a2cd5a0
commit f17cebde0a

@ -40,6 +40,13 @@ bool CSVWorld::ScriptHighlighter::parseSpecial (int code, const Compiler::TokenL
return true;
}
bool CSVWorld::ScriptHighlighter::parseComment (const std::string& comment,
const Compiler::TokenLoc& loc, Compiler::Scanner& scanner)
{
highlight (loc, Type_Comment);
return true;
}
void CSVWorld::ScriptHighlighter::parseEOF (Compiler::Scanner& scanner)
{}
@ -67,7 +74,7 @@ CSVWorld::ScriptHighlighter::ScriptHighlighter (QTextDocument *parent)
{
QTextCharFormat format;
format.setForeground (Qt::green);
format.setForeground (Qt::magenta);
mScheme.insert (std::make_pair (Type_Float, format));
}
@ -88,6 +95,12 @@ CSVWorld::ScriptHighlighter::ScriptHighlighter (QTextDocument *parent)
format.setForeground (Qt::darkYellow);
mScheme.insert (std::make_pair (Type_Special, format));
}
{
QTextCharFormat format;
format.setForeground (Qt::green);
mScheme.insert (std::make_pair (Type_Comment, format));
}
}
void CSVWorld::ScriptHighlighter::highlightBlock (const QString& text)

@ -22,7 +22,8 @@ namespace CSVWorld
Type_Float,
Type_Name,
Type_Keyword,
Type_Special
Type_Special,
Type_Comment
};
private:
@ -58,7 +59,9 @@ namespace CSVWorld
///< Handle a special character token.
/// \return fetch another token?
///< Handle a special character token.
virtual bool parseComment (const std::string& comment, const Compiler::TokenLoc& loc,
Compiler::Scanner& scanner);
///< Handle comment token.
/// \return fetch another token?
virtual void parseEOF (Compiler::Scanner& scanner);

Loading…
Cancel
Save