aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexMatlab.cxx
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
commit92cf36d6ce56f500d4e965ea61dab9f7701c8744 (patch)
tree9811b18a70e0e17b67c804c0ffadc517de5dfb9b /lexers/LexMatlab.cxx
parent85d75d45fb4ee06ae9b3731a02a7a030e8014905 (diff)
downloadscintilla-mirror-92cf36d6ce56f500d4e965ea61dab9f7701c8744.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.
Diffstat (limited to 'lexers/LexMatlab.cxx')
-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,