view src/qscintilla-3-matlab-end-op.patch @ 4654:b9e4ebcad82f

disable doc extraction for optim package Disable the rules for extracting doc strings because they don't work when cross compiling. Our patches to the source files don't touch the doc strings, so there is no need to update them anyway.
author John W. Eaton <jwe@octave.org>
date Tue, 10 Apr 2018 07:50:10 -0400
parents 9b1f851080b6
children
line wrap: on
line source

diff -ur QScintilla_gpl-2.10.1.orig/lexers/LexMatlab.cpp QScintilla_gpl-2.10.1/lexers/LexMatlab.cpp
--- QScintilla_gpl-2.10.1.orig/lexers/LexMatlab.cpp	2017-07-05 08:21:58.527158553 -0400
+++ QScintilla_gpl-2.10.1/lexers/LexMatlab.cpp	2017-07-05 08:22:26.304941561 -0400
@@ -97,6 +97,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
@@ -151,6 +154,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 {
@@ -250,6 +256,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.10.1/lexers: LexMatlab.cpp.orig
Only in QScintilla_gpl-2.10.1/lexers: LexMatlab.cpp.rej