Showing the changes to interface/src/ScriptHighlighting.cpp (1 of 2 files). Show all
Unified · Split
| @@ -16,7 +16,7 @@ ScriptHighlighting::ScriptHighlighting(QTextDocument* parent) : · 15 unmodified lines | ||
| 16 | 16 | QSyntaxHighlighter(parent) |
| 17 | 17 | { |
| 18 | 18 | _keywordRegex = QRegExp("\\b(break|case|catch|continue|debugger|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|this|throw|try|typeof|var|void|while|with)\\b"); |
| 19 | − _qoutedTextRegex = QRegExp("\"[^\"]*(\"){0,1}"); | |
| 19 | + _quotedTextRegex = QRegExp("(\"[^\"]*(\"){0,1}|\'[^\']*(\'){0,1})"); | |
| 20 | 20 | _multiLineCommentBegin = QRegExp("/\\*"); |
| 21 | 21 | _multiLineCommentEnd = QRegExp("\\*/"); |
| 22 | 22 | _numberRegex = QRegExp("[0-9]+(\\.[0-9]+){0,1}"); |
| @@ -29,7 +29,7 @@ void ScriptHighlighting::highlightBlock(const QString& text) { · 6 unmodified lines | ||
| 29 | 29 | this->highlightKeywords(text); |
| 30 | 30 | this->formatNumbers(text); |
| 31 | 31 | this->formatTrueFalse(text); |
| 32 | − this->formatQoutedText(text); | |
| 32 | + this->formatQuotedText(text); | |
| 33 | 33 | this->formatComments(text); |
| 34 | 34 | } |
| 35 | 35 | |
| @@ -61,14 +61,14 @@ void ScriptHighlighting::formatComments(const QString& text) { · 25 unmodified lines | ||
| 61 | 61 | int index = _singleLineComment.indexIn(text); |
| 62 | 62 | while (index >= 0) { |
| 63 | 63 | int length = _singleLineComment.matchedLength(); |
| 64 | − int quoted_index = _qoutedTextRegex.indexIn(text); | |
| 64 | + int quoted_index = _quotedTextRegex.indexIn(text); | |
| 65 | 65 | bool valid = true; |
| 66 | 66 | while (quoted_index >= 0 && valid) { |
| 67 | − int quoted_length = _qoutedTextRegex.matchedLength(); | |
| 67 | + int quoted_length = _quotedTextRegex.matchedLength(); | |
| 68 | 68 | if (quoted_index <= index && index <= (quoted_index + quoted_length)) { |
| 69 | 69 | valid = false; |
| 70 | 70 | } |
| 71 | − quoted_index = _qoutedTextRegex.indexIn(text, quoted_index + quoted_length); | |
| 71 | + quoted_index = _quotedTextRegex.indexIn(text, quoted_index + quoted_length); | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | if (valid) { |
| @@ -78,12 +78,12 @@ void ScriptHighlighting::formatComments(const QString& text) { · 3 unmodified lines | ||
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | −void ScriptHighlighting::formatQoutedText(const QString& text){ | |
| 82 | − int index = _qoutedTextRegex.indexIn(text); | |
| 81 | +void ScriptHighlighting::formatQuotedText(const QString& text){ | |
| 82 | + int index = _quotedTextRegex.indexIn(text); | |
| 83 | 83 | while (index >= 0) { |
| 84 | − int length = _qoutedTextRegex.matchedLength(); | |
| 84 | + int length = _quotedTextRegex.matchedLength(); | |
| 85 | 85 | setFormat(index, length, Qt::red); |
| 86 | − index = _qoutedTextRegex.indexIn(text, index + length); | |
| 86 | + index = _quotedTextRegex.indexIn(text, index + length); | |
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | |