Hello everybody,

I have modifed the NSIS lexer and created a CMake <http://www.cmake.org/HTML/Index.html> lexer
for scintilla.

For those who haven't heard of CMake here is a short description:

   CMake, the cross-platform, open-source make system. CMake is used to
   control the software compilation process using simple platform and
   compiler i
   ndependent configuration files. CMake generates native makefiles and
   workspaces
   that can be used in the compiler environment of your choice. CMake
   is quite
   sophisticated: it is possible to support complex environments
   requiring system
   configuration, pre-processor generation, code generation, and
   template instantiation.

I have attached a patch (a diff file, created using diff -Naur command)
against scintilla version 1.72 <http://scintilla.sourceforge.net/ScintillaDownload.html> and I have tested it only on Windows XP.

After applying the patch please run:
scintilla\src\LexGen.py and
scintilla\include\Face.py
scintilla\include\HFacer.py
scintilla\include\Face.pyc

Then you can build it like stated in the fine documentation.

I have encountered one problem regarding indentation, the
following line didn't do the trick:
statement.indent.$(file.patterns.cmake)=5 IF WHILE FOREACH MACRO
so indenting doesn't work at the moment.

As a note, cmake.ignorecase command doesn't work at the moment,
maybe it will be removed, since the standard way of writing CMakeLists.txt
is in uppercase.

I hope you will include it in the next build, so that others will benefit
from it. And, maybe scintilla and SciTE will be build using CMake ;-)

Regards,
Cristian.


diff -Naur scintilla/scintilla/include/Scintilla.iface 
scintilla.new/scintilla/include/Scintilla.iface
--- scintilla/scintilla/include/Scintilla.iface Fri Dec 29 01:00:30 2006
+++ scintilla.new/scintilla/include/Scintilla.iface     Wed Mar 14 19:09:14 2007
@@ -1858,6 +1858,7 @@
 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.
@@ -2535,6 +2536,23 @@
 val SCE_NSIS_PAGEEX=16
 val SCE_NSIS_FUNCTIONDEF=17
 val SCE_NSIS_COMMENTBOX=18
+# 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
 # Lexical states for SCLEX_MMIXAL
 lex MMIXAL=SCLEX_MMIXAL SCE_MMIXAL_
 val SCE_MMIXAL_LEADWS=0
diff -Naur scintilla/scintilla/src/LexCmake.cxx 
scintilla.new/scintilla/src/LexCmake.cxx
--- scintilla/scintilla/src/LexCmake.cxx        Thu Jan  1 02:00:00 1970
+++ scintilla.new/scintilla/src/LexCmake.cxx    Wed Mar 14 20:46:22 2007
@@ -0,0 +1,580 @@
+// 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"
+
+/*
+// located in SciLexer.h
+
+#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
+*/
+
+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 CmakeCmp( char *s1, char *s2, bool bIgnoreCase )
+{
+  if( bIgnoreCase )
+     return CompareCaseInsensitive( s1, s2);
+
+  return strcmp( s1, s2 );
+}
+
+static int calculateFoldCmake(unsigned int start, unsigned int end, int 
foldlevel, Accessor &styler, bool bElse, bool foldUtilityCmd )
+{
+  int style = styler.StyleAt(end);
+
+  // If the word is too long, it is not what we are looking for
+  if( end - start > 20 )
+    return foldlevel;
+
+  if( foldUtilityCmd )
+  {
+    // Check the style at this point, if it is not valid, then return zero
+    if( style != SCE_CMAKE_IFDEFINEDEF && 
+       style != SCE_CMAKE_WHILEDEF && 
+       style != SCE_CMAKE_FOREACHDEF && 
+        style != SCE_CMAKE_MACRODEF )
+          return foldlevel;
+  }
+
+  int newFoldlevel = foldlevel;
+  bool bIgnoreCase = false;
+  if( styler.GetPropertyInt("cmake.ignorecase") == 1 )
+    bIgnoreCase = true;
+
+  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( CmakeCmp(s, "IF", bIgnoreCase) == 0 || CmakeCmp(s, "WHILE", 
bIgnoreCase) == 0  
+       || CmakeCmp(s, "MACRO", bIgnoreCase ) == 0 || CmakeCmp(s, "FOREACH", 
bIgnoreCase ) == 0
+       || CmakeCmp(s, "ELSEIF", bIgnoreCase ) == 0 )
+      newFoldlevel++;
+    else if( CmakeCmp(s, "ENDIF", bIgnoreCase) == 0 || CmakeCmp(s, "ENDWHILE", 
bIgnoreCase) == 0  
+           || CmakeCmp(s, "ENDMACRO", bIgnoreCase ) == 0 || CmakeCmp(s, 
"ENDFOREACH", bIgnoreCase ) == 0)
+      newFoldlevel--;
+    else if( bElse && CmakeCmp(s, "ELSEIF", bIgnoreCase) == 0 )
+      newFoldlevel++;
+    else if( bElse && CmakeCmp(s, "ELSE", bIgnoreCase) == 0 )
+      newFoldlevel++;
+
+  return newFoldlevel;
+}
+
+static int classifyWordCmake(unsigned int start, unsigned int end, WordList 
*keywordLists[], Accessor &styler )
+{
+  bool bIgnoreCase = false;
+  if( styler.GetPropertyInt("cmake.ignorecase") == 1 )
+    bIgnoreCase = true;
+
+  bool bUserVars = false;
+  if( styler.GetPropertyInt("cmake.uservars") == 1 )
+    bUserVars = true;
+
+       char s[100];
+
+       WordList &Commands = *keywordLists[0];
+       WordList &Parameters = *keywordLists[1];
+       WordList &UserDefined = *keywordLists[2];
+
+       for (unsigned int i = 0; i < end - start + 1 && i < 99; i++)
+       {
+    if( bIgnoreCase )
+      s[i] = static_cast<char>( tolower(styler[ start + i ] ) );
+    else
+                 s[i] = static_cast<char>( styler[ start + i ] );
+               s[i + 1] = '\0';
+       }
+
+       // Check for special words...
+       if( CmakeCmp(s, "MACRO", bIgnoreCase ) == 0 || CmakeCmp(s, "ENDMACRO", 
bIgnoreCase) == 0 ) 
+               return SCE_CMAKE_MACRODEF;
+
+       if( CmakeCmp(s, "IF", bIgnoreCase ) == 0 ||  CmakeCmp(s, "ENDIF", 
bIgnoreCase) == 0 )
+               return SCE_CMAKE_IFDEFINEDEF;
+
+        if( CmakeCmp(s, "ELSEIF", bIgnoreCase ) == 0  || CmakeCmp(s, "ELSE", 
bIgnoreCase ) == 0 ) 
+               return SCE_CMAKE_IFDEFINEDEF;
+
+       if ( CmakeCmp(s, "WHILE", bIgnoreCase ) == 0 || CmakeCmp(s, "ENDWHILE", 
bIgnoreCase ) == 0)
+               return SCE_CMAKE_WHILEDEF;
+       
+       if ( CmakeCmp(s, "FOREACH", bIgnoreCase ) == 0 || CmakeCmp(s, 
"ENDFOREACH", bIgnoreCase ) == 0)
+               return SCE_CMAKE_FOREACHDEF;
+  
+       if ( Commands.InList(s) )
+               return SCE_CMAKE_COMMANDS;
+
+       if ( Parameters.InList(s) )
+               return SCE_CMAKE_PARAMETERS;
+
+
+       if( UserDefined.InList(s) )
+               return SCE_CMAKE_USERDEFINED;
+
+       if( strlen(s) > 3 )
+       {
+               if( s[1] == '{' && s[strlen(s)-1] == '}' )
+                       return SCE_CMAKE_VARIABLE;
+       }
+
+  // See if the variable is a user defined variable
+  if( s[0] == '$' && bUserVars )
+  {
+    bool bHasSimpleCmakeChars = true;
+    for (unsigned int j = 1; j < end - start + 1 && j < 99; j++)
+         {
+      if( !isCmakeChar( s[j] ) )
+      {
+        bHasSimpleCmakeChars = false;
+        break;
+      }
+         }
+
+    if( bHasSimpleCmakeChars )
+      return SCE_CMAKE_VARIABLE;
+  }
+
+  // To check for numbers
+  if( isCmakeNumber( s[0] ) )
+  {
+    bool bHasSimpleCmakeNumber = true;
+    for (unsigned int j = 1; j < end - start + 1 && j < 99; j++)
+         {
+      if( !isCmakeNumber( s[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;
+                               }
+
+                               // NSIS KeyWord,Function, Variable, UserDefined:
+                               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:
+
+                               // NSIS KeyWord:
+        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;
+      bool bUserVars = false;
+      if( styler.GetPropertyInt("cmake.uservars") == 1 )
+        bUserVars = true;
+
+      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;
+      }
+
+      // Covers "$INSTDIR and user vars like $MYVAR"
+      else if( bVarInString && !isCmakeChar(cNextChar) )
+      {
+        int nWordState = classifyWordCmake( styler.GetStartSegment(), i, 
keywordLists, styler);
+                               if( nWordState == SCE_CMAKE_VARIABLE )
+                                       styler.ColourTo( i, 
SCE_CMAKE_STRINGVAR);
+        else if( bUserVars )
+          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;
+  bool foldUtilityCmd = styler.GetPropertyInt("cmake.foldutilcmd", 1) == 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;
+  int style = styler.StyleAt(safeStartPos);
+
+  for (unsigned int i = safeStartPos; i < startPos + length; i++)
+       {
+    char chCurr = styler.SafeGetCharAt(i);
+    style = styler.StyleAt(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, foldUtilityCmd );
+
+        if( newLevel == levelNext )
+        {
+          if( foldAtElse && foldUtilityCmd )
+          {
+            if( CmakeNextLineHasElse(i, startPos + length, styler) )
+              levelNext--;
+          }
+        }
+        else
+          levelNext = newLevel;
+        bArg1 = false;
+      }
+    }
+
+    if( chCurr == '\n' )
+    {
+      if( bArg1 && foldAtElse && foldUtilityCmd)
+      {
+        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 -Naur scintilla/scite/src/SciTEGlobal.properties 
scintilla.new/scite/src/SciTEGlobal.properties
--- scintilla/scite/src/SciTEGlobal.properties  Wed Dec 13 02:19:18 2006
+++ scintilla.new/scite/src/SciTEGlobal.properties      Wed Mar 14 21:02:20 2007
@@ -275,6 +275,7 @@
 $(filter.baan)\
 $(filter.bash)\
 $(filter.caml)\
+$(filter.cmake)\
 $(filter.cpp)\
 #$(filter.ch)\
 $(filter.css)\
@@ -437,6 +438,7 @@
 &Batch|bat||\
 #Bullant|ant||\
 &C / C++|c||\
+CMake|cmake||\
 C&#|cs||\
 #Csound|orc||\
 CSS|css||\
@@ -509,6 +511,7 @@
 import caml
 import conf
 import cpp
+import cmake
 import d
 #import csound
 import css
diff -Naur scintilla/scite/src/cmake.properties 
scintilla.new/scite/src/cmake.properties
--- scintilla/scite/src/cmake.properties        Thu Jan  1 02:00:00 1970
+++ scintilla.new/scite/src/cmake.properties    Wed Mar 14 20:49:36 2007
@@ -0,0 +1,256 @@
+# Define SciTE settings for CMake.
+# contributed by Cristian Adam <cristian dot adam at gmx dot net>
+
+filter.cmake=CMake (CMakeLists.txt, *.cmake, 
*.ctest)|CMakeLists.txt;*.cmake;*.cmake.in;*.ctest;*.ctest.in|
+file.patterns.cmake=CMakeLists.txt;*.cmake;*.cmake.in;*.ctest;*.ctest.in
+lexer.$(file.patterns.cmake)=cmake
+
+# Advanced settings
+#cmake.uservars=0
+#cmake.ignorecase = 0
+
+# Commands:
+keywords.$(file.patterns.cmake)= ADD_CUSTOM_COMMAND \
+ADD_CUSTOM_TARGET \
+ADD_DEFINITIONS \
+ADD_DEPENDENCIES \
+ADD_EXECUTABLE \
+ADD_LIBRARY \
+ADD_SUBDIRECTORY \
+ADD_TEST \
+AUX_SOURCE_DIRECTORY \
+BUILD_COMMAND \
+BUILD_NAME \
+CMAKE_MINIMUM_REQUIRED \
+CONFIGURE_FILE \
+CREATE_TEST_SOURCELIST \
+ELSE \
+ELSEIF \
+ENABLE_LANGUAGE \
+ENABLE_TESTING \
+ENDFOREACH \
+ENDIF \
+ENDMACRO \
+ENDWHILE \
+EXEC_PROGRAM \
+EXECUTE_PROCESS \
+EXPORT_LIBRARY_DEPENDENCIES \
+FILE \
+FIND_FILE \
+FIND_LIBRARY \
+FIND_PACKAGE \
+FIND_PATH \
+FIND_PROGRAM \
+FLTK_WRAP_UI \
+FOREACH \
+GET_CMAKE_PROPERTY \
+GET_DIRECTORY_PROPERTY \
+GET_FILENAME_COMPONENT \
+GET_SOURCE_FILE_PROPERTY \
+GET_TARGET_PROPERTY \
+GET_TEST_PROPERTY \
+IF \
+INCLUDE \
+INCLUDE_DIRECTORIES \
+INCLUDE_EXTERNAL_MSPROJECT \
+INCLUDE_REGULAR_EXPRESSION \
+INSTALL \
+INSTALL_FILES \
+INSTALL_PROGRAMS \
+INSTALL_TARGETS \
+LINK_DIRECTORIES \
+LINK_LIBRARIES \
+LIST \
+LOAD_CACHE \
+LOAD_COMMAND \
+MACRO \
+MAKE_DIRECTORY \
+MARK_AS_ADVANCED \
+MATH \
+MESSAGE \
+OPTION \
+OUTPUT_REQUIRED_FILES \
+PROJECT \
+QT_WRAP_CPP \
+QT_WRAP_UI \
+REMOVE \
+REMOVE_DEFINITIONS \
+SEPARATE_ARGUMENTS \
+SET \
+SET_DIRECTORY_PROPERTIES \
+SET_SOURCE_FILES_PROPERTIES \
+SET_TARGET_PROPERTIES \
+SET_TESTS_PROPERTIES \
+SITE_NAME \
+SOURCE_GROUP \
+STRING \
+SUBDIR_DEPENDS \
+SUBDIRS \
+TARGET_LINK_LIBRARIES \
+TRY_COMPILE \
+TRY_RUN \
+USE_MANGLED_MESA \
+UTILITY_SOURCE \
+VARIABLE_REQUIRES \
+VTK_MAKE_INSTANTIATOR \
+VTK_WRAP_JAVA \
+VTK_WRAP_PYTHON \
+VTK_WRAP_TCL \
+WHILE \
+WRITE_FILE
+ 
+# Variables:
+keywords2.$(file.patterns.cmake)= ABSOLUTE \
+ABSTRACT \
+ADDITIONAL_MAKE_CLEAN_FILES \
+ALL \
+AND \
+APPEND \
+ARGS \
+ASCII \
+BEFORE \
+CACHE \
+CACHE_VARIABLES \
+CLEAR \
+COMMAND \
+COMMANDS \
+COMMAND_NAME \
+COMMENT \
+COMPARE \
+COMPILE_FLAGS \
+COPYONLY \
+DEFINED \
+DEFINE_SYMBOL \
+DEPENDS \
+DOC \
+EQUAL \
+ESCAPE_QUOTES \
+EXCLUDE \
+EXCLUDE_FROM_ALL \
+EXISTS \
+EXPORT_MACRO \
+EXT \
+EXTRA_INCLUDE \
+FATAL_ERROR \
+FILE \
+FILES \
+FORCE \
+FUNCTION \
+GENERATED \
+GLOB \
+GLOB_RECURSE \
+GREATER \
+GROUP_SIZE \
+HEADER_FILE_ONLY \
+HEADER_LOCATION \
+IMMEDIATE \
+INCLUDES \
+INCLUDE_DIRECTORIES \
+INCLUDE_INTERNALS \
+INCLUDE_REGULAR_EXPRESSION \
+LESS \
+LINK_DIRECTORIES \
+LINK_FLAGS \
+LOCATION \
+MACOSX_BUNDLE \
+MACROS \
+MAIN_DEPENDENCY \
+MAKE_DIRECTORY \
+MATCH \
+MATCHALL \
+MATCHES \
+MODULE \
+NAME \
+NAME_WE \
+NOT \
+NOTEQUAL \
+NO_SYSTEM_PATH \
+OBJECT_DEPENDS \
+OPTIONAL \
+OR \
+OUTPUT \
+OUTPUT_VARIABLE \
+PATH \
+PATHS \
+POST_BUILD \
+POST_INSTALL_SCRIPT \
+PREFIX \
+PREORDER \
+PRE_BUILD \
+PRE_INSTALL_SCRIPT \
+PRE_LINK \
+PROGRAM \
+PROGRAM_ARGS \
+PROPERTIES \
+QUIET \
+RANGE \
+READ \
+REGEX \
+REGULAR_EXPRESSION \
+REPLACE \
+REQUIRED \
+RETURN_VALUE \
+RUNTIME_DIRECTORY \
+SEND_ERROR \
+SHARED \
+SOURCES \
+STATIC \
+STATUS \
+STREQUAL \
+STRGREATER \
+STRLESS \
+SUFFIX \
+TARGET \
+TOLOWER \
+TOUPPER \
+VAR \
+VARIABLES \
+VERSION \
+WIN32 \
+WRAP_EXCLUDE \
+WRITE \
+APPLE  \
+MINGW \
+MSYS \
+CYGWIN  \
+BORLAND \
+WATCOM \
+MSVC MSVC_IDE MSVC60 MSVC70 MSVC71 MSVC80 CMAKE_COMPILER_2005 \
+OFF ON \
+
+#User defined:
+#keywords3.$(file.patterns.cmake)=MyFunction MySomethingElse
+
+# Block and indenting
+statement.indent.$(file.patterns.cmake)=5 IF WHILE FOREACH MACRO
+
+# Whitespace (SCE_CMAKE_DEFAULT)
+style.cmake.0=fore:#000000,$(font.base)
+# Comment (SCE_CMAKE_COMMENT)
+style.cmake.1=fore:#007F00,$(font.comment)
+# String double quote (SCE_CMAKE_STRINGDQ)
+style.cmake.2=fore:#7F007F,back:#EEEEEE
+# String left quote (SCE_CMAKE_STRINGLQ)
+style.cmake.3=fore:#7F007F,back:#EEEEEE
+# String right quote (SCE_CMAKE_STRINGRQ)
+style.cmake.4=fore:#7F007F,back:#EEEEEE
+# Function (SCE_CMAKE_COMMANDS)
+style.cmake.5=fore:#00007F,bold
+# Variable (SCE_CMAKE_ARGUMENTS)
+style.cmake.6=fore:#800000
+# Label (SCE_CMAKE_VARIABLE)
+style.cmake.7=fore:#CC3300
+# User Defined (SCE_CMAKE_USERDEFINED)
+style.cmake.8=fore:#000000
+# Section (SCE_CMAKE_WHILEDEF)
+style.cmake.9=fore:#00007F,bold
+# Sub section (SCE_CMAKE_FOREACHDEF)
+style.cmake.10=fore:#00007F,bold
+# If def (SCE_CMAKE_IFDEFINEDEF)
+style.cmake.11=fore:#00007F,bold
+# Macro def (SCE_CMAKE_MACRODEF)
+style.cmake.12=fore:#00007F,bold
+# Variable within string (SCE_CMAKE_STRINGVAR)
+style.cmake.13=fore:#CC3300,back:#EEEEEE
+# Numbers (SCE_CMAKE_NUMBER)
+style.cmake.14=$(colour.number)
\ No newline at end of file

_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to