aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Sirgienko <[email protected]>2018-04-11 21:51:13 +0200
committerAlexander Semke <[email protected]>2018-04-11 22:05:21 +0200
commita233f452fd29203cdd27f09280e9610d9e835c97 (patch)
tree8f0ccaba1a5b7ef7ba99a445c00741ef4d63a80d
parent1d94ea5d797f7b2da9a9c1c8332694d149b6f542 (diff)
Fix incorrect regexs for string in backend highlightersv18.04.0
Summary: Now string highlighter regex highlighte two strings, standing neary, as one string, that incorrect. So it fix it. Test Plan: 1) Open Octave, Scilab, Lua, Sage session, write `'3', '4', '5'` 2) Make sure, that string highlighting wrong. 3) Appy the patch 4) Test again and check, that all okay Reviewers: #cantor, asemke Subscribers: #cantor, #kde_edu Tags: #kde_edu, #cantor Differential Revision: https://phabricator.kde.org/D12052
-rw-r--r--src/backends/lua/luahighlighter.cpp4
-rw-r--r--src/backends/octave/octavehighlighter.cpp4
-rw-r--r--src/backends/sage/sagehighlighter.cpp4
-rw-r--r--src/backends/scilab/scilabhighlighter.cpp4
4 files changed, 8 insertions, 8 deletions
diff --git a/src/backends/lua/luahighlighter.cpp b/src/backends/lua/luahighlighter.cpp
index 3a6bec7..28c78a1 100644
--- a/src/backends/lua/luahighlighter.cpp
+++ b/src/backends/lua/luahighlighter.cpp
@@ -28,8 +28,8 @@ LuaHighlighter::LuaHighlighter(QObject* parent): DefaultHighlighter(parent)
addVariables( luahelper_variables() );
addRule(QRegExp(QLatin1String("[A-Za-z0-9_]+(?=\\()")) , functionFormat());
- addRule(QRegExp(QLatin1String("\".*\"")) , stringFormat());
- addRule(QRegExp(QLatin1String("'.*'")) , stringFormat());
+ addRule(QRegExp(QLatin1String("\"[^\"]*\"")) , stringFormat());
+ addRule(QRegExp(QLatin1String("'[^\'].*'")) , stringFormat());
addRule(QRegExp(QLatin1String("--[^\n]*")) , commentFormat());
// did not add support for the multiline comment or multiline string
}
diff --git a/src/backends/octave/octavehighlighter.cpp b/src/backends/octave/octavehighlighter.cpp
index f3a8b3a..24fa09c 100644
--- a/src/backends/octave/octavehighlighter.cpp
+++ b/src/backends/octave/octavehighlighter.cpp
@@ -42,8 +42,8 @@ OctaveHighlighter::OctaveHighlighter(QObject* parent, Cantor::Session* session):
m_keywords << QLatin1String("end");
addKeywords(m_keywords);
- addRule(QRegExp(QLatin1String("\".*\"")), stringFormat());
- addRule(QRegExp(QLatin1String("'.*'")), stringFormat());
+ addRule(QRegExp(QLatin1String("\"[^\"]*\"")), stringFormat());
+ addRule(QRegExp(QLatin1String("'[^']*'")), stringFormat());
rehighlight();
}
diff --git a/src/backends/sage/sagehighlighter.cpp b/src/backends/sage/sagehighlighter.cpp
index 0b3c3a0..cb25926 100644
--- a/src/backends/sage/sagehighlighter.cpp
+++ b/src/backends/sage/sagehighlighter.cpp
@@ -73,8 +73,8 @@ SageHighlighter::SageHighlighter(QObject* parent) : Cantor::DefaultHighlighter(p
<< QLatin1String("Warning") << QLatin1String("WindowsError") << QLatin1String("ZeroDivisionError");
addRules(exceptionPatterns, objectFormat());
- addRule(QRegExp(QLatin1String("\".*\"")), stringFormat());
- addRule(QRegExp(QLatin1String("'.*'")), stringFormat());
+ addRule(QRegExp(QLatin1String("\"[^\"]*\"")), stringFormat());
+ addRule(QRegExp(QLatin1String("'[^']*'")), stringFormat());
addRule(QRegExp(QLatin1String("#[^\n]*")), commentFormat());
}
diff --git a/src/backends/scilab/scilabhighlighter.cpp b/src/backends/scilab/scilabhighlighter.cpp
index 826f62e..8cc8b57 100644
--- a/src/backends/scilab/scilabhighlighter.cpp
+++ b/src/backends/scilab/scilabhighlighter.cpp
@@ -38,8 +38,8 @@ ScilabHighlighter::ScilabHighlighter(QObject* parent) : Cantor::DefaultHighlight
addFunctions(ScilabKeywords::instance()->functions());
addVariables(ScilabKeywords::instance()->variables());
- addRule(QRegExp(QLatin1String("\".*\"")), stringFormat());
- addRule(QRegExp(QLatin1String("'.*'")), stringFormat());
+ addRule(QRegExp(QLatin1String("\"[^\"]*\"")), stringFormat());
+ addRule(QRegExp(QLatin1String("'[^']*'")), stringFormat());
addRule(QRegExp(QLatin1String("//[^\n]*")), commentFormat());
commentStartExpression = QRegExp(QLatin1String("/\\*"));