[geany/geany] b51877: Add support for DOS, OS/2 and Windows batch files

canou git-noreply at xxxxx
Thu Aug 15 06:04:35 UTC 2013


Branch:      refs/heads/master
Author:      canou <canou at server.fake>
Committer:   Matthew Brush <matt at geany.org>
Date:        Thu, 15 Aug 2013 06:04:35 UTC
Commit:      b518770dea6daeba90f5c16a9b194f16b7de39c9
             https://github.com/geany/geany/commit/b518770dea6daeba90f5c16a9b194f16b7de39c9

Log Message:
-----------
Add support for DOS, OS/2 and Windows batch files

* Uses existing LexOthers.cxx from Scintilla already in use by Geany
* "identifier" style mapping goes to "string" for better presentation
even if it's semantically incorrect, we'll change it back if it causes
issues for anyone.
* Filetype configuration and keywords taken from Don Ho's Notepad++.

Closes #160


Modified Paths:
--------------
    data/filetype_extensions.conf
    data/filetypes.batch
    scintilla/src/Catalogue.cxx
    src/filetypes.c
    src/filetypes.h
    src/highlighting.c
    src/highlightingmappings.h

Modified: data/filetype_extensions.conf
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -8,6 +8,7 @@ ActionScript=*.as;
 Ada=*.adb;*.ads;
 Asciidoc=*.asciidoc;
 ASM=*.asm;
+Batch=*.bat;*.cmd;*.nt;
 CAML=*.ml;*.mli;
 C=*.c;*.h;
 C++=*.cpp;*.cxx;*.c++;*.cc;*.h;*.hpp;*.hxx;*.h++;*.hh;*.C;*.H;


Modified: data/filetypes.batch
40 files changed, 40 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,40 @@
+# For complete documentation of this file, please see Geany's main documentation
+[styling]
+# Edit these in the colorscheme .conf file instead
+default=default
+comment=comment_line
+label=label
+word=keyword_1
+hide=other
+command=function
+operator=operator
+identifier=string
+
+[keywords]
+# all items must be in one line
+keywords=rem set if else exist errorlevel for in do break call copy chcp cd chdir choice cls country ctty date del erase dir echo exit goto loadfix loadhigh mkdir md move path pause prompt rename ren rmdir rd shift time type ver verify vol com con lpt nul defined not errorlevel cmdextversion
+keywords_optional=
+
+[settings]
+# default extension used when saving files
+extension=bat
+
+# the following characters are these which a "word" can contains, see documentation
+#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
+
+# single comments, like # in this file
+comment_single=::
+# multiline comments
+#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=


Modified: scintilla/src/Catalogue.cxx
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -85,6 +85,7 @@ int Scintilla_LinkLexers() {
 	LINK_LEXER(lmAda);
 	LINK_LEXER(lmAsm);
 	LINK_LEXER(lmBash);
+	LINK_LEXER(lmBatch);
 	LINK_LEXER(lmCaml);
 	LINK_LEXER(lmCmake);
 	LINK_LEXER(lmCOBOL);


Modified: src/filetypes.c
6 files changed, 6 insertions(+), 0 deletions(-)
===================================================================
@@ -510,6 +510,12 @@ static void init_builtin_filetypes(void)
 	ft->name = g_strdup("Abaqus");
 	filetype_make_title(ft, TITLE_SOURCE_FILE);
 	ft->group = GEANY_FILETYPE_GROUP_SCRIPT;
+
+#define BATCH
+	ft = filetypes[GEANY_FILETYPES_BATCH];
+	ft->name = g_strdup("Batch");
+	filetype_make_title(ft, TITLE_FILE);
+	ft->group = GEANY_FILETYPE_GROUP_SCRIPT;
 }
 
 


Modified: src/filetypes.h
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -92,6 +92,7 @@
 	GEANY_FILETYPES_OBJECTIVEC,
 	GEANY_FILETYPES_ASCIIDOC,
 	GEANY_FILETYPES_ABAQUS,
+	GEANY_FILETYPES_BATCH,
 	/* ^ append items here */
 	GEANY_MAX_BUILT_IN_FILETYPES	/* Don't use this, use filetypes_array->len instead */
 }


Modified: src/highlighting.c
2 files changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -1045,6 +1045,7 @@ void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *co
 		init_styleset_case(ADA);
 		init_styleset_case(ASM);
 		init_styleset_case(BASIC);
+		init_styleset_case(BATCH);
 		init_styleset_case(C);
 		init_styleset_case(CAML);
 		init_styleset_case(CMAKE);
@@ -1125,6 +1126,7 @@ void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft)
 		styleset_case(ADA);
 		styleset_case(ASM);
 		styleset_case(BASIC);
+		styleset_case(BATCH);
 		styleset_case(C);
 		styleset_case(CAML);
 		styleset_case(CMAKE);


Modified: src/highlightingmappings.h
21 files changed, 21 insertions(+), 0 deletions(-)
===================================================================
@@ -196,6 +196,27 @@
 #define highlighting_properties_BASIC	EMPTY_PROPERTIES
 
 
+/* BATCH */
+#define highlighting_lexer_BATCH		SCLEX_BATCH
+static const HLStyle highlighting_styles_BATCH[] =
+{
+	{ SCE_BAT_DEFAULT,		"default",		FALSE },
+	{ SCE_BAT_COMMENT,		"comment",		FALSE },
+	{ SCE_BAT_LABEL,		"label",		FALSE },
+	{ SCE_BAT_WORD,			"word",			FALSE },
+	{ SCE_BAT_HIDE,			"hide",			FALSE },
+	{ SCE_BAT_COMMAND,		"command",		FALSE },
+	{ SCE_BAT_IDENTIFIER,	"identifier",	FALSE },
+	{ SCE_BAT_OPERATOR,		"operator",		FALSE }
+};
+static const HLKeyword highlighting_keywords_BATCH[] =
+{
+	{ 0, "keywords",			FALSE },
+	{ 1, "keywords_optional",	FALSE }
+};
+#define highlighting_properties_BATCH	EMPTY_PROPERTIES
+
+
 /* C */
 /* Also used by some other SCLEX_CPP-based filetypes */
 #define highlighting_lexer_C		SCLEX_CPP



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list