19 : QSyntaxHighlighter( parent )
25 QStringList keywordPatterns;
26 keywordPatterns <<
"\\bCASE\\b" <<
"\\bWHEN\\b" <<
"\\bTHEN\\b"
27 <<
"\\bELSE\\b" <<
"\\bEND\\b";
29 foreach (
const QString &pattern, keywordPatterns )
31 rule.
pattern = QRegExp( pattern, Qt::CaseInsensitive );
37 rule.
pattern = QRegExp(
"\'[^\'\r\n]*\'" );
42 rule.
pattern = QRegExp(
"\"[^\"\r\n]*\"" );
51 foreach (
const QString field, fieldList )
53 if ( field.isEmpty() )
55 rule.
pattern = QRegExp(
"\\b" + field +
"\\b" );
65 QRegExp expression( rule.
pattern );
66 int index = expression.indexIn( text );
69 int length = expression.matchedLength();
72 setFormat( index, length, rule.
format );
73 index = expression.indexIn( text, index + length );