QmlJS: Make the Scanner recognize regular expression literals.

Task-number: QTCREATORBUG-4566
Change-Id: I48b08f8eee79b25d0ebe186b996cdcb8f1979e3d
Reviewed-on: http://codereview.qt.nokia.com/38
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
Christian Kamm
2011-05-20 14:48:05 +02:00
parent 0350314b22
commit f027b1da87
4 changed files with 102 additions and 12 deletions

View File

@@ -116,6 +116,10 @@ void Highlighter::highlightBlock(const QString &text)
setFormat(token.offset, token.length, m_formats[CommentFormat]);
break;
case Token::RegExp:
setFormat(token.offset, token.length, m_formats[StringFormat]);
break;
case Token::LeftParenthesis:
onOpeningParenthesis('(', token.offset, index == 0);
break;
@@ -229,7 +233,8 @@ void Highlighter::highlightBlock(const QString &text)
switch (token.kind) {
case Token::Comment:
case Token::String: {
case Token::String:
case Token::RegExp: {
int i = token.begin(), e = token.end();
while (i < e) {
const QChar ch = text.at(i);