SF.net SVN: geany:[3414] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sun Dec 21 20:31:09 UTC 2008


Revision: 3414
          http://geany.svn.sourceforge.net/geany/?rev=3414&view=rev
Author:   eht16
Date:     2008-12-21 20:31:09 +0000 (Sun, 21 Dec 2008)

Log Message:
-----------
Add new filetypes CMake and NSIS.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/data/filetype_extensions.conf
    trunk/scintilla/KeyWords.cxx
    trunk/scintilla/Makefile.am
    trunk/scintilla/makefile.win32
    trunk/src/editor.c
    trunk/src/filetypes.c
    trunk/src/filetypes.h
    trunk/src/highlighting.c
    trunk/src/plugindata.h
    trunk/src/templates.c
    trunk/wscript

Added Paths:
-----------
    trunk/data/filetypes.cmake
    trunk/data/filetypes.nsis
    trunk/scintilla/LexCmake.cxx
    trunk/scintilla/LexNsis.cxx

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-12-21 20:09:29 UTC (rev 3413)
+++ trunk/ChangeLog	2008-12-21 20:31:09 UTC (rev 3414)
@@ -10,6 +10,13 @@
    file_prefs.disk_check_timeout is set (to greater 0).
    Call realpath() on files only when opening or changing the filename
    but not on every save.
+ * data/filetype_extensions.conf, data/filetypes.cmake,
+   data/filetypes.nsis, scintilla/KeyWords.cxx, scintilla/LexCmake.cxx,
+   scintilla/LexNsis.cxx, scintilla/Makefile.am,
+   scintilla/makefile.win32, src/editor.c, src/filetypes.c,
+   src/filetypes.h, src/highlighting.c, src/plugindata.h,
+   src/templates.c, wscript:
+   Add new filetypes CMake and NSIS.
 
 
 2008-12-21  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/data/filetype_extensions.conf
===================================================================
--- trunk/data/filetype_extensions.conf	2008-12-21 20:09:29 UTC (rev 3413)
+++ trunk/data/filetype_extensions.conf	2008-12-21 20:31:09 UTC (rev 3414)
@@ -37,8 +37,10 @@
 Docbook=*.docbook;
 HTML=*.htm;*.html;*.shtml;*.hta;*.htd;*.htt;*.cfm;
 XML=*.xml;*.sgml;*.xsl;*.xslt;*.xsd;*.xhtml;
+CMake=CMakeLists.txt;*.cmake;*.ctest;
 Conf=*.conf;*.ini;config;*rc;*.cfg;
 Diff=*.diff;*.patch;*.rej;
+NSIS=*.nsi;*.nsh;
 LaTeX=*.tex;*.sty;*.idx;*.ltx;
 reStructuredText=*.rest;*.reST;*.rst;
 SQL=*.sql;

Added: trunk/data/filetypes.cmake
===================================================================
--- trunk/data/filetypes.cmake	                        (rev 0)
+++ trunk/data/filetypes.cmake	2008-12-21 20:31:09 UTC (rev 3414)
@@ -0,0 +1,47 @@
+# For complete documentation of this file, please see Geany's main documentation
+[styling]
+# foreground;background;bold;italic
+default=0x000000;0xffffff;false;false;
+comment=0x808080;0xffffff;false;false;
+stringdq=0xff901e;0xffffff;false;false;
+stringlq=0x008000;0xffffff;false;false;
+stringrq=0x008000;0xffffff;false;false;
+command=0x00007f;0xffffff;false;false;
+parameters=0x991111;0xffffff;false;false;
+variable=0x007f7f;0xffffff;false;false;
+userdefined=0x0000d0;0xffffff;true;false;
+whiledef=0x00007f;0xffffff;true;false;
+foreachdef=0x00007f;0xffffff;true;false;
+ifdefinedef=0x00007f;0xffffff;true;false;
+macrodef=0x00007f;0xffffff;true;false;
+stringvar=0x007f7f;0xffffff;false;false;
+number=0x007f00;0xffffff;false;false;
+
+[keywords]
+# all items must be in one line
+commands=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
+parameters=ABSOLUTE ABSTRACT ADDITIONAL_MAKE_CLEAN_FILES ALL AND APPEND APPLE ARGS ASCII BEFORE BORLAND CACHE CACHE_VARIABLES CLEAR CMAKE_COMPILER_2005 COMMAND COMMAND_NAME COMMANDS COMMENT COMPARE COMPILE_FLAGS COPYONLY CYGWIN 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 INCLUDE_DIRECTORIES INCLUDE_INTERNALS INCLUDE_REGULAR_EXPRESSION INCLUDES LESS LINK_DIRECTORIES LINK_FLAGS LOCATION MACOSX_BUNDLE MACROS MAIN_DEPENDENCY MAKE_DIRECTORY MATCH MATCHALL MATCHES MINGW MODULE MSVC MSVC60 MSVC70 MSVC71 MSVC80 MSVC_IDE MSYS NAME NAME_WE NO_SYSTEM_PATH NOT NOTEQUAL OBJECT_DEPENDS OFF ON OPTIONAL OR OUTPUT OUTPUT_VARIABLE PATH PATHS POST_BUILD POST_INSTALL_SCRIPT PRE_BUILD PREFIX PRE_INSTALL_SCRIPT PRE_LINK PREORDER 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 WATCOM WIN32 WRAP_EXCLUDE WRITE
+userdefined=
+
+
+[settings]
+# default extension used when saving files
+#extension=cmake
+
+# the following characters are these which a "word" can contains, see documentation
+#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
+
+# if only single comment char is supported like # in this file, leave comment_close blank
+comment_open=#
+comment_close=
+
+# set to false if a comment character/string should start at column 0 of a line, true uses any
+# indentation of the line, e.g. setting to true causes the following on pressing CTRL+d
+	#command_example();
+# setting to false would generate this
+#	command_example();
+# This setting works only for single line comments
+comment_use_indent=true
+
+# context action command (please see Geany's main documentation for details)
+context_action_cmd=


Property changes on: trunk/data/filetypes.cmake
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Added: trunk/data/filetypes.nsis
===================================================================
--- trunk/data/filetypes.nsis	                        (rev 0)
+++ trunk/data/filetypes.nsis	2008-12-21 20:31:09 UTC (rev 3414)
@@ -0,0 +1,60 @@
+# For complete documentation of this file, please see Geany's main documentation
+[styling]
+# foreground;background;bold;italic
+default=0x000000;0xffffff;false;false;
+comment=0x808080;0xffffff;false;false;
+stringdq=0xff901e;0xffffff;false;false;
+stringlq=0x008000;0xffffff;false;false;
+stringrq=0x008000;0xffffff;false;false;
+function=0x00007f;0xffffff;false;false;
+variable=0x991111;0xffffff;false;false;
+label=0x007f7f;0xffffff;false;false;
+userdefined=0x0000d0;0xffffff;true;false;
+sectiondef=0x00007f;0xffffff;true;false;
+subsectiondef=0x00007f;0xffffff;true;false;
+ifdefinedef=0x00007f;0xffffff;true;false;
+macrodef=0x00007f;0xffffff;true;false;
+stringvar=0x991111;0xffffff;false;false;
+number=0x007f00;0xffffff;false;false;
+sectiongroup=0x00007f;0xffffff;true;false;
+pageex=0x00007f;0xffffff;true;false;
+functiondef=0x00007f;0xffffff;true;false;
+commentbox=0x808080;0xffffff;false;false;
+
+
+[keywords]
+# all items must be in one line and in lowercase
+functions=abort addbrandingimage !addincludedir !addincludedir !addplugindir !addplugindir addsize allowrootdirinstall allowskipfiles autoclosewindow bgfont bggradient brandingtext bringtofront call callinstdll caption !cd changeui checkbitmap clearerrors completedtext componenttext contributors: copyfiles crccheck createdirectory createfont createshortcut !define delete deleteinisec deleteinistr deleteregkey deleteregvalue detailprint detailsbuttontext dirshow dirtext dirvar dirverify !echo !else enablewindow !endif enumregkey enumregvalue !error exch exec execshell !execute execwait expandenvstrings file filebufsize fileclose fileerrortext fileopen fileread filereadbyte fileseek filewrite filewritebyte findclose findfirst findnext findwindow flushini function functionend getcurinsttype getcurrentaddress getdlgitem getdllversion getdllversionlocal geterrorlevel getfiletime getfiletimelocal getfullpathname getfunctionaddress getinstdirerror getlabeladdress gettempfilename goto hidewindow icon ifabort !ifdef iferrors iffileexists !ifmacrodef !ifmacrondef !ifndef ifrebootflag ifsilent !include initpluginsdir !insertmacro installbuttontext installcolors installdir installdirregkey instprogressflags insttype insttypegettext insttypesettext intcmp intcmpu intfmt intop iswindow langstring langstringup licensebkcolor licensedata licenseforceselection licenselangstring licensetext loadlanguagefile lockwindow logset logtext !macro !macroend makensis messagebox miscbuttontext name nop outfile !packhdr page pagecallbacks pageex pageexend pop portions push quit readenvstr readinistr readregdword readregstr reboot regdll rename reservefile return rmdir searchpath section sectionend sectiongetflags sectiongetinsttypes sectiongetsize sectiongettext sectiongroup sectiongroupend sectionin sectionsetflags sectionsetinsttypes sectionsetsize sectionsettext sendmessage setautoclose setbrandingimage setcompress setcompressionlevel setcompressor setcompressordictsize setctlcolors setcurinsttype setdatablockoptimize setdatesave setdetailsprint setdetailsview seterrorlevel seterrors setfileattributes setfont setoutpath setoverwrite setpluginunload setrebootflag setshellvarcontext setsilent showinstdetails showuninstdetails showwindow silentinstall silentuninstall sleep spacetexts strcmp strcpy strlen subcaption subsection subsectionend !system !undef uninstallbuttontext uninstallcaption uninstallexename uninstallicon uninstallsubcaption uninstalltext uninstpage unregdll var !verbose viaddversionkey viproductversion !warning windowicon writeinistr writeregbin writeregdword writeregexpandstr writeregstr writeuninstaller xpstyle
+variables=$$ $` $' $" $0 $0, $1 $2 $3 $4 $5 $6 $7 $8 $9 $admintools $appdata $cdburn_area $cmdline $commonfiles $cookies $desktop $documents $exedir $favorites $fonts $history $hwndparent $instdir $internet_cache $language $music $nethood ${nsisdir} $outdir $pictures $pluginsdir $printhood $profile $programfiles $quicklaunch $\r $r0 $r1 $r2 $r3 $r4 $r5 $r6 $r7 $r8 $r9 $recent $resources $resources_localized $sendto $smprograms $smstartup $startmenu $sysdir $temp $templates $varname $videos $windir
+lables=all alt alwaysoff archive auto both bottom bzip2 center colored components control current custom directory dlg_id ext false file_attribute_archive file_attribute_hidden file_attribute_normal file_attribute_offline file_attribute_readonly file_attribute_system file_attribute_temporary force hidden hide hkcc hkcr hkcu hkdd hkey_classes_root hkey_current_config hkey_current_user hkey_dyn_data hkey_local_machine hkey_performance_data hkey_users hklm hkpd hku idabort idcancel idignore idno idok idretry idyes ifdiff ifnewer instfiles lastused leave left license listonly lzma manual mb_abortretryignore mb_defbutton1 mb_defbutton2 mb_defbutton3 mb_defbutton4 mb_iconexclamation mb_iconinformation mb_iconquestion mb_iconstop mb_ok mb_okcancel mb_retrycancel mb_right mb_setforeground mb_topmost mb_yesno mb_yesnocancel nevershow none normal off offline on open print readonly right shift show silent silentlog smooth sw_showmaximized sw_showminimized sw_shownormal system temporary textonly top true try uninstconfirm zlib
+userdefined=enrico upper
+
+
+[settings]
+# default extension used when saving files
+#extension=nsi
+
+# the following characters are these which a "word" can contains, see documentation
+#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
+
+# if only single comment char is supported like # in this file, leave comment_close blank
+comment_open=;
+comment_close=
+
+# set to false if a comment character/string should start at column 0 of a line, true uses any
+# indentation of the line, e.g. setting to true causes the following on pressing CTRL+d
+	#command_example();
+# setting to false would generate this
+#	command_example();
+# This setting works only for single line comments
+comment_use_indent=true
+
+# context action command (please see Geany's main documentation for details)
+context_action_cmd=
+
+[build_settings]
+# %f will be replaced by the complete filename
+# %e will be replaced by the filename without extension
+# (use only one of it at one time)
+compiler=makensis "%f"
+run_cmd="./%e"


Property changes on: trunk/data/filetypes.nsis
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Modified: trunk/scintilla/KeyWords.cxx
===================================================================
--- trunk/scintilla/KeyWords.cxx	2008-12-21 20:09:29 UTC (rev 3413)
+++ trunk/scintilla/KeyWords.cxx	2008-12-21 20:31:09 UTC (rev 3414)
@@ -145,6 +145,7 @@
 	LINK_LEXER(lmBash);
 	LINK_LEXER(lmFreeBasic);
 	LINK_LEXER(lmCaml);
+	LINK_LEXER(lmCmake);
 	LINK_LEXER(lmCPP);
 	LINK_LEXER(lmCss);
 	LINK_LEXER(lmD);
@@ -157,6 +158,7 @@
 	LINK_LEXER(lmLua);
 	LINK_LEXER(lmMake);
 	LINK_LEXER(lmMatlab);
+	LINK_LEXER(lmNsis);
 	LINK_LEXER(lmNull);
 	LINK_LEXER(lmOMS);
 	LINK_LEXER(lmPascal);

Added: trunk/scintilla/LexCmake.cxx
===================================================================
--- trunk/scintilla/LexCmake.cxx	                        (rev 0)
+++ trunk/scintilla/LexCmake.cxx	2008-12-21 20:31:09 UTC (rev 3414)
@@ -0,0 +1,456 @@
+// 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"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+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);


Property changes on: trunk/scintilla/LexCmake.cxx
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Added: trunk/scintilla/LexNsis.cxx
===================================================================
--- trunk/scintilla/LexNsis.cxx	                        (rev 0)
+++ trunk/scintilla/LexNsis.cxx	2008-12-21 20:31:09 UTC (rev 3414)
@@ -0,0 +1,654 @@
+// Scintilla source code edit control
+/** @file LexNsis.cxx
+ ** Lexer for NSIS
+ **/
+// Copyright 2003 - 2005 by Angelo Mandato <angelo [at] spaceblue [dot] com>
+// Last Updated: 03/13/2005
+// 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"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+/*
+// located in SciLexer.h
+#define SCLEX_NSIS 43
+
+#define SCE_NSIS_DEFAULT 0
+#define SCE_NSIS_COMMENT 1
+#define SCE_NSIS_STRINGDQ 2
+#define SCE_NSIS_STRINGLQ 3
+#define SCE_NSIS_STRINGRQ 4
+#define SCE_NSIS_FUNCTION 5
+#define SCE_NSIS_VARIABLE 6
+#define SCE_NSIS_LABEL 7
+#define SCE_NSIS_USERDEFINED 8
+#define SCE_NSIS_SECTIONDEF 9
+#define SCE_NSIS_SUBSECTIONDEF 10
+#define SCE_NSIS_IFDEFINEDEF 11
+#define SCE_NSIS_MACRODEF 12
+#define SCE_NSIS_STRINGVAR 13
+#define SCE_NSIS_NUMBER 14
+// ADDED for Scintilla v1.63
+#define SCE_NSIS_SECTIONGROUP 15
+#define SCE_NSIS_PAGEEX 16
+#define SCE_NSIS_FUNCTIONDEF 17
+#define SCE_NSIS_COMMENTBOX 18
+*/
+
+static bool isNsisNumber(char ch)
+{
+  return (ch >= '0' && ch <= '9');
+}
+
+static bool isNsisChar(char ch)
+{
+  return (ch == '.' ) || (ch == '_' ) || isNsisNumber(ch) || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
+}
+
+static bool isNsisLetter(char ch)
+{
+  return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
+}
+
+static bool NsisNextLineHasElse(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( cNext == '!' )
+    {
+      if( styler.Match(firstChar, "!else") )
+        return true;
+    }
+    break;
+  }
+
+  return false;
+}
+
+static int NsisCmp( const char *s1, const char *s2, bool bIgnoreCase )
+{
+  if( bIgnoreCase )
+     return CompareCaseInsensitive( s1, s2);
+
+  return strcmp( s1, s2 );
+}
+
+static int calculateFoldNsis(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_NSIS_FUNCTIONDEF && style != SCE_NSIS_SECTIONDEF &&
+        style != SCE_NSIS_SUBSECTIONDEF && style != SCE_NSIS_IFDEFINEDEF &&
+        style != SCE_NSIS_MACRODEF && style != SCE_NSIS_SECTIONGROUP &&
+        style != SCE_NSIS_PAGEEX )
+          return foldlevel;
+  }
+  else
+  {
+    if( style != SCE_NSIS_FUNCTIONDEF && style != SCE_NSIS_SECTIONDEF &&
+        style != SCE_NSIS_SUBSECTIONDEF && style != SCE_NSIS_SECTIONGROUP &&
+        style != SCE_NSIS_PAGEEX )
+          return foldlevel;
+  }
+
+  int newFoldlevel = foldlevel;
+  bool bIgnoreCase = false;
+  if( styler.GetPropertyInt("nsis.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( s[0] == '!' )
+  {
+    if( NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!ifdef", bIgnoreCase ) == 0 || NsisCmp(s, "!if", bIgnoreCase ) == 0 || NsisCmp(s, "!macro", bIgnoreCase ) == 0 )
+      newFoldlevel++;
+    else if( NsisCmp(s, "!endif", bIgnoreCase) == 0 || NsisCmp(s, "!macroend", bIgnoreCase ) == 0 )
+      newFoldlevel--;
+    else if( bElse && NsisCmp(s, "!else", bIgnoreCase) == 0 )
+      newFoldlevel++;
+  }
+  else
+  {
+    if( NsisCmp(s, "Section", bIgnoreCase ) == 0 || NsisCmp(s, "SectionGroup", bIgnoreCase ) == 0 || NsisCmp(s, "Function", bIgnoreCase) == 0 || NsisCmp(s, "SubSection", bIgnoreCase ) == 0 || NsisCmp(s, "PageEx", bIgnoreCase ) == 0 )
+      newFoldlevel++;
+    else if( NsisCmp(s, "SectionGroupEnd", bIgnoreCase ) == 0 || NsisCmp(s, "SubSectionEnd", bIgnoreCase ) == 0 || NsisCmp(s, "FunctionEnd", bIgnoreCase) == 0 || NsisCmp(s, "SectionEnd", bIgnoreCase ) == 0 || NsisCmp(s, "PageExEnd", bIgnoreCase ) == 0 )
+      newFoldlevel--;
+  }
+
+  return newFoldlevel;
+}
+
+static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keywordLists[], Accessor &styler )
+{
+  bool bIgnoreCase = false;
+  if( styler.GetPropertyInt("nsis.ignorecase") == 1 )
+    bIgnoreCase = true;
+
+  bool bUserVars = false;
+  if( styler.GetPropertyInt("nsis.uservars") == 1 )
+    bUserVars = true;
+
+	char s[100];
+
+	WordList &Functions = *keywordLists[0];
+	WordList &Variables = *keywordLists[1];
+	WordList &Lables = *keywordLists[2];
+	WordList &UserDefined = *keywordLists[3];
+
+	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( NsisCmp(s, "!macro", bIgnoreCase ) == 0 || NsisCmp(s, "!macroend", bIgnoreCase) == 0 ) // Covers !micro and !microend
+		return SCE_NSIS_MACRODEF;
+
+	if( NsisCmp(s, "!ifdef", bIgnoreCase ) == 0 ||  NsisCmp(s, "!ifndef", bIgnoreCase) == 0 ||  NsisCmp(s, "!endif", bIgnoreCase) == 0 )
+		return SCE_NSIS_IFDEFINEDEF;
+
+  if( NsisCmp(s, "!else", bIgnoreCase ) == 0 ) // ||  NsisCmp(s, "!ifndef", bIgnoreCase) == 0 ||  NsisCmp(s, "!endif", bIgnoreCase) == 0 )
+		return SCE_NSIS_IFDEFINEDEF;
+
+  if( NsisCmp(s, "!if", bIgnoreCase ) == 0 )
+		return SCE_NSIS_IFDEFINEDEF;
+
+  if( NsisCmp(s, "SectionGroup", bIgnoreCase) == 0 || NsisCmp(s, "SectionGroupEnd", bIgnoreCase) == 0 ) // Covers SectionGroup and SectionGroupEnd
+    return SCE_NSIS_SECTIONGROUP;
+
+	if( NsisCmp(s, "Section", bIgnoreCase ) == 0 || NsisCmp(s, "SectionEnd", bIgnoreCase) == 0 ) // Covers Section and SectionEnd
+		return SCE_NSIS_SECTIONDEF;
+
+	if( NsisCmp(s, "SubSection", bIgnoreCase) == 0 || NsisCmp(s, "SubSectionEnd", bIgnoreCase) == 0 ) // Covers SubSection and SubSectionEnd
+		return SCE_NSIS_SUBSECTIONDEF;
+
+  if( NsisCmp(s, "PageEx", bIgnoreCase) == 0 || NsisCmp(s, "PageExEnd", bIgnoreCase) == 0 ) // Covers PageEx and PageExEnd
+    return SCE_NSIS_PAGEEX;
+
+	if( NsisCmp(s, "Function", bIgnoreCase) == 0 || NsisCmp(s, "FunctionEnd", bIgnoreCase) == 0 ) // Covers Function and FunctionEnd
+		return SCE_NSIS_FUNCTIONDEF;
+
+	if ( Functions.InList(s) )
+		return SCE_NSIS_FUNCTION;
+
+	if ( Variables.InList(s) )
+		return SCE_NSIS_VARIABLE;
+
+	if ( Lables.InList(s) )
+		return SCE_NSIS_LABEL;
+
+	if( UserDefined.InList(s) )
+		return SCE_NSIS_USERDEFINED;
+
+	if( strlen(s) > 3 )
+	{
+		if( s[1] == '{' && s[strlen(s)-1] == '}' )
+			return SCE_NSIS_VARIABLE;
+	}
+
+  // See if the variable is a user defined variable
+  if( s[0] == '$' && bUserVars )
+  {
+    bool bHasSimpleNsisChars = true;
+    for (unsigned int j = 1; j < end - start + 1 && j < 99; j++)
+	  {
+      if( !isNsisChar( s[j] ) )
+      {
+        bHasSimpleNsisChars = false;
+        break;
+      }
+	  }
+
+    if( bHasSimpleNsisChars )
+      return SCE_NSIS_VARIABLE;
+  }
+
+  // To check for numbers
+  if( isNsisNumber( s[0] ) )
+  {
+    bool bHasSimpleNsisNumber = true;
+    for (unsigned int j = 1; j < end - start + 1 && j < 99; j++)
+	  {
+      if( !isNsisNumber( s[j] ) )
+      {
+        bHasSimpleNsisNumber = false;
+        break;
+      }
+	  }
+
+    if( bHasSimpleNsisNumber )
+      return SCE_NSIS_NUMBER;
+  }
+
+	return SCE_NSIS_DEFAULT;
+}
+
+static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
+{
+	int state = SCE_NSIS_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_NSIS_DEFAULT:
+				if( cCurrChar == ';' || cCurrChar == '#' ) // we have a comment line
+				{
+					styler.ColourTo(i-1, state );
+					state = SCE_NSIS_COMMENT;
+					break;
+				}
+				if( cCurrChar == '"' )
+				{
+					styler.ColourTo(i-1, state );
+					state = SCE_NSIS_STRINGDQ;
+					bVarInString = false;
+          bClassicVarInString = false;
+					break;
+				}
+				if( cCurrChar == '\'' )
+				{
+					styler.ColourTo(i-1, state );
+					state = SCE_NSIS_STRINGRQ;
+					bVarInString = false;
+          bClassicVarInString = false;
+					break;
+				}
+				if( cCurrChar == '`' )
+				{
+					styler.ColourTo(i-1, state );
+					state = SCE_NSIS_STRINGLQ;
+					bVarInString = false;
+          bClassicVarInString = false;
+					break;
+				}
+
+				// NSIS KeyWord,Function, Variable, UserDefined:
+				if( cCurrChar == '$' || isNsisChar(cCurrChar) || cCurrChar == '!' )
+				{
+					styler.ColourTo(i-1,state);
+				  state = SCE_NSIS_FUNCTION;
+
+          // If it is a number, we must check and set style here first...
+          if( isNsisNumber(cCurrChar) && (cNextChar == '\t' || cNextChar == ' ' || cNextChar == '\r' || cNextChar == '\n' ) )
+              styler.ColourTo( i, SCE_NSIS_NUMBER);
+
+					break;
+				}
+
+        if( cCurrChar == '/' && cNextChar == '*' )
+        {
+          styler.ColourTo(i-1,state);
+          state = SCE_NSIS_COMMENTBOX;
+          break;
+        }
+
+				break;
+			case SCE_NSIS_COMMENT:
+				if( cNextChar == '\n' || cNextChar == '\r' )
+        {
+          // Special case:
+          if( cCurrChar == '\\' )
+          {
+            styler.ColourTo(i-2,state);
+            styler.ColourTo(i,SCE_NSIS_DEFAULT);
+          }
+          else
+          {
+				    styler.ColourTo(i,state);
+            state = SCE_NSIS_DEFAULT;
+          }
+        }
+				break;
+			case SCE_NSIS_STRINGDQ:
+      case SCE_NSIS_STRINGLQ:
+      case SCE_NSIS_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_NSIS_STRINGDQ )
+				{
+					styler.ColourTo(i,state);
+				  state = SCE_NSIS_DEFAULT;
+          break;
+				}
+
+        if( cCurrChar == '`' && state == SCE_NSIS_STRINGLQ )
+        {
+					styler.ColourTo(i,state);
+				  state = SCE_NSIS_DEFAULT;
+          break;
+				}
+
+        if( cCurrChar == '\'' && state == SCE_NSIS_STRINGRQ )
+				{
+					styler.ColourTo(i,state);
+				  state = SCE_NSIS_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_NSIS_DEFAULT;
+          }
+        }
+				break;
+
+			case SCE_NSIS_FUNCTION:
+
+				// NSIS KeyWord:
+        if( cCurrChar == '$' )
+          state = SCE_NSIS_DEFAULT;
+        else if( cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' ) )
+          state = SCE_NSIS_DEFAULT;
+				else if( (isNsisChar(cCurrChar) && !isNsisChar( cNextChar) && cNextChar != '}') || cCurrChar == '}' )
+				{
+					state = classifyWordNsis( styler.GetStartSegment(), i, keywordLists, styler );
+					styler.ColourTo( i, state);
+					state = SCE_NSIS_DEFAULT;
+				}
+				else if( !isNsisChar( cCurrChar ) && cCurrChar != '{' && cCurrChar != '}' )
+				{
+          if( classifyWordNsis( styler.GetStartSegment(), i-1, keywordLists, styler) == SCE_NSIS_NUMBER )
+             styler.ColourTo( i-1, SCE_NSIS_NUMBER );
+
+					state = SCE_NSIS_DEFAULT;
+
+					if( cCurrChar == '"' )
+					{
+						state = SCE_NSIS_STRINGDQ;
+						bVarInString = false;
+            bClassicVarInString = false;
+					}
+					else if( cCurrChar == '`' )
+					{
+						state = SCE_NSIS_STRINGLQ;
+						bVarInString = false;
+            bClassicVarInString = false;
+					}
+					else if( cCurrChar == '\'' )
+					{
+						state = SCE_NSIS_STRINGRQ;
+						bVarInString = false;
+            bClassicVarInString = false;
+					}
+					else if( cCurrChar == '#' || cCurrChar == ';' )
+          {
+						state = SCE_NSIS_COMMENT;
+          }
+				}
+				break;
+      case SCE_NSIS_COMMENTBOX:
+
+        if( styler.SafeGetCharAt(i-1) == '*' && cCurrChar == '/' )
+        {
+          styler.ColourTo(i,state);
+          state = SCE_NSIS_DEFAULT;
+        }
+        break;
+		}
+
+		if( state == SCE_NSIS_COMMENT || state == SCE_NSIS_COMMENTBOX )
+		{
+			styler.ColourTo(i,state);
+		}
+		else if( state == SCE_NSIS_STRINGDQ || state == SCE_NSIS_STRINGLQ || state == SCE_NSIS_STRINGRQ )
+		{
+      bool bIngoreNextDollarSign = false;
+      bool bUserVars = false;
+      if( styler.GetPropertyInt("nsis.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_NSIS_STRINGVAR);
+        bVarInString = false;
+        bIngoreNextDollarSign = false;
+      }
+
+      // Covers "$INSTDIR and user vars like $MYVAR"
+      else if( bVarInString && !isNsisChar(cNextChar) )
+      {
+        int nWordState = classifyWordNsis( styler.GetStartSegment(), i, keywordLists, styler);
+				if( nWordState == SCE_NSIS_VARIABLE )
+					styler.ColourTo( i, SCE_NSIS_STRINGVAR);
+        else if( bUserVars )
+          styler.ColourTo( i, SCE_NSIS_STRINGVAR);
+        bVarInString = false;
+      }
+      // Covers "${TEST}..."
+      else if( bClassicVarInString && cNextChar == '}' )
+      {
+        styler.ColourTo( i+1, SCE_NSIS_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 FoldNsisDoc(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("nsis.foldutilcmd", 1) == 1;
+  bool blockComment = false;
+
+  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);
+  if( style == SCE_NSIS_COMMENTBOX )
+  {
+    if( styler.SafeGetCharAt(safeStartPos) == '/' && styler.SafeGetCharAt(safeStartPos+1) == '*' )
+      levelNext++;
+    blockComment = true;
+  }
+
+  for (unsigned int i = safeStartPos; i < startPos + length; i++)
+	{
+    char chCurr = styler.SafeGetCharAt(i);
+    style = styler.StyleAt(i);
+    if( blockComment && style != SCE_NSIS_COMMENTBOX )
+    {
+      levelNext--;
+      blockComment = false;
+    }
+    else if( !blockComment && style == SCE_NSIS_COMMENTBOX )
+    {
+      levelNext++;
+      blockComment = true;
+    }
+
+    if( bArg1 && !blockComment)
+    {
+      if( nWordStart == -1 && (isNsisLetter(chCurr) || chCurr == '!') )
+      {
+        nWordStart = i;
+      }
+      else if( isNsisLetter(chCurr) == false && nWordStart > -1 )
+      {
+        int newLevel = calculateFoldNsis( nWordStart, i-1, levelNext, styler, foldAtElse, foldUtilityCmd );
+
+        if( newLevel == levelNext )
+        {
+          if( foldAtElse && foldUtilityCmd )
+          {
+            if( NsisNextLineHasElse(i, startPos + length, styler) )
+              levelNext--;
+          }
+        }
+        else
+          levelNext = newLevel;
+        bArg1 = false;
+      }
+    }
+
+    if( chCurr == '\n' )
+    {
+      if( bArg1 && foldAtElse && foldUtilityCmd && !blockComment )
+      {
+        if( NsisNextLineHasElse(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 nsisWordLists[] = {
+	"Functions",
+	"Variables",
+	"Lables",
+	"UserDefined",
+	0, };
+
+
+LexerModule lmNsis(SCLEX_NSIS, ColouriseNsisDoc, "nsis", FoldNsisDoc, nsisWordLists);
+


Property changes on: trunk/scintilla/LexNsis.cxx
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Modified: trunk/scintilla/Makefile.am
===================================================================
--- trunk/scintilla/Makefile.am	2008-12-21 20:09:29 UTC (rev 3413)
+++ trunk/scintilla/Makefile.am	2008-12-21 20:31:09 UTC (rev 3414)
@@ -11,6 +11,7 @@
 LexBash.cxx \
 LexCPP.cxx \
 LexCaml.cxx \
+LexCmake.cxx \
 LexCrontab.cxx \
 LexCSS.cxx \
 LexD.cxx \
@@ -19,6 +20,7 @@
 LexHTML.cxx \
 LexYAML.cxx \
 LexLua.cxx \
+LexNsis.cxx \
 LexOMS.cxx \
 LexMatlab.cxx \
 LexOthers.cxx \

Modified: trunk/scintilla/makefile.win32
===================================================================
--- trunk/scintilla/makefile.win32	2008-12-21 20:09:29 UTC (rev 3413)
+++ trunk/scintilla/makefile.win32	2008-12-21 20:31:09 UTC (rev 3414)
@@ -62,7 +62,7 @@
 LEXOBJS=\
 LexBash.o LexAsm.o LexCSS.o LexCPP.o LexCrontab.o LexHTML.o LexOthers.o LexPascal.o \
 LexPerl.o LexPython.o LexSQL.o LexCaml.o LexOMS.o LexTCL.o LexRuby.o LexFortran.o LexVHDL.o LexMatlab.o \
-LexD.o LexLua.o LexHaskell.o LexBasic.o LexR.o LexYAML.o
+LexD.o LexLua.o LexHaskell.o LexBasic.o LexR.o LexYAML.o LexCmake.o LexNsis.o
 #--Autogenerated -- end of automatically generated section
 
 all: $(COMPLIB)

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2008-12-21 20:09:29 UTC (rev 3413)
+++ trunk/src/editor.c	2008-12-21 20:31:09 UTC (rev 3414)
@@ -2932,6 +2932,18 @@
 				style == SCE_H_SGML_DOUBLESTRING ||
 				style == SCE_H_SGML_SIMPLESTRING ||
 				style == SCE_H_SINGLESTRING);
+
+		case SCLEX_CMAKE:
+			return (style == SCE_CMAKE_STRINGDQ ||
+				style == SCE_CMAKE_STRINGLQ ||
+				style == SCE_CMAKE_STRINGRQ ||
+				style == SCE_CMAKE_STRINGVAR);
+
+		case SCLEX_NSIS:
+			return (style == SCE_NSIS_STRINGDQ ||
+				style == SCE_NSIS_STRINGLQ ||
+				style == SCE_NSIS_STRINGRQ ||
+				style == SCE_NSIS_STRINGVAR);
 	}
 	return FALSE;
 }
@@ -3042,6 +3054,13 @@
 				style == SCE_HPHP_COMMENT ||
 				style == SCE_HPHP_COMMENTLINE ||
 				style == SCE_H_SGML_COMMENT);
+
+		case SCLEX_CMAKE:
+			return (style == SCE_CMAKE_COMMENT);
+
+		case SCLEX_NSIS:
+			return (style == SCE_NSIS_COMMENT ||
+				style == SCE_NSIS_COMMENTBOX);
 	}
 	return FALSE;
 }

Modified: trunk/src/filetypes.c
===================================================================
--- trunk/src/filetypes.c	2008-12-21 20:09:29 UTC (rev 3413)
+++ trunk/src/filetypes.c	2008-12-21 20:31:09 UTC (rev 3414)
@@ -529,6 +529,28 @@
 	ft->comment_close = NULL;
 	ft->group = GEANY_FILETYPE_GROUP_MISC;
 
+#define CMAKE
+	ft = filetypes[GEANY_FILETYPES_CMAKE];
+	ft->lang = -2;
+	ft->name = g_strdup("CMake");
+	ft->title = g_strdup_printf(_("%s source file"), "CMake");
+	ft->extension = g_strdup("cmake");
+	ft->pattern = utils_strv_new("CMakeLists.txt", "*.cmake", "*.ctest", NULL);
+	ft->comment_open = g_strdup("#");
+	ft->comment_close = NULL;
+	ft->group = GEANY_FILETYPE_GROUP_MISC;
+
+#define NSIS
+	ft = filetypes[GEANY_FILETYPES_NSIS];
+	ft->lang = -2;
+	ft->name = g_strdup("NSIS");
+	ft->title = g_strdup_printf(_("%s source file"), "NSIS");
+	ft->extension = g_strdup("nsis");
+	ft->pattern = utils_strv_new("*.nsi", "*.nsh", NULL);
+	ft->comment_open = g_strdup(";");
+	ft->comment_close = NULL;
+	ft->group = GEANY_FILETYPE_GROUP_MISC;
+
 #define ALL
 	ft = filetypes[GEANY_FILETYPES_NONE];
 	ft->lang = -2;

Modified: trunk/src/filetypes.h
===================================================================
--- trunk/src/filetypes.h	2008-12-21 20:09:29 UTC (rev 3413)
+++ trunk/src/filetypes.h	2008-12-21 20:31:09 UTC (rev 3414)
@@ -68,15 +68,17 @@
 	GEANY_FILETYPES_SH,
 	GEANY_FILETYPES_TCL,
 
-	/* markup langauges */
+	/* markup languages */
 	GEANY_FILETYPES_CSS,
 	GEANY_FILETYPES_DOCBOOK,
 	GEANY_FILETYPES_HTML,
 	GEANY_FILETYPES_XML,
 
 	/* miscellaneous languages */
+	GEANY_FILETYPES_CMAKE,
 	GEANY_FILETYPES_CONF,
 	GEANY_FILETYPES_DIFF,
+	GEANY_FILETYPES_NSIS,
 	GEANY_FILETYPES_PO,
 	GEANY_FILETYPES_LATEX,
 	GEANY_FILETYPES_REST,

Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c	2008-12-21 20:09:29 UTC (rev 3413)
+++ trunk/src/highlighting.c	2008-12-21 20:31:09 UTC (rev 3414)
@@ -642,7 +642,7 @@
 GeanyLexerStyle gsd_number =		{0x007f00, 0xffffff, FALSE, FALSE};
 GeanyLexerStyle gsd_reserved_word =	{0x00007f, 0xffffff, TRUE, FALSE};
 GeanyLexerStyle gsd_system_word =	{0x991111, 0xffffff, TRUE, FALSE};
-GeanyLexerStyle gsd_user_word =	{0x0000d0, 0xffffff, TRUE, FALSE};
+GeanyLexerStyle gsd_user_word =		{0x0000d0, 0xffffff, TRUE, FALSE};
 GeanyLexerStyle gsd_string =		{0xff901e, 0xffffff, FALSE, FALSE};
 GeanyLexerStyle gsd_pragma =		{0x007f7f, 0xffffff, FALSE, FALSE};
 GeanyLexerStyle gsd_string_eol =	{0x000000, 0xe0c0e0, FALSE, FALSE};
@@ -1615,6 +1615,65 @@
 }
 
 
+static void styleset_cmake_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
+{
+	new_style_array(GEANY_FILETYPES_CMAKE, 15);
+	get_keyfile_hex(config, config_home, "styling", "default", "0x000000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_CMAKE].styling[0]);
+	get_keyfile_hex(config, config_home, "styling", "comment", "0x808080", "0xffffff", "false", &style_sets[GEANY_FILETYPES_CMAKE].styling[1]);
+	get_keyfile_hex(config, config_home, "styling", "stringdq", "0xff901e", "0xffffff", "false", &style_sets[GEANY_FILETYPES_CMAKE].styling[2]);
+	get_keyfile_hex(config, config_home, "styling", "stringlq", "0x008000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_CMAKE].styling[3]);
+	get_keyfile_hex(config, config_home, "styling", "stringrq", "0x008000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_CMAKE].styling[4]);
+	get_keyfile_hex(config, config_home, "styling", "command", "0x00007f", "0xffffff", "false", &style_sets[GEANY_FILETYPES_CMAKE].styling[5]);
+	get_keyfile_hex(config, config_home, "styling", "parameters", "0x991111", "0xffffff", "false", &style_sets[GEANY_FILETYPES_CMAKE].styling[6]);
+	get_keyfile_hex(config, config_home, "styling", "variable", "0x007f7f", "0xffffff", "false", &style_sets[GEANY_FILETYPES_CMAKE].styling[7]);
+	get_keyfile_hex(config, config_home, "styling", "userdefined", "0x0000d0", "0xffffff", "true", &style_sets[GEANY_FILETYPES_CMAKE].styling[8]);
+	get_keyfile_hex(config, config_home, "styling", "whiledef", "0x00007f", "0xffffff", "true", &style_sets[GEANY_FILETYPES_CMAKE].styling[9]);
+	get_keyfile_hex(config, config_home, "styling", "foreachdef", "0x00007f", "0xffffff", "true", &style_sets[GEANY_FILETYPES_CMAKE].styling[10]);
+	get_keyfile_hex(config, config_home, "styling", "ifdefinedef", "0x00007f", "0xffffff", "true", &style_sets[GEANY_FILETYPES_CMAKE].styling[11]);
+	get_keyfile_hex(config, config_home, "styling", "macrodef", "0x00007f", "0xffffff", "true", &style_sets[GEANY_FILETYPES_CMAKE].styling[12]);
+	get_keyfile_hex(config, config_home, "styling", "stringvar", "0x007f7f", "0xffffff", "false", &style_sets[GEANY_FILETYPES_CMAKE].styling[13]);
+	get_keyfile_hex(config, config_home, "styling", "number", "0x007f00", "0xffffff", "false", &style_sets[GEANY_FILETYPES_CMAKE].styling[14]);
+
+	style_sets[GEANY_FILETYPES_CMAKE].keywords = g_new(gchar*, 4);
+	get_keyfile_keywords(config, config_home, "keywords", "commands", GEANY_FILETYPES_CMAKE, 0, "");
+	get_keyfile_keywords(config, config_home, "keywords", "parameters", GEANY_FILETYPES_CMAKE, 1, "");
+	get_keyfile_keywords(config, config_home, "keywords", "userdefined", GEANY_FILETYPES_CMAKE, 2, "");
+	style_sets[GEANY_FILETYPES_CMAKE].keywords[3] = NULL;
+
+	get_keyfile_wordchars(config, config_home,
+		&style_sets[GEANY_FILETYPES_CMAKE].wordchars);
+}
+
+
+static void styleset_cmake(ScintillaObject *sci)
+{
+	const filetype_id ft_id = GEANY_FILETYPES_CMAKE;
+
+	apply_filetype_properties(sci, SCLEX_CMAKE, ft_id);
+
+	SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_CMAKE].keywords[0]);
+	SSM(sci, SCI_SETKEYWORDS, 1, (sptr_t) style_sets[GEANY_FILETYPES_CMAKE].keywords[1]);
+	SSM(sci, SCI_SETKEYWORDS, 2, (sptr_t) style_sets[GEANY_FILETYPES_CMAKE].keywords[2]);
+
+	set_sci_style(sci, STYLE_DEFAULT, GEANY_FILETYPES_CMAKE, 0);
+	set_sci_style(sci, SCE_CMAKE_DEFAULT, GEANY_FILETYPES_CMAKE, 0);
+	set_sci_style(sci, SCE_CMAKE_COMMENT, GEANY_FILETYPES_CMAKE, 1);
+	set_sci_style(sci, SCE_CMAKE_STRINGDQ, GEANY_FILETYPES_CMAKE, 2);
+	set_sci_style(sci, SCE_CMAKE_STRINGLQ, GEANY_FILETYPES_CMAKE, 3);
+	set_sci_style(sci, SCE_CMAKE_STRINGRQ, GEANY_FILETYPES_CMAKE, 4);
+	set_sci_style(sci, SCE_CMAKE_COMMANDS, GEANY_FILETYPES_CMAKE, 5);
+	set_sci_style(sci, SCE_CMAKE_PARAMETERS, GEANY_FILETYPES_CMAKE, 6);
+	set_sci_style(sci, SCE_CMAKE_VARIABLE, GEANY_FILETYPES_CMAKE, 7);
+	set_sci_style(sci, SCE_CMAKE_USERDEFINED, GEANY_FILETYPES_CMAKE, 8);
+	set_sci_style(sci, SCE_CMAKE_WHILEDEF, GEANY_FILETYPES_CMAKE, 9);
+	set_sci_style(sci, SCE_CMAKE_FOREACHDEF, GEANY_FILETYPES_CMAKE, 10);
+	set_sci_style(sci, SCE_CMAKE_IFDEFINEDEF, GEANY_FILETYPES_CMAKE, 11);
+	set_sci_style(sci, SCE_CMAKE_MACRODEF, GEANY_FILETYPES_CMAKE, 12);
+	set_sci_style(sci, SCE_CMAKE_STRINGVAR, GEANY_FILETYPES_CMAKE, 13);
+	set_sci_style(sci, SCE_CMAKE_NUMBER, GEANY_FILETYPES_CMAKE, 14);
+}
+
+
 static void styleset_r_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
 {
 	new_style_array(GEANY_FILETYPES_R, 12);
@@ -2069,6 +2128,78 @@
 }
 
 
+static void styleset_nsis_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
+{
+	new_style_array(GEANY_FILETYPES_NSIS, 19);
+	get_keyfile_hex(config, config_home, "styling", "default", "0x000000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_NSIS].styling[0]);
+	get_keyfile_hex(config, config_home, "styling", "comment", "0x808080", "0xffffff", "false", &style_sets[GEANY_FILETYPES_NSIS].styling[1]);
+	get_keyfile_hex(config, config_home, "styling", "stringdq", "0xff901e", "0xffffff", "false", &style_sets[GEANY_FILETYPES_NSIS].styling[2]);
+	get_keyfile_hex(config, config_home, "styling", "stringlq", "0x008000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_NSIS].styling[3]);
+	get_keyfile_hex(config, config_home, "styling", "stringrq", "0x008000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_NSIS].styling[4]);
+	get_keyfile_hex(config, config_home, "styling", "function", "0x00007f", "0xffffff", "false", &style_sets[GEANY_FILETYPES_NSIS].styling[5]);
+	get_keyfile_hex(config, config_home, "styling", "variable", "0x991111", "0xffffff", "false", &style_sets[GEANY_FILETYPES_NSIS].styling[6]);
+	get_keyfile_hex(config, config_home, "styling", "label", "0x007f7f", "0xffffff", "false", &style_sets[GEANY_FILETYPES_NSIS].styling[7]);
+	get_keyfile_hex(config, config_home, "styling", "userdefined", "0x0000d0", "0xffffff", "true", &style_sets[GEANY_FILETYPES_NSIS].styling[8]);
+	get_keyfile_hex(config, config_home, "styling", "sectiondef", "0x00007f", "0xffffff", "true", &style_sets[GEANY_FILETYPES_NSIS].styling[9]);
+	get_keyfile_hex(config, config_home, "styling", "subsectiondef", "0x00007f", "0xffffff", "true", &style_sets[GEANY_FILETYPES_NSIS].styling[10]);
+	get_keyfile_hex(config, config_home, "styling", "ifdefinedef", "0x00007f", "0xffffff", "true", &style_sets[GEANY_FILETYPES_NSIS].styling[11]);
+	get_keyfile_hex(config, config_home, "styling", "macrodef", "0x00007f", "0xffffff", "true", &style_sets[GEANY_FILETYPES_NSIS].styling[12]);
+	get_keyfile_hex(config, config_home, "styling", "stringvar", "0x991111", "0xffffff", "false", &style_sets[GEANY_FILETYPES_NSIS].styling[13]);
+	get_keyfile_hex(config, config_home, "styling", "number", "0x007f00", "0xffffff", "false", &style_sets[GEANY_FILETYPES_NSIS].styling[14]);
+	get_keyfile_hex(config, config_home, "styling", "sectiongroup", "00007f", "0xffffff", "true", &style_sets[GEANY_FILETYPES_NSIS].styling[15]);
+	get_keyfile_hex(config, config_home, "styling", "pageex", "0x00007f", "0xffffff", "true", &style_sets[GEANY_FILETYPES_NSIS].styling[16]);
+	get_keyfile_hex(config, config_home, "styling", "functiondef", "0x00007f", "0xffffff", "true", &style_sets[GEANY_FILETYPES_NSIS].styling[17]);
+	get_keyfile_hex(config, config_home, "styling", "commentbox", "0x808080", "0xffffff", "false", &style_sets[GEANY_FILETYPES_NSIS].styling[18]);
+
+	style_sets[GEANY_FILETYPES_NSIS].keywords = g_new(gchar*, 5);
+	get_keyfile_keywords(config, config_home, "keywords", "functions", GEANY_FILETYPES_NSIS, 0, "");
+	get_keyfile_keywords(config, config_home, "keywords", "variables", GEANY_FILETYPES_NSIS, 1, "");
+	get_keyfile_keywords(config, config_home, "keywords", "lables", GEANY_FILETYPES_NSIS, 2, "");
+	get_keyfile_keywords(config, config_home, "keywords", "userdefined", GEANY_FILETYPES_NSIS, 3, "");
+	style_sets[GEANY_FILETYPES_NSIS].keywords[4] = NULL;
+
+	get_keyfile_wordchars(config, config_home,
+		&style_sets[GEANY_FILETYPES_NSIS].wordchars);
+}
+
+
+static void styleset_nsis(ScintillaObject *sci)
+{
+	const filetype_id ft_id = GEANY_FILETYPES_NSIS;
+
+	apply_filetype_properties(sci, SCLEX_NSIS, ft_id);
+
+	SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_NSIS].keywords[0]);
+	SSM(sci, SCI_SETKEYWORDS, 1, (sptr_t) style_sets[GEANY_FILETYPES_NSIS].keywords[1]);
+	SSM(sci, SCI_SETKEYWORDS, 2, (sptr_t) style_sets[GEANY_FILETYPES_NSIS].keywords[2]);
+	SSM(sci, SCI_SETKEYWORDS, 3, (sptr_t) style_sets[GEANY_FILETYPES_NSIS].keywords[3]);
+
+	set_sci_style(sci, STYLE_DEFAULT, GEANY_FILETYPES_NSIS, 0);
+	set_sci_style(sci, SCE_NSIS_DEFAULT, GEANY_FILETYPES_NSIS, 0);
+	set_sci_style(sci, SCE_NSIS_COMMENT, GEANY_FILETYPES_NSIS, 1);
+	set_sci_style(sci, SCE_NSIS_STRINGDQ, GEANY_FILETYPES_NSIS, 2);
+	set_sci_style(sci, SCE_NSIS_STRINGLQ, GEANY_FILETYPES_NSIS, 3);
+	set_sci_style(sci, SCE_NSIS_STRINGRQ, GEANY_FILETYPES_NSIS, 4);
+	set_sci_style(sci, SCE_NSIS_FUNCTION, GEANY_FILETYPES_NSIS, 5);
+	set_sci_style(sci, SCE_NSIS_VARIABLE, GEANY_FILETYPES_NSIS, 6);
+	set_sci_style(sci, SCE_NSIS_LABEL, GEANY_FILETYPES_NSIS, 7);
+	set_sci_style(sci, SCE_NSIS_USERDEFINED, GEANY_FILETYPES_NSIS, 8);
+	set_sci_style(sci, SCE_NSIS_SECTIONDEF, GEANY_FILETYPES_NSIS, 9);
+	set_sci_style(sci, SCE_NSIS_SUBSECTIONDEF, GEANY_FILETYPES_NSIS, 10);
+	set_sci_style(sci, SCE_NSIS_IFDEFINEDEF, GEANY_FILETYPES_NSIS, 11);
+	set_sci_style(sci, SCE_NSIS_MACRODEF, GEANY_FILETYPES_NSIS, 12);
+	set_sci_style(sci, SCE_NSIS_STRINGVAR, GEANY_FILETYPES_NSIS, 13);
+	set_sci_style(sci, SCE_NSIS_NUMBER, GEANY_FILETYPES_NSIS, 14);
+	set_sci_style(sci, SCE_NSIS_SECTIONGROUP, GEANY_FILETYPES_NSIS, 15);
+	set_sci_style(sci, SCE_NSIS_PAGEEX, GEANY_FILETYPES_NSIS, 16);
+	set_sci_style(sci, SCE_NSIS_FUNCTIONDEF, GEANY_FILETYPES_NSIS, 17);
+	set_sci_style(sci, SCE_NSIS_COMMENTBOX, GEANY_FILETYPES_NSIS, 18);
+
+	SSM(sci, SCI_SETPROPERTY, (sptr_t) "nsis.uservars", (sptr_t) "1");
+	SSM(sci, SCI_SETPROPERTY, (sptr_t) "nsis.ignorecase", (sptr_t) "1");
+}
+
+
 static void styleset_po_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
 {
 	new_style_array(GEANY_FILETYPES_PO, 9);
@@ -3220,6 +3351,7 @@
 		init_styleset_case(GEANY_FILETYPES_BASIC,	basic);
 		init_styleset_case(GEANY_FILETYPES_C,		c);
 		init_styleset_case(GEANY_FILETYPES_CAML,	caml);
+		init_styleset_case(GEANY_FILETYPES_CMAKE,	cmake);
 		init_styleset_case(GEANY_FILETYPES_CONF,	conf);
 		init_styleset_case(GEANY_FILETYPES_CPP,		cpp);
 		init_styleset_case(GEANY_FILETYPES_CS,		cs);
@@ -3240,6 +3372,7 @@
 		init_styleset_case(GEANY_FILETYPES_LUA,		lua);
 		init_styleset_case(GEANY_FILETYPES_MAKE,	makefile);
 		init_styleset_case(GEANY_FILETYPES_MATLAB,	matlab);
+		init_styleset_case(GEANY_FILETYPES_NSIS,	nsis);
 		init_styleset_case(GEANY_FILETYPES_OMS,		oms);
 		init_styleset_case(GEANY_FILETYPES_PASCAL,	pascal);
 		init_styleset_case(GEANY_FILETYPES_PERL,	perl);
@@ -3279,6 +3412,7 @@
 		styleset_case(GEANY_FILETYPES_BASIC,	basic);
 		styleset_case(GEANY_FILETYPES_C,		c);
 		styleset_case(GEANY_FILETYPES_CAML,		caml);
+		styleset_case(GEANY_FILETYPES_CMAKE,	cmake);
 		styleset_case(GEANY_FILETYPES_CONF,		conf);
 		styleset_case(GEANY_FILETYPES_CPP,		cpp);
 		styleset_case(GEANY_FILETYPES_CS,		cs);
@@ -3299,6 +3433,7 @@
 		styleset_case(GEANY_FILETYPES_LUA,		lua);
 		styleset_case(GEANY_FILETYPES_MAKE,		makefile);
 		styleset_case(GEANY_FILETYPES_MATLAB,	matlab);
+		styleset_case(GEANY_FILETYPES_NSIS,		nsis);
 		styleset_case(GEANY_FILETYPES_OMS,		oms);
 		styleset_case(GEANY_FILETYPES_PASCAL,	pascal);
 		styleset_case(GEANY_FILETYPES_PERL,		perl);

Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h	2008-12-21 20:09:29 UTC (rev 3413)
+++ trunk/src/plugindata.h	2008-12-21 20:31:09 UTC (rev 3414)
@@ -45,13 +45,13 @@
 enum {
 	/** The Application Programming Interface (API) version, incremented
 	 * whenever any plugin data types are modified or appended to. */
-	GEANY_API_VERSION = 120,
+	GEANY_API_VERSION = 121,
 
 	/** The Application Binary Interface (ABI) version, incremented whenever
 	 * existing fields in the plugin data types have to be changed or reordered. */
 	/* This should usually stay the same if fields are only appended, assuming only pointers to
 	 * structs and not structs themselves are declared by plugins. */
-	GEANY_ABI_VERSION = 53
+	GEANY_ABI_VERSION = 54
 };
 
 /** Check the plugin can be loaded by Geany.

Modified: trunk/src/templates.c
===================================================================
--- trunk/src/templates.c	2008-12-21 20:09:29 UTC (rev 3413)
+++ trunk/src/templates.c	2008-12-21 20:31:09 UTC (rev 3414)
@@ -588,6 +588,7 @@
 		case GEANY_FILETYPES_CONF:
 		case GEANY_FILETYPES_PO:
 		case GEANY_FILETYPES_YAML:
+		case GEANY_FILETYPES_CMAKE:
 		{
 			line_prefix = "#";
 			break;
@@ -623,6 +624,7 @@
 		}
 
 		case GEANY_FILETYPES_ASM:
+		case GEANY_FILETYPES_NSIS:
 		{
 			line_prefix = ";";
 			break;

Modified: trunk/wscript
===================================================================
--- trunk/wscript	2008-12-21 20:09:29 UTC (rev 3413)
+++ trunk/wscript	2008-12-21 20:31:09 UTC (rev 3414)
@@ -72,10 +72,10 @@
 	'scintilla/DocumentAccessor.cxx', 'scintilla/Document.cxx', 'scintilla/Editor.cxx',
 	'scintilla/ExternalLexer.cxx',  'scintilla/Indicator.cxx',  'scintilla/KeyMap.cxx',
 	'scintilla/KeyWords.cxx', 'scintilla/LexAsm.cxx', 'scintilla/LexBash.cxx',
-	'scintilla/LexBasic.cxx', 'scintilla/LexCaml.cxx', 'scintilla/LexCPP.cxx',
+	'scintilla/LexBasic.cxx', 'scintilla/LexCaml.cxx', 'scintilla/LexCmake.cxx', 'scintilla/LexCPP.cxx',
 	'scintilla/LexCrontab.cxx', 'scintilla/LexCSS.cxx', 'scintilla/LexD.cxx',
 	'scintilla/LexFortran.cxx', 'scintilla/LexHaskell.cxx', 'scintilla/LexHTML.cxx',
-	'scintilla/LexLua.cxx', 'scintilla/LexOMS.cxx', 'scintilla/LexOthers.cxx',
+	'scintilla/LexLua.cxx', 'scintilla/LexNsis.cxx', 'scintilla/LexOMS.cxx', 'scintilla/LexOthers.cxx',
 	'scintilla/LexPascal.cxx', 'scintilla/LexPerl.cxx', 'scintilla/LexPython.cxx',
 	'scintilla/LexR.cxx', 'scintilla/LexMatlab.cxx', 'scintilla/LexYAML.cxx',
 	'scintilla/LexRuby.cxx', 'scintilla/LexSQL.cxx', 'scintilla/LexTCL.cxx',


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list