Mercurial > mxe-octave
annotate src/qscintilla-3-matlab-block-comment.patch @ 4340:c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
* src/qscintilla-3-matlab-block-comment.patch: new patc file
* dist-files.mk: added qscintilla-3-matlab-block-comment.patch
author | John D |
---|---|
date | Thu, 19 Jan 2017 07:57:27 -0500 |
parents | |
children |
rev | line source |
---|---|
4340
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
1 diff -ur QScintilla_gpl-2.9.3.orig/lexers/LexMatlab.cpp QScintilla_gpl-2.9.3/lexers/LexMatlab.cpp |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
2 --- QScintilla_gpl-2.9.3.orig/lexers/LexMatlab.cpp 2017-01-18 08:06:39.577378613 -0500 |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
3 +++ QScintilla_gpl-2.9.3/lexers/LexMatlab.cpp 2017-01-18 08:21:30.775353161 -0500 |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
4 @@ -71,6 +71,16 @@ |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
5 return -1; |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
6 return 0; |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
7 } |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
8 + |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
9 +static bool IsSpaceToEOL(unsigned int startPos, Accessor &styler) { |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
10 + int line = styler.GetLine(startPos); |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
11 + unsigned int eol_pos = styler.LineStart(line + 1) - 1; |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
12 + for (unsigned int i = startPos; i < eol_pos; i++) { |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
13 + char ch = styler[i]; |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
14 + if(!IsASpace(ch)) return false; |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
15 + } |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
16 + return true; |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
17 +} |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
18 |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
19 static void ColouriseMatlabOctaveDoc( |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
20 unsigned int startPos, int length, int initStyle, |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
21 @@ -178,7 +188,7 @@ |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
22 } |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
23 } else if (sc.state == SCE_MATLAB_COMMENT) { |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
24 // end or start of a nested a block comment? |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
25 - if( IsCommentChar(sc.ch) && sc.chNext == '}' && nonSpaceColumn == column) { |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
26 + if( IsCommentChar(sc.ch) && sc.chNext == '}' && nonSpaceColumn == column && IsSpaceToEOL(sc.currentPos+2, styler)) { |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
27 if(commentDepth > 0) commentDepth --; |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
28 |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
29 curLine = styler.GetLine(sc.currentPos); |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
30 @@ -190,7 +200,7 @@ |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
31 transpose = false; |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
32 } |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
33 } |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
34 - else if( IsCommentChar(sc.ch) && sc.chNext == '{' && nonSpaceColumn == column) |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
35 + else if( IsCommentChar(sc.ch) && sc.chNext == '{' && nonSpaceColumn == column && IsSpaceToEOL(sc.currentPos+2, styler)) |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
36 { |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
37 commentDepth ++; |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
38 |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
39 @@ -211,9 +221,12 @@ |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
40 // check start of a new state |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
41 if (sc.state == SCE_MATLAB_DEFAULT) { |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
42 if (IsCommentChar(sc.ch)) { |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
43 - // ncrement depth if we are a block comment |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
44 - if(sc.chNext == '{' && nonSpaceColumn == column) |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
45 - commentDepth ++; |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
46 + // Increment depth if we are a block comment |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
47 + if(sc.chNext == '{' && nonSpaceColumn == column) { |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
48 + if(IsSpaceToEOL(sc.currentPos+2, styler)) { |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
49 + commentDepth ++; |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
50 + } |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
51 + } |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
52 curLine = styler.GetLine(sc.currentPos); |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
53 styler.SetLineState(curLine, commentDepth); |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
54 sc.SetState(SCE_MATLAB_COMMENT); |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
55 @@ -287,9 +300,9 @@ |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
56 // a line that starts with a comment |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
57 if (style == SCE_MATLAB_COMMENT && IsComment(ch) && visibleChars == 0) { |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
58 // start/end of block comment |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
59 - if (chNext == '{') |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
60 + if (chNext == '{' && IsSpaceToEOL(i+2, styler)) |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
61 levelNext ++; |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
62 - if (chNext == '}') |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
63 + if (chNext == '}' && IsSpaceToEOL(i+2, styler)) |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
64 levelNext --; |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
65 } |
c202df909032
sqcintilla: add patch for proper matlab block comment detection (Bug #50060)
John D
parents:
diff
changeset
|
66 // keyword |