aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohn Donoghue <john.donoghue@ieee.org>2014-01-18 12:46:40 -0500
committerJohn Donoghue <john.donoghue@ieee.org>2014-01-18 12:46:40 -0500
commitf7c94f28fa3c811239c2d4ea2bec35c4a8a1e637 (patch)
tree40f217660a3bc255831d1c32156f8dce9911739e
parent3afa32a01d35976eba261e139557fbc7787247bf (diff)
downloadscintilla-mirror-f7c94f28fa3c811239c2d4ea2bec35c4a8a1e637.tar.gz
Support octave vs matlab '!' handling
* lexers/LexMatlab.cxx (ColouriseMatlabOctaveDocument): Add ismatlab boolean to function, and on getting the '!', check if matlab to set as a command vs operator. (ColouriseMatlabDoc): use true for call to ColouriseMatlabOctaveDocument. (ColouriseOctaveDoc): use false for call to ColouriseMatlabOctaveDocument.
-rw-r--r--lexers/LexMatlab.cxx13
1 files changed, 9 insertions, 4 deletions
diff --git a/lexers/LexMatlab.cxx b/lexers/LexMatlab.cxx
index c59b8f94c..a8ac03cc7 100644
--- a/lexers/LexMatlab.cxx
+++ b/lexers/LexMatlab.cxx
@@ -57,7 +57,8 @@ static bool IsOctaveComment(Accessor &styler, int pos, int len) {
static void ColouriseMatlabOctaveDoc(
unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler,
- bool (*IsCommentChar)(int)) {
+ bool (*IsCommentChar)(int),
+ bool ismatlab) {
WordList &keywords = *keywordlists[0];
@@ -199,7 +200,11 @@ static void ColouriseMatlabOctaveDoc(
styler.SetLineState(curLine, commentDepth);
sc.SetState(SCE_MATLAB_COMMENT);
} else if (sc.ch == '!' && sc.chNext != '=' ) {
- sc.SetState(SCE_MATLAB_COMMAND);
+ if(ismatlab) {
+ sc.SetState(SCE_MATLAB_COMMAND);
+ } else {
+ sc.SetState(SCE_MATLAB_OPERATOR);
+ }
} else if (sc.ch == '\'') {
if (transpose) {
sc.SetState(SCE_MATLAB_OPERATOR);
@@ -229,12 +234,12 @@ static void ColouriseMatlabOctaveDoc(
static void ColouriseMatlabDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
- ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabCommentChar);
+ ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabCommentChar, true);
}
static void ColouriseOctaveDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
- ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveCommentChar);
+ ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveCommentChar, false);
}
static void FoldMatlabOctaveDoc(unsigned int startPos, int length, int,