From e145c6ae5346a9c06561d696d49baff520ad0e04 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Thu, 15 Apr 2010 15:35:52 +0200 Subject: [PATCH] QmlJSEditor: Fix brace matching for "A on b {" syntax. Reviewed-by: Roberto Raggi --- src/plugins/qmljseditor/qmljshighlighter.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/qmljseditor/qmljshighlighter.cpp b/src/plugins/qmljseditor/qmljshighlighter.cpp index 3ef4a8ace3d..685d7bb80ce 100644 --- a/src/plugins/qmljseditor/qmljshighlighter.cpp +++ b/src/plugins/qmljseditor/qmljshighlighter.cpp @@ -169,16 +169,16 @@ void Highlighter::highlightBlock(const QString &text) const int start = index; - ++index; // skip the identifier. - while (index + 1 < tokens.size() && - tokens.at(index).is(Token::Dot) && - tokens.at(index + 1).is(Token::Identifier)) { + // put index on last identifier not followed by .identifier + while (index + 2 < tokens.size() && + tokens.at(index + 1).is(Token::Dot) && + tokens.at(index + 2).is(Token::Identifier)) { index += 2; } - if (index < tokens.size() && tokens.at(index).is(expectedTerminator)) { + if (index + 1 < tokens.size() && tokens.at(index + 1).is(expectedTerminator)) { // it's a binding. - for (int i = start; i < index; ++i) { + for (int i = start; i <= index; ++i) { const Token &tok = tokens.at(i); setFormat(tok.offset, tok.length, m_formats[LabelFormat]); }