changeset 4406:ca55304a3cfd

qscintilla: patch for end keyword in places where is index * src/qscintilla-4-matlab-end-op.patch: new file * dist-files.mk: added qscintilla-4-matlab-end-op.patch
author John D
date Mon, 03 Jul 2017 09:23:08 -0400
parents 1a92716b1682
children e9b032b9340a
files dist-files.mk src/qscintilla-4-matlab-end-op.patch
diffstat 2 files changed, 38 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dist-files.mk	Tue Jun 27 08:42:57 2017 -0400
+++ b/dist-files.mk	Mon Jul 03 09:23:08 2017 -0400
@@ -572,6 +572,7 @@
   qscintilla-1-fixes.patch \
   qscintilla-2-matlab-fold.patch \
   qscintilla-3-matlab-block-comment.patch \
+  qscintilla-4-matlab-end-op.patch \
   qscintilla.mk \
   qt-1-cherrypicks.patch \
   qt-2-shared-tools-fixes.patch \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/qscintilla-4-matlab-end-op.patch	Mon Jul 03 09:23:08 2017 -0400
@@ -0,0 +1,37 @@
+diff -ur QScintilla_gpl-2.9.3.orig/lexers/LexMatlab.cpp QScintilla_gpl-2.9.3/lexers/LexMatlab.cpp
+--- QScintilla_gpl-2.9.3.orig/lexers/LexMatlab.cpp	2017-06-26 15:15:10.807062925 -0400
++++ QScintilla_gpl-2.9.3/lexers/LexMatlab.cpp	2017-06-28 11:28:33.474725694 -0400
+@@ -96,6 +96,9 @@
+ 	// of a string
+ 	bool transpose = false;
+ 
++	// count for brackets for when 'end' could be an operator not a keyword
++	int allow_end_op = 0;
++
+ 	// approximate position of first non space character in a line
+ 	int nonSpaceColumn = -1;
+ 	// approximate column position of the current character in a line
+@@ -150,6 +153,9 @@
+ 				char s[100];
+ 				sc.GetCurrentLowered(s, sizeof(s));
+ 				if (keywords.InList(s)) {
++					if (strcmp ("end", s) == 0 && allow_end_op > 0) {
++						sc.ChangeState(SCE_MATLAB_NUMBER);
++					}
+ 					sc.SetState(SCE_MATLAB_DEFAULT);
+ 					transpose = false;
+ 				} else {
+@@ -249,6 +255,12 @@
+ 			} else if (isalpha(sc.ch)) {
+ 				sc.SetState(SCE_MATLAB_KEYWORD);
+ 			} else if (isoperator(static_cast<char>(sc.ch)) || sc.ch == '@' || sc.ch == '\\') {
++				if (sc.ch == '(' || sc.ch == '[' || sc.ch == '{') {
++					allow_end_op ++;
++				} else if ((sc.ch == ')' || sc.ch == ']' || sc.ch == '}') && (allow_end_op > 0)) {
++					allow_end_op --;
++				}
++
+ 				if (sc.ch == ')' || sc.ch == ']' || sc.ch == '}') {
+ 					transpose = true;
+ 				} else {
+Only in QScintilla_gpl-2.9.3/lexers: .LexMatlab.cpp.swp