aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gtk/makefile16
-rw-r--r--gtk/scintilla.mak3
-rw-r--r--include/SciLexer.h16
-rw-r--r--include/Scintilla.iface18
-rw-r--r--src/KeyWords.cxx1
-rw-r--r--src/LexCmake.cxx453
-rw-r--r--vcbuild/SciLexer.dsp10
-rw-r--r--win32/makefile16
-rw-r--r--win32/scintilla.mak3
-rw-r--r--win32/scintilla_vc6.mak3
10 files changed, 520 insertions, 19 deletions
diff --git a/gtk/makefile b/gtk/makefile
index 64a7934c7..e48a8470e 100644
--- a/gtk/makefile
+++ b/gtk/makefile
@@ -64,14 +64,14 @@ endif
#**LEXOBJS=\\\n\(\*.o \)
LEXOBJS=\
LexAda.o LexAPDL.o LexAsm.o LexAsn1.o LexAU3.o LexAVE.o LexBaan.o LexBash.o \
-LexBasic.o LexBullant.o LexCaml.o LexCLW.o LexConf.o LexCPP.o LexCrontab.o \
-LexCsound.o LexCSS.o LexD.o LexEiffel.o LexErlang.o LexEScript.o LexFlagship.o \
-LexForth.o LexFortran.o LexGui4Cli.o LexHaskell.o LexHTML.o LexInno.o LexKix.o \
-LexLisp.o LexLout.o LexLua.o LexMatlab.o LexMetapost.o LexMMIXAL.o LexMPT.o \
-LexMSSQL.o LexNsis.o LexOpal.o LexOthers.o LexPascal.o LexPB.o LexPerl.o \
-LexPOV.o LexPS.o LexPython.o LexRebol.o LexRuby.o LexScriptol.o LexSmalltalk.o \
-LexSpecman.o LexSpice.o LexSQL.o LexTADS3.o LexTCL.o LexTeX.o LexVB.o \
-LexVerilog.o LexVHDL.o LexYAML.o
+LexBasic.o LexBullant.o LexCaml.o LexCLW.o LexCmake.o LexConf.o LexCPP.o \
+LexCrontab.o LexCsound.o LexCSS.o LexD.o LexEiffel.o LexErlang.o LexEScript.o \
+LexFlagship.o LexForth.o LexFortran.o LexGui4Cli.o LexHaskell.o LexHTML.o \
+LexInno.o LexKix.o LexLisp.o LexLout.o LexLua.o LexMatlab.o LexMetapost.o \
+LexMMIXAL.o LexMPT.o LexMSSQL.o LexNsis.o LexOpal.o LexOthers.o LexPascal.o \
+LexPB.o LexPerl.o LexPOV.o LexPS.o LexPython.o LexRebol.o LexRuby.o \
+LexScriptol.o LexSmalltalk.o LexSpecman.o LexSpice.o LexSQL.o LexTADS3.o \
+LexTCL.o LexTeX.o LexVB.o LexVerilog.o LexVHDL.o LexYAML.o
#--Autogenerated -- end of automatically generated section
all: $(COMPLIB)
diff --git a/gtk/scintilla.mak b/gtk/scintilla.mak
index 432225638..c8cb51370 100644
--- a/gtk/scintilla.mak
+++ b/gtk/scintilla.mak
@@ -152,6 +152,7 @@ LEXOBJS=\
$(DIR_O)\LexBullant.obj \
$(DIR_O)\LexCaml.obj \
$(DIR_O)\LexCLW.obj \
+ $(DIR_O)\LexCmake.obj \
$(DIR_O)\LexConf.obj \
$(DIR_O)\LexCPP.obj \
$(DIR_O)\LexCrontab.obj \
@@ -344,6 +345,8 @@ $(DIR_O)\LexCaml.obj: ..\src\LexCaml.cxx $(LEX_HEADERS)
$(DIR_O)\LexCLW.obj: ..\src\LexCLW.cxx $(LEX_HEADERS)
+$(DIR_O)\LexCmake.obj: ..\src\LexCmake.cxx $(LEX_HEADERS)
+
$(DIR_O)\LexConf.obj: ..\src\LexConf.cxx $(LEX_HEADERS)
$(DIR_O)\LexCPP.obj: ..\src\LexCPP.cxx $(LEX_HEADERS)
diff --git a/include/SciLexer.h b/include/SciLexer.h
index fb4245730..dcad10105 100644
--- a/include/SciLexer.h
+++ b/include/SciLexer.h
@@ -92,6 +92,7 @@
#define SCLEX_OPAL 77
#define SCLEX_SPICE 78
#define SCLEX_D 79
+#define SCLEX_CMAKE 80
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
@@ -1087,6 +1088,21 @@
#define SCE_SPICE_DELIMITER 6
#define SCE_SPICE_VALUE 7
#define SCE_SPICE_COMMENTLINE 8
+#define SCE_CMAKE_DEFAULT 0
+#define SCE_CMAKE_COMMENT 1
+#define SCE_CMAKE_STRINGDQ 2
+#define SCE_CMAKE_STRINGLQ 3
+#define SCE_CMAKE_STRINGRQ 4
+#define SCE_CMAKE_COMMANDS 5
+#define SCE_CMAKE_PARAMETERS 6
+#define SCE_CMAKE_VARIABLE 7
+#define SCE_CMAKE_USERDEFINED 8
+#define SCE_CMAKE_WHILEDEF 9
+#define SCE_CMAKE_FOREACHDEF 10
+#define SCE_CMAKE_IFDEFINEDEF 11
+#define SCE_CMAKE_MACRODEF 12
+#define SCE_CMAKE_STRINGVAR 13
+#define SCE_CMAKE_NUMBER 14
#define SCLEX_ASP 29
#define SCLEX_PHP 30
//--Autogenerated -- end of section automatically generated from Scintilla.iface
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index ba8bdc936..8da0d9577 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -1912,6 +1912,7 @@ val SCLEX_INNOSETUP=76
val SCLEX_OPAL=77
val SCLEX_SPICE=78
val SCLEX_D=79
+val SCLEX_CMAKE=80
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
@@ -3054,6 +3055,23 @@ val SCE_SPICE_NUMBER=5
val SCE_SPICE_DELIMITER=6
val SCE_SPICE_VALUE=7
val SCE_SPICE_COMMENTLINE=8
+# Lexical states for SCLEX_CMAKE
+lex CMAKE=SCLEX_CMAKE SCE_CMAKE_
+val SCE_CMAKE_DEFAULT=0
+val SCE_CMAKE_COMMENT=1
+val SCE_CMAKE_STRINGDQ=2
+val SCE_CMAKE_STRINGLQ=3
+val SCE_CMAKE_STRINGRQ=4
+val SCE_CMAKE_COMMANDS=5
+val SCE_CMAKE_PARAMETERS=6
+val SCE_CMAKE_VARIABLE=7
+val SCE_CMAKE_USERDEFINED=8
+val SCE_CMAKE_WHILEDEF=9
+val SCE_CMAKE_FOREACHDEF=10
+val SCE_CMAKE_IFDEFINEDEF=11
+val SCE_CMAKE_MACRODEF=12
+val SCE_CMAKE_STRINGVAR=13
+val SCE_CMAKE_NUMBER=14
# Events
diff --git a/src/KeyWords.cxx b/src/KeyWords.cxx
index 745169575..56ccaddd4 100644
--- a/src/KeyWords.cxx
+++ b/src/KeyWords.cxx
@@ -152,6 +152,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmCaml);
LINK_LEXER(lmClw);
LINK_LEXER(lmClwNoCase);
+ LINK_LEXER(lmCmake);
LINK_LEXER(lmConf);
LINK_LEXER(lmCPP);
LINK_LEXER(lmCPPNoCase);
diff --git a/src/LexCmake.cxx b/src/LexCmake.cxx
new file mode 100644
index 000000000..3d5ee7581
--- /dev/null
+++ b/src/LexCmake.cxx
@@ -0,0 +1,453 @@
+// Scintilla source code edit control
+/** @file LexCmake.cxx
+ ** Lexer for Cmake
+ **/
+// Copyright 2007 by Cristian Adam <cristian [dot] adam [at] gmx [dot] net>
+// based on the NSIS lexer
+// The License.txt file describes the conditions under which this software may be distributed.
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "Platform.h"
+
+#include "PropSet.h"
+#include "Accessor.h"
+#include "KeyWords.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+
+static bool isCmakeNumber(char ch)
+{
+ return(ch >= '0' && ch <= '9');
+}
+
+static bool isCmakeChar(char ch)
+{
+ return(ch == '.' ) || (ch == '_' ) || isCmakeNumber(ch) || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
+}
+
+static bool isCmakeLetter(char ch)
+{
+ return(ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
+}
+
+static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor &styler)
+{
+ int nNextLine = -1;
+ for ( unsigned int i = start; i < end; i++ ) {
+ char cNext = styler.SafeGetCharAt( i );
+ if ( cNext == '\n' ) {
+ nNextLine = i+1;
+ break;
+ }
+ }
+
+ if ( nNextLine == -1 ) // We never foudn the next line...
+ return false;
+
+ for ( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ ) {
+ char cNext = styler.SafeGetCharAt( firstChar );
+ if ( cNext == ' ' )
+ continue;
+ if ( cNext == '\t' )
+ continue;
+ if ( styler.Match(firstChar, "ELSE") || styler.Match(firstChar, "else"))
+ return true;
+ break;
+ }
+
+ return false;
+}
+
+static int calculateFoldCmake(unsigned int start, unsigned int end, int foldlevel, Accessor &styler, bool bElse)
+{
+ // If the word is too long, it is not what we are looking for
+ if ( end - start > 20 )
+ return foldlevel;
+
+ int newFoldlevel = foldlevel;
+
+ char s[20]; // The key word we are looking for has atmost 13 characters
+ for (unsigned int i = 0; i < end - start + 1 && i < 19; i++) {
+ s[i] = static_cast<char>( styler[ start + i ] );
+ s[i + 1] = '\0';
+ }
+
+ if ( CompareCaseInsensitive(s, "IF") == 0 || CompareCaseInsensitive(s, "WHILE") == 0
+ || CompareCaseInsensitive(s, "MACRO") == 0 || CompareCaseInsensitive(s, "FOREACH") == 0
+ || CompareCaseInsensitive(s, "ELSEIF") == 0 )
+ newFoldlevel++;
+ else if ( CompareCaseInsensitive(s, "ENDIF") == 0 || CompareCaseInsensitive(s, "ENDWHILE") == 0
+ || CompareCaseInsensitive(s, "ENDMACRO") == 0 || CompareCaseInsensitive(s, "ENDFOREACH") == 0)
+ newFoldlevel--;
+ else if ( bElse && CompareCaseInsensitive(s, "ELSEIF") == 0 )
+ newFoldlevel++;
+ else if ( bElse && CompareCaseInsensitive(s, "ELSE") == 0 )
+ newFoldlevel++;
+
+ return newFoldlevel;
+}
+
+static int classifyWordCmake(unsigned int start, unsigned int end, WordList *keywordLists[], Accessor &styler )
+{
+ char word[100] = {0};
+ char lowercaseWord[100] = {0};
+
+ WordList &Commands = *keywordLists[0];
+ WordList &Parameters = *keywordLists[1];
+ WordList &UserDefined = *keywordLists[2];
+
+ for (unsigned int i = 0; i < end - start + 1 && i < 99; i++) {
+ word[i] = static_cast<char>( styler[ start + i ] );
+ lowercaseWord[i] = static_cast<char>(tolower(word[i]));
+ }
+
+ // Check for special words...
+ if ( CompareCaseInsensitive(word, "MACRO") == 0 || CompareCaseInsensitive(word, "ENDMACRO") == 0 )
+ return SCE_CMAKE_MACRODEF;
+
+ if ( CompareCaseInsensitive(word, "IF") == 0 || CompareCaseInsensitive(word, "ENDIF") == 0 )
+ return SCE_CMAKE_IFDEFINEDEF;
+
+ if ( CompareCaseInsensitive(word, "ELSEIF") == 0 || CompareCaseInsensitive(word, "ELSE") == 0 )
+ return SCE_CMAKE_IFDEFINEDEF;
+
+ if ( CompareCaseInsensitive(word, "WHILE") == 0 || CompareCaseInsensitive(word, "ENDWHILE") == 0)
+ return SCE_CMAKE_WHILEDEF;
+
+ if ( CompareCaseInsensitive(word, "FOREACH") == 0 || CompareCaseInsensitive(word, "ENDFOREACH") == 0)
+ return SCE_CMAKE_FOREACHDEF;
+
+ if ( Commands.InList(lowercaseWord) )
+ return SCE_CMAKE_COMMANDS;
+
+ if ( Parameters.InList(word) )
+ return SCE_CMAKE_PARAMETERS;
+
+
+ if ( UserDefined.InList(word) )
+ return SCE_CMAKE_USERDEFINED;
+
+ if ( strlen(word) > 3 ) {
+ if ( word[1] == '{' && word[strlen(word)-1] == '}' )
+ return SCE_CMAKE_VARIABLE;
+ }
+
+ // To check for numbers
+ if ( isCmakeNumber( word[0] ) ) {
+ bool bHasSimpleCmakeNumber = true;
+ for (unsigned int j = 1; j < end - start + 1 && j < 99; j++) {
+ if ( !isCmakeNumber( word[j] ) ) {
+ bHasSimpleCmakeNumber = false;
+ break;
+ }
+ }
+
+ if ( bHasSimpleCmakeNumber )
+ return SCE_CMAKE_NUMBER;
+ }
+
+ return SCE_CMAKE_DEFAULT;
+}
+
+static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
+{
+ int state = SCE_CMAKE_DEFAULT;
+ if ( startPos > 0 )
+ state = styler.StyleAt(startPos-1); // Use the style from the previous line, usually default, but could be commentbox
+
+ styler.StartAt( startPos );
+ styler.GetLine( startPos );
+
+ unsigned int nLengthDoc = startPos + length;
+ styler.StartSegment( startPos );
+
+ char cCurrChar;
+ bool bVarInString = false;
+ bool bClassicVarInString = false;
+
+ unsigned int i;
+ for ( i = startPos; i < nLengthDoc; i++ ) {
+ cCurrChar = styler.SafeGetCharAt( i );
+ char cNextChar = styler.SafeGetCharAt(i+1);
+
+ switch (state) {
+ case SCE_CMAKE_DEFAULT:
+ if ( cCurrChar == '#' ) { // we have a comment line
+ styler.ColourTo(i-1, state );
+ state = SCE_CMAKE_COMMENT;
+ break;
+ }
+ if ( cCurrChar == '"' ) {
+ styler.ColourTo(i-1, state );
+ state = SCE_CMAKE_STRINGDQ;
+ bVarInString = false;
+ bClassicVarInString = false;
+ break;
+ }
+ if ( cCurrChar == '\'' ) {
+ styler.ColourTo(i-1, state );
+ state = SCE_CMAKE_STRINGRQ;
+ bVarInString = false;
+ bClassicVarInString = false;
+ break;
+ }
+ if ( cCurrChar == '`' ) {
+ styler.ColourTo(i-1, state );
+ state = SCE_CMAKE_STRINGLQ;
+ bVarInString = false;
+ bClassicVarInString = false;
+ break;
+ }
+
+ // CMake Variable
+ if ( cCurrChar == '$' || isCmakeChar(cCurrChar)) {
+ styler.ColourTo(i-1,state);
+ state = SCE_CMAKE_VARIABLE;
+
+ // If it is a number, we must check and set style here first...
+ if ( isCmakeNumber(cCurrChar) && (cNextChar == '\t' || cNextChar == ' ' || cNextChar == '\r' || cNextChar == '\n' ) )
+ styler.ColourTo( i, SCE_CMAKE_NUMBER);
+
+ break;
+ }
+
+ break;
+ case SCE_CMAKE_COMMENT:
+ if ( cNextChar == '\n' || cNextChar == '\r' ) {
+ // Special case:
+ if ( cCurrChar == '\\' ) {
+ styler.ColourTo(i-2,state);
+ styler.ColourTo(i,SCE_CMAKE_DEFAULT);
+ }
+ else {
+ styler.ColourTo(i,state);
+ state = SCE_CMAKE_DEFAULT;
+ }
+ }
+ break;
+ case SCE_CMAKE_STRINGDQ:
+ case SCE_CMAKE_STRINGLQ:
+ case SCE_CMAKE_STRINGRQ:
+
+ if ( styler.SafeGetCharAt(i-1) == '\\' && styler.SafeGetCharAt(i-2) == '$' )
+ break; // Ignore the next character, even if it is a quote of some sort
+
+ if ( cCurrChar == '"' && state == SCE_CMAKE_STRINGDQ ) {
+ styler.ColourTo(i,state);
+ state = SCE_CMAKE_DEFAULT;
+ break;
+ }
+
+ if ( cCurrChar == '`' && state == SCE_CMAKE_STRINGLQ ) {
+ styler.ColourTo(i,state);
+ state = SCE_CMAKE_DEFAULT;
+ break;
+ }
+
+ if ( cCurrChar == '\'' && state == SCE_CMAKE_STRINGRQ ) {
+ styler.ColourTo(i,state);
+ state = SCE_CMAKE_DEFAULT;
+ break;
+ }
+
+ if ( cNextChar == '\r' || cNextChar == '\n' ) {
+ int nCurLine = styler.GetLine(i+1);
+ int nBack = i;
+ // We need to check if the previous line has a \ in it...
+ bool bNextLine = false;
+
+ while ( nBack > 0 ) {
+ if ( styler.GetLine(nBack) != nCurLine )
+ break;
+
+ char cTemp = styler.SafeGetCharAt(nBack, 'a'); // Letter 'a' is safe here
+
+ if ( cTemp == '\\' ) {
+ bNextLine = true;
+ break;
+ }
+ if ( cTemp != '\r' && cTemp != '\n' && cTemp != '\t' && cTemp != ' ' )
+ break;
+
+ nBack--;
+ }
+
+ if ( bNextLine ) {
+ styler.ColourTo(i+1,state);
+ }
+ if ( bNextLine == false ) {
+ styler.ColourTo(i,state);
+ state = SCE_CMAKE_DEFAULT;
+ }
+ }
+ break;
+
+ case SCE_CMAKE_VARIABLE:
+
+ // CMake Variable:
+ if ( cCurrChar == '$' )
+ state = SCE_CMAKE_DEFAULT;
+ else if ( cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' ) )
+ state = SCE_CMAKE_DEFAULT;
+ else if ( (isCmakeChar(cCurrChar) && !isCmakeChar( cNextChar) && cNextChar != '}') || cCurrChar == '}' ) {
+ state = classifyWordCmake( styler.GetStartSegment(), i, keywordLists, styler );
+ styler.ColourTo( i, state);
+ state = SCE_CMAKE_DEFAULT;
+ }
+ else if ( !isCmakeChar( cCurrChar ) && cCurrChar != '{' && cCurrChar != '}' ) {
+ if ( classifyWordCmake( styler.GetStartSegment(), i-1, keywordLists, styler) == SCE_CMAKE_NUMBER )
+ styler.ColourTo( i-1, SCE_CMAKE_NUMBER );
+
+ state = SCE_CMAKE_DEFAULT;
+
+ if ( cCurrChar == '"' ) {
+ state = SCE_CMAKE_STRINGDQ;
+ bVarInString = false;
+ bClassicVarInString = false;
+ }
+ else if ( cCurrChar == '`' ) {
+ state = SCE_CMAKE_STRINGLQ;
+ bVarInString = false;
+ bClassicVarInString = false;
+ }
+ else if ( cCurrChar == '\'' ) {
+ state = SCE_CMAKE_STRINGRQ;
+ bVarInString = false;
+ bClassicVarInString = false;
+ }
+ else if ( cCurrChar == '#' ) {
+ state = SCE_CMAKE_COMMENT;
+ }
+ }
+ break;
+ }
+
+ if ( state == SCE_CMAKE_COMMENT) {
+ styler.ColourTo(i,state);
+ }
+ else if ( state == SCE_CMAKE_STRINGDQ || state == SCE_CMAKE_STRINGLQ || state == SCE_CMAKE_STRINGRQ ) {
+ bool bIngoreNextDollarSign = false;
+
+ if ( bVarInString && cCurrChar == '$' ) {
+ bVarInString = false;
+ bIngoreNextDollarSign = true;
+ }
+ else if ( bVarInString && cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' || cNextChar == '"' || cNextChar == '`' || cNextChar == '\'' ) ) {
+ styler.ColourTo( i+1, SCE_CMAKE_STRINGVAR);
+ bVarInString = false;
+ bIngoreNextDollarSign = false;
+ }
+
+ else if ( bVarInString && !isCmakeChar(cNextChar) ) {
+ int nWordState = classifyWordCmake( styler.GetStartSegment(), i, keywordLists, styler);
+ if ( nWordState == SCE_CMAKE_VARIABLE )
+ styler.ColourTo( i, SCE_CMAKE_STRINGVAR);
+ bVarInString = false;
+ }
+ // Covers "${TEST}..."
+ else if ( bClassicVarInString && cNextChar == '}' ) {
+ styler.ColourTo( i+1, SCE_CMAKE_STRINGVAR);
+ bClassicVarInString = false;
+ }
+
+ // Start of var in string
+ if ( !bIngoreNextDollarSign && cCurrChar == '$' && cNextChar == '{' ) {
+ styler.ColourTo( i-1, state);
+ bClassicVarInString = true;
+ bVarInString = false;
+ }
+ else if ( !bIngoreNextDollarSign && cCurrChar == '$' ) {
+ styler.ColourTo( i-1, state);
+ bVarInString = true;
+ bClassicVarInString = false;
+ }
+ }
+ }
+
+ // Colourise remaining document
+ styler.ColourTo(nLengthDoc-1,state);
+}
+
+static void FoldCmakeDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
+{
+ // No folding enabled, no reason to continue...
+ if ( styler.GetPropertyInt("fold") == 0 )
+ return;
+
+ bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) == 1;
+
+ int lineCurrent = styler.GetLine(startPos);
+ unsigned int safeStartPos = styler.LineStart( lineCurrent );
+
+ bool bArg1 = true;
+ int nWordStart = -1;
+
+ int levelCurrent = SC_FOLDLEVELBASE;
+ if (lineCurrent > 0)
+ levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
+ int levelNext = levelCurrent;
+
+ for (unsigned int i = safeStartPos; i < startPos + length; i++) {
+ char chCurr = styler.SafeGetCharAt(i);
+
+ if ( bArg1 ) {
+ if ( nWordStart == -1 && (isCmakeLetter(chCurr)) ) {
+ nWordStart = i;
+ }
+ else if ( isCmakeLetter(chCurr) == false && nWordStart > -1 ) {
+ int newLevel = calculateFoldCmake( nWordStart, i-1, levelNext, styler, foldAtElse);
+
+ if ( newLevel == levelNext ) {
+ if ( foldAtElse ) {
+ if ( CmakeNextLineHasElse(i, startPos + length, styler) )
+ levelNext--;
+ }
+ }
+ else
+ levelNext = newLevel;
+ bArg1 = false;
+ }
+ }
+
+ if ( chCurr == '\n' ) {
+ if ( bArg1 && foldAtElse) {
+ if ( CmakeNextLineHasElse(i, startPos + length, styler) )
+ levelNext--;
+ }
+
+ // If we are on a new line...
+ int levelUse = levelCurrent;
+ int lev = levelUse | levelNext << 16;
+ if (levelUse < levelNext )
+ lev |= SC_FOLDLEVELHEADERFLAG;
+ if (lev != styler.LevelAt(lineCurrent))
+ styler.SetLevel(lineCurrent, lev);
+
+ lineCurrent++;
+ levelCurrent = levelNext;
+ bArg1 = true; // New line, lets look at first argument again
+ nWordStart = -1;
+ }
+ }
+
+ int levelUse = levelCurrent;
+ int lev = levelUse | levelNext << 16;
+ if (levelUse < levelNext)
+ lev |= SC_FOLDLEVELHEADERFLAG;
+ if (lev != styler.LevelAt(lineCurrent))
+ styler.SetLevel(lineCurrent, lev);
+}
+
+static const char * const cmakeWordLists[] = {
+ "Commands",
+ "Parameters",
+ "UserDefined",
+ 0,
+ 0,};
+
+LexerModule lmCmake(SCLEX_CMAKE, ColouriseCmakeDoc, "cmake", FoldCmakeDoc, cmakeWordLists);
diff --git a/vcbuild/SciLexer.dsp b/vcbuild/SciLexer.dsp
index f54b4bde3..18aad2ed7 100644
--- a/vcbuild/SciLexer.dsp
+++ b/vcbuild/SciLexer.dsp
@@ -190,15 +190,15 @@ SOURCE=..\src\LexCLW.cxx
# End Source File
# Begin Source File
-SOURCE=..\src\LexConf.cxx
+SOURCE=..\src\LexCmake.cxx
# End Source File
# Begin Source File
-SOURCE=..\src\LexCPP.cxx
+SOURCE=..\src\LexConf.cxx
# End Source File
# Begin Source File
-SOURCE=..\src\LexD.cxx
+SOURCE=..\src\LexCPP.cxx
# End Source File
# Begin Source File
@@ -214,6 +214,10 @@ SOURCE=..\src\LexCSS.cxx
# End Source File
# Begin Source File
+SOURCE=..\src\LexD.cxx
+# End Source File
+# Begin Source File
+
SOURCE=..\src\LexEiffel.cxx
# End Source File
# Begin Source File
diff --git a/win32/makefile b/win32/makefile
index 41d50ac92..ef18e0d7a 100644
--- a/win32/makefile
+++ b/win32/makefile
@@ -52,14 +52,14 @@ deps:
#**LEXOBJS=\\\n\(\*.o \)
LEXOBJS=\
LexAda.o LexAPDL.o LexAsm.o LexAsn1.o LexAU3.o LexAVE.o LexBaan.o LexBash.o \
-LexBasic.o LexBullant.o LexCaml.o LexCLW.o LexConf.o LexCPP.o LexCrontab.o \
-LexCsound.o LexCSS.o LexD.o LexEiffel.o LexErlang.o LexEScript.o LexFlagship.o \
-LexForth.o LexFortran.o LexGui4Cli.o LexHaskell.o LexHTML.o LexInno.o LexKix.o \
-LexLisp.o LexLout.o LexLua.o LexMatlab.o LexMetapost.o LexMMIXAL.o LexMPT.o \
-LexMSSQL.o LexNsis.o LexOpal.o LexOthers.o LexPascal.o LexPB.o LexPerl.o \
-LexPOV.o LexPS.o LexPython.o LexRebol.o LexRuby.o LexScriptol.o LexSmalltalk.o \
-LexSpecman.o LexSpice.o LexSQL.o LexTADS3.o LexTCL.o LexTeX.o LexVB.o \
-LexVerilog.o LexVHDL.o LexYAML.o
+LexBasic.o LexBullant.o LexCaml.o LexCLW.o LexCmake.o LexConf.o LexCPP.o \
+LexCrontab.o LexCsound.o LexCSS.o LexD.o LexEiffel.o LexErlang.o LexEScript.o \
+LexFlagship.o LexForth.o LexFortran.o LexGui4Cli.o LexHaskell.o LexHTML.o \
+LexInno.o LexKix.o LexLisp.o LexLout.o LexLua.o LexMatlab.o LexMetapost.o \
+LexMMIXAL.o LexMPT.o LexMSSQL.o LexNsis.o LexOpal.o LexOthers.o LexPascal.o \
+LexPB.o LexPerl.o LexPOV.o LexPS.o LexPython.o LexRebol.o LexRuby.o \
+LexScriptol.o LexSmalltalk.o LexSpecman.o LexSpice.o LexSQL.o LexTADS3.o \
+LexTCL.o LexTeX.o LexVB.o LexVerilog.o LexVHDL.o LexYAML.o
#--Autogenerated -- end of automatically generated section
SOBJS = ScintillaWin.o ScintillaBase.o Editor.o CharClassify.o Document.o \
diff --git a/win32/scintilla.mak b/win32/scintilla.mak
index d812696f4..fafe6f335 100644
--- a/win32/scintilla.mak
+++ b/win32/scintilla.mak
@@ -122,6 +122,7 @@ LEXOBJS=\
$(DIR_O)\LexBullant.obj \
$(DIR_O)\LexCaml.obj \
$(DIR_O)\LexCLW.obj \
+ $(DIR_O)\LexCmake.obj \
$(DIR_O)\LexConf.obj \
$(DIR_O)\LexCPP.obj \
$(DIR_O)\LexCrontab.obj \
@@ -305,6 +306,8 @@ $(DIR_O)\LexCaml.obj: ..\src\LexCaml.cxx $(LEX_HEADERS)
$(DIR_O)\LexCLW.obj: ..\src\LexCLW.cxx $(LEX_HEADERS)
+$(DIR_O)\LexCmake.obj: ..\src\LexCmake.cxx $(LEX_HEADERS)
+
$(DIR_O)\LexConf.obj: ..\src\LexConf.cxx $(LEX_HEADERS)
$(DIR_O)\LexCPP.obj: ..\src\LexCPP.cxx $(LEX_HEADERS)
diff --git a/win32/scintilla_vc6.mak b/win32/scintilla_vc6.mak
index e8f7fac77..75862f494 100644
--- a/win32/scintilla_vc6.mak
+++ b/win32/scintilla_vc6.mak
@@ -124,6 +124,7 @@ LEXOBJS=\
$(DIR_O)\LexBullant.obj \
$(DIR_O)\LexCaml.obj \
$(DIR_O)\LexCLW.obj \
+ $(DIR_O)\LexCmake.obj \
$(DIR_O)\LexConf.obj \
$(DIR_O)\LexCPP.obj \
$(DIR_O)\LexCrontab.obj \
@@ -307,6 +308,8 @@ $(DIR_O)\LexCaml.obj: ..\src\LexCaml.cxx $(LEX_HEADERS)
$(DIR_O)\LexCLW.obj: ..\src\LexCLW.cxx $(LEX_HEADERS)
+$(DIR_O)\LexCmake.obj: ..\src\LexCmake.cxx $(LEX_HEADERS)
+
$(DIR_O)\LexConf.obj: ..\src\LexConf.cxx $(LEX_HEADERS)
$(DIR_O)\LexCPP.obj: ..\src\LexCPP.cxx $(LEX_HEADERS)