First step at detecting dollar quoted strings. Dollar quotes

are now recognized by the lexical analyzer.

Plan is to let the parser decide how to handle the content.
This commit is contained in:
Eelke Klein 2017-09-10 10:13:58 +02:00
parent 56bd304756
commit 45515f936b
4 changed files with 53 additions and 4 deletions

View file

@ -117,6 +117,9 @@ SqlSyntaxHighlighter::SqlSyntaxHighlighter(QTextDocument *parent)
m_typeFormat.setForeground(QColor(32, 192, 32));
m_typeFormat.setFontWeight(QFont::Bold);
m_parameterFormat.setForeground(QColor(192, 32, 32));
m_parameterFormat.setFontWeight(QFont::Bold);
}
SqlSyntaxHighlighter::~SqlSyntaxHighlighter()
@ -144,7 +147,7 @@ void SqlSyntaxHighlighter::highlightBlock(const QString &text)
switch (tokentype) {
case BasicTokenType::None:
case BasicTokenType::End: // End of input
case BasicTokenType::DollarQuotedString:
case BasicTokenType::DollarQuote:
break;
case BasicTokenType::Symbol: // can be many things, keyword, object name, operator, ..
if (g_Keywords.count(s.toLower()) > 0) {
@ -166,6 +169,9 @@ void SqlSyntaxHighlighter::highlightBlock(const QString &text)
case BasicTokenType::QuotedIdentifier:
setFormat(startpos, length, m_quotedIdentifierFormat);
break;
case BasicTokenType::Parameter:
setFormat(startpos, length, m_parameterFormat);
break;
}
}
}