Commit a233f452 authored by Nikita Sirgienko's avatar Nikita Sirgienko Committed by Alexander Semke

Fix incorrect regexs for string in backend highlighters

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
parent 1d94ea5d
......@@ -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
}
......
......@@ -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();
}
......
......@@ -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());
}
......
......@@ -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("/\\*"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment