From f7c94f28fa3c811239c2d4ea2bec35c4a8a1e637 Mon Sep 17 00:00:00 2001 From: John Donoghue Date: Sat, 18 Jan 2014 12:46:40 -0500 Subject: 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. --- lexers/LexMatlab.cxx | 13 +++++++++---- 1 file 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, -- cgit v1.2.3