Kaydet (Commit) b518770d authored tarafından canou's avatar canou Kaydeden (comit) Matthew Brush

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
üst a08f595b
......@@ -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;
......
# 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=
......@@ -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);
......
......@@ -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;
}
......
......@@ -92,6 +92,7 @@ typedef enum
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 */
}
......
......@@ -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);
......
......@@ -196,6 +196,27 @@ static const HLKeyword highlighting_keywords_BASIC[] =
#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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment