From ab2663e9aef8aa17af330c54eb7e6223647aa0f5 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Tue, 8 Nov 2011 22:50:53 +0100 Subject: [PATCH 01/13] Refactor highlighting setup --- src/Makefile.am | 1 + src/highlighting.c | 2400 +++--------------------------------- src/highlightingmappings.h | 1193 ++++++++++++++++++ 3 files changed, 1351 insertions(+), 2243 deletions(-) create mode 100644 src/highlightingmappings.h diff --git a/src/Makefile.am b/src/Makefile.am index 18ee014f..1296896d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,6 +21,7 @@ SRCS = \ geanyobject.c geanyobject.h \ geanywraplabel.c geanywraplabel.h \ highlighting.c highlighting.h \ + highlightingmappings.h \ interface.c interface.h \ keybindings.c keybindings.h \ keyfile.c keyfile.h \ diff --git a/src/highlighting.c b/src/highlighting.c index c060fdc2..5d815921 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -42,6 +42,8 @@ #include "support.h" #include "sciwrappers.h" +#include "highlightingmappings.h" + #define GEANY_COLORSCHEMES_SUBDIR "colorschemes" @@ -794,417 +796,99 @@ apply_filetype_properties(ScintillaObject *sci, guint lexer, guint ft_id) } -/* names: the style names for the filetype. */ -static void load_style_entries(GKeyFile *config, GKeyFile *config_home, gint filetype_idx, - const gchar **names, gsize names_len) +/* styles: the HLStyle entries for the filetype. */ +static void load_style_entries_hlm(GKeyFile *config, GKeyFile *config_home, guint filetype_idx, + const HLStyle *styles, gsize n_styles) { guint i; - foreach_range(i, names_len) + foreach_range(i, n_styles) { - const gchar *name = names[i]; GeanyLexerStyle *style = &style_sets[filetype_idx].styling[i]; - get_keyfile_style(config, config_home, name, style); + get_keyfile_style(config, config_home, styles[i].name, style); } } -/* styles: the style IDs for the filetype. +/* styles: the style entries for the filetype. * STYLE_DEFAULT will be set to match the first style. */ -static void apply_style_entries(ScintillaObject *sci, guint filetype_idx, - guint *styles, gsize styles_len) +static void apply_style_entries_hlm(ScintillaObject *sci, guint filetype_idx, + const HLStyle *styles, gsize n_styles) { guint i; - g_return_if_fail(styles_len > 0); + g_return_if_fail(n_styles > 0); set_sci_style(sci, STYLE_DEFAULT, filetype_idx, 0); - foreach_range(i, styles_len) - set_sci_style(sci, styles[i], filetype_idx, i); + foreach_range(i, n_styles) + set_sci_style(sci, styles[i].style, filetype_idx, i); } -/* call new_styleset(filetype_idx, >= 20) before using this. */ -static void -styleset_c_like_init(GKeyFile *config, GKeyFile *config_home, guint filetype_idx) +static void styleset_init_from_mapping(guint ft_id, GKeyFile *config, GKeyFile *config_home, + const HLStyle *styles, gsize n_styles, + const HLKeyword *keywords, gsize n_keywords) { - const gchar *entries[] = - { - "default", - "comment", - "commentline", - "commentdoc", - "number", - "word", - "word2", - "string", - "character", - "uuid", - "preprocessor", - "operator", - "identifier", - "stringeol", - "verbatim", - "verbatim", /* triple verbatims use the same style */ - "regex", - "commentlinedoc", - "commentdockeyword", - "commentdockeyworderror", - "globalclass" - }; + /* styles */ + new_styleset(ft_id, n_styles); + load_style_entries_hlm(config, config_home, ft_id, styles, n_styles); + /* keywords */ + if (n_keywords < 1) + style_sets[ft_id].keywords = NULL; + else + { + gsize i; - new_styleset(filetype_idx, G_N_ELEMENTS(entries)); - load_style_entries(config, config_home, filetype_idx, entries, G_N_ELEMENTS(entries)); + style_sets[ft_id].keywords = g_new(gchar*, n_keywords + 1); + foreach_range(i, n_keywords) + get_keyfile_keywords(config, config_home, keywords[i].key, ft_id, i); + style_sets[ft_id].keywords[i] = NULL; + } } -static void styleset_c_like(ScintillaObject *sci, guint ft_id, guint lexer) -{ - guint styles[] = { - SCE_C_DEFAULT, - SCE_C_COMMENT, - SCE_C_COMMENTLINE, - SCE_C_COMMENTDOC, - SCE_C_NUMBER, - SCE_C_WORD, - SCE_C_WORD2, - SCE_C_STRING, - SCE_C_CHARACTER, - SCE_C_UUID, - SCE_C_PREPROCESSOR, - SCE_C_OPERATOR, - SCE_C_IDENTIFIER, - SCE_C_STRINGEOL, - SCE_C_VERBATIM, - SCE_C_TRIPLEVERBATIM, - SCE_C_REGEX, - SCE_C_COMMENTLINEDOC, - SCE_C_COMMENTDOCKEYWORD, - SCE_C_COMMENTDOCKEYWORDERROR, - /* used for local structs and typedefs */ - SCE_C_GLOBALCLASS - }; +#define STYLESET_INIT_FROM_MAPPING(ft_id, config, config_home, lang_name) \ + styleset_init_from_mapping(ft_id, config, config_home, \ + highlighting_styles_##lang_name, \ + highlighting_styles_##lang_name ? G_N_ELEMENTS(highlighting_styles_##lang_name) : 0, \ + highlighting_keywords_##lang_name, \ + highlighting_keywords_##lang_name ? G_N_ELEMENTS(highlighting_keywords_##lang_name) : 0) + +static void styleset_from_mapping(ScintillaObject *sci, guint ft_id, guint lexer, + const HLStyle *styles, gsize n_styles, + const HLKeyword *keywords, gsize n_keywords, + const HLProperty *properties, gsize n_properties) +{ + gsize i; + + /* styles */ apply_filetype_properties(sci, lexer, ft_id); - apply_style_entries(sci, ft_id, styles, G_N_ELEMENTS(styles)); - - /* Disable explicit //{ folding as it can seem like a bug */ - sci_set_property(sci, "fold.cpp.comment.explicit", "0"); + apply_style_entries_hlm(sci, ft_id, styles, n_styles); + /* keywords */ + foreach_range(i, n_keywords) + { + if (keywords[i].merge) + merge_type_keywords(sci, ft_id, i); + else + sci_set_keywords(sci, keywords[i].id, style_sets[ft_id].keywords[i]); + } + /* properties */ + foreach_range(i, n_properties) + sci_set_property(sci, properties[i].property, properties[i].value); } -static void styleset_c_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - styleset_c_like_init(config, config_home, ft_id); - - style_sets[ft_id].keywords = g_new(gchar*, 4); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - get_keyfile_keywords(config, config_home, "secondary", ft_id, 1); - get_keyfile_keywords(config, config_home, "docComment", ft_id, 2); - style_sets[ft_id].keywords[3] = NULL; -} - - -static void styleset_c(ScintillaObject *sci, guint ft_id) -{ - styleset_c_like(sci, ft_id, SCLEX_CPP); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - /* SCI_SETKEYWORDS = 1 - secondary + global tags file types, see below */ - sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]); - /* SCI_SETKEYWORDS = 3 is for current session types - see editor_lexer_get_type_keyword_idx() */ - - /* assign global types, merge them with user defined keywords and set them */ - merge_type_keywords(sci, ft_id, 1); -} - - -static void styleset_pascal_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 15); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "comment2", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "preprocessor", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "preprocessor2", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "hexnumber", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "asm", &style_sets[ft_id].styling[14]); - - style_sets[ft_id].keywords = g_new(gchar*, 2); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - style_sets[ft_id].keywords[1] = NULL; -} - - -static void styleset_pascal(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_PASCAL, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_PAS_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_PAS_IDENTIFIER, ft_id, 1); - set_sci_style(sci, SCE_PAS_COMMENT, ft_id, 2); - set_sci_style(sci, SCE_PAS_COMMENT2, ft_id, 3); - set_sci_style(sci, SCE_PAS_COMMENTLINE, ft_id, 4); - set_sci_style(sci, SCE_PAS_PREPROCESSOR, ft_id, 5); - set_sci_style(sci, SCE_PAS_PREPROCESSOR2, ft_id, 6); - set_sci_style(sci, SCE_PAS_NUMBER, ft_id, 7); - set_sci_style(sci, SCE_PAS_HEXNUMBER, ft_id, 8); - set_sci_style(sci, SCE_PAS_WORD, ft_id, 9); - set_sci_style(sci, SCE_PAS_STRING, ft_id, 10); - set_sci_style(sci, SCE_PAS_STRINGEOL, ft_id, 11); - set_sci_style(sci, SCE_PAS_CHARACTER, ft_id, 12); - set_sci_style(sci, SCE_PAS_OPERATOR, ft_id, 13); - set_sci_style(sci, SCE_PAS_ASM, ft_id, 14); -} - - -static void styleset_makefile_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 7); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "preprocessor", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "target", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "ideol", &style_sets[ft_id].styling[6]); - - style_sets[ft_id].keywords = NULL; -} - - -static void styleset_makefile(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_MAKEFILE, ft_id); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_MAKE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_MAKE_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_MAKE_PREPROCESSOR, ft_id, 2); - set_sci_style(sci, SCE_MAKE_IDENTIFIER, ft_id, 3); - set_sci_style(sci, SCE_MAKE_OPERATOR, ft_id, 4); - set_sci_style(sci, SCE_MAKE_TARGET, ft_id, 5); - set_sci_style(sci, SCE_MAKE_IDEOL, ft_id, 6); -} - - -static void styleset_diff_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 8); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "command", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "header", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "position", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "deleted", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "added", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "changed", &style_sets[ft_id].styling[7]); - - style_sets[ft_id].keywords = NULL; -} - - -static void styleset_diff(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_DIFF, ft_id); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_DIFF_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_DIFF_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_DIFF_COMMAND, ft_id, 2); - set_sci_style(sci, SCE_DIFF_HEADER, ft_id, 3); - set_sci_style(sci, SCE_DIFF_POSITION, ft_id, 4); - set_sci_style(sci, SCE_DIFF_DELETED, ft_id, 5); - set_sci_style(sci, SCE_DIFF_ADDED, ft_id, 6); - set_sci_style(sci, SCE_DIFF_CHANGED, ft_id, 7); -} - - -static void styleset_lisp_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 12); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "multicomment", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "keyword", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "symbol", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "special", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "keywordkw", &style_sets[ft_id].styling[11]); - - style_sets[ft_id].keywords = g_new(gchar*, 3); - get_keyfile_keywords(config, config_home, "keywords", ft_id, 0); - get_keyfile_keywords(config, config_home, "special_keywords", ft_id, 1); - style_sets[ft_id].keywords[2] = NULL; -} - - -static void styleset_lisp(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_LISP, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_LISP_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_LISP_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_LISP_MULTI_COMMENT, ft_id, 2); - set_sci_style(sci, SCE_LISP_NUMBER, ft_id, 3); - set_sci_style(sci, SCE_LISP_KEYWORD, ft_id, 4); - set_sci_style(sci, SCE_LISP_SYMBOL, ft_id, 5); - set_sci_style(sci, SCE_LISP_STRING, ft_id, 6); - set_sci_style(sci, SCE_LISP_STRINGEOL, ft_id, 7); - set_sci_style(sci, SCE_LISP_IDENTIFIER, ft_id, 8); - set_sci_style(sci, SCE_LISP_OPERATOR, ft_id, 9); - set_sci_style(sci, SCE_LISP_SPECIAL, ft_id, 10); - set_sci_style(sci, SCE_LISP_KEYWORD_KW, ft_id, 11); -} - - -static void styleset_erlang_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 26); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "variable", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "keyword", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "atom", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "function_name", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "macro", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "record", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "preproc", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "node_name", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "comment_function", &style_sets[ft_id].styling[14]); - get_keyfile_style(config, config_home, "comment_module", &style_sets[ft_id].styling[15]); - get_keyfile_style(config, config_home, "comment_doc", &style_sets[ft_id].styling[16]); - get_keyfile_style(config, config_home, "comment_doc_macro", &style_sets[ft_id].styling[17]); - get_keyfile_style(config, config_home, "atom_quoted", &style_sets[ft_id].styling[18]); - get_keyfile_style(config, config_home, "macro_quoted", &style_sets[ft_id].styling[19]); - get_keyfile_style(config, config_home, "record_quoted", &style_sets[ft_id].styling[20]); - get_keyfile_style(config, config_home, "node_name_quoted", &style_sets[ft_id].styling[21]); - get_keyfile_style(config, config_home, "bifs", &style_sets[ft_id].styling[22]); - get_keyfile_style(config, config_home, "modules", &style_sets[ft_id].styling[23]); - get_keyfile_style(config, config_home, "modules_att", &style_sets[ft_id].styling[24]); - get_keyfile_style(config, config_home, "unknown", &style_sets[ft_id].styling[25]); - - style_sets[ft_id].keywords = g_new(gchar*, 6); - get_keyfile_keywords(config, config_home, "keywords", ft_id, 0); - get_keyfile_keywords(config, config_home, "bifs", ft_id, 1); - get_keyfile_keywords(config, config_home, "preproc", ft_id, 2); - get_keyfile_keywords(config, config_home, "module", ft_id, 3); - get_keyfile_keywords(config, config_home, "doc", ft_id, 4); - get_keyfile_keywords(config, config_home, "doc_macro", ft_id, 5); - style_sets[ft_id].keywords[6] = NULL; -} - - -static void styleset_erlang(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_ERLANG, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); - sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]); - sci_set_keywords(sci, 3, style_sets[ft_id].keywords[3]); - sci_set_keywords(sci, 4, style_sets[ft_id].keywords[4]); - sci_set_keywords(sci, 5, style_sets[ft_id].keywords[5]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_ERLANG_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_ERLANG_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_ERLANG_VARIABLE, ft_id, 2); - set_sci_style(sci, SCE_ERLANG_NUMBER, ft_id, 3); - set_sci_style(sci, SCE_ERLANG_KEYWORD, ft_id, 4); - set_sci_style(sci, SCE_ERLANG_STRING, ft_id, 5); - set_sci_style(sci, SCE_ERLANG_OPERATOR, ft_id, 6); - set_sci_style(sci, SCE_ERLANG_ATOM, ft_id, 7); - set_sci_style(sci, SCE_ERLANG_FUNCTION_NAME, ft_id, 8); - set_sci_style(sci, SCE_ERLANG_CHARACTER, ft_id, 9); - set_sci_style(sci, SCE_ERLANG_MACRO, ft_id, 10); - set_sci_style(sci, SCE_ERLANG_RECORD, ft_id, 11); - set_sci_style(sci, SCE_ERLANG_PREPROC, ft_id, 12); - set_sci_style(sci, SCE_ERLANG_NODE_NAME, ft_id, 13); - set_sci_style(sci, SCE_ERLANG_COMMENT_FUNCTION, ft_id, 14); - set_sci_style(sci, SCE_ERLANG_COMMENT_MODULE, ft_id, 15); - set_sci_style(sci, SCE_ERLANG_COMMENT_DOC, ft_id, 16); - set_sci_style(sci, SCE_ERLANG_COMMENT_DOC_MACRO, ft_id, 17); - set_sci_style(sci, SCE_ERLANG_ATOM_QUOTED, ft_id, 18); - set_sci_style(sci, SCE_ERLANG_MACRO_QUOTED, ft_id, 19); - set_sci_style(sci, SCE_ERLANG_RECORD_QUOTED, ft_id, 20); - set_sci_style(sci, SCE_ERLANG_NODE_NAME_QUOTED, ft_id, 21); - set_sci_style(sci, SCE_ERLANG_BIFS, ft_id, 22); - set_sci_style(sci, SCE_ERLANG_MODULES, ft_id, 23); - set_sci_style(sci, SCE_ERLANG_MODULES_ATT, ft_id, 24); - set_sci_style(sci, SCE_ERLANG_UNKNOWN, ft_id, 25); -} - - -static void styleset_latex_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 13); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "command", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "tag", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "math", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "tag2", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "math2", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "comment2", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "verbatim", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "shortcmd", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "special", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "cmdopt", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "error", &style_sets[ft_id].styling[12]); - - style_sets[ft_id].keywords = g_new(gchar*, 2); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - style_sets[ft_id].keywords[1] = NULL; -} - - -static void styleset_latex(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_LATEX, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_L_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_L_COMMAND, ft_id, 1); - set_sci_style(sci, SCE_L_TAG, ft_id, 2); - set_sci_style(sci, SCE_L_MATH, ft_id, 3); - set_sci_style(sci, SCE_L_COMMENT, ft_id, 4); - set_sci_style(sci, SCE_L_TAG2, ft_id, 5); - set_sci_style(sci, SCE_L_MATH2, ft_id, 6); - set_sci_style(sci, SCE_L_COMMENT2, ft_id, 7); - set_sci_style(sci, SCE_L_VERBATIM, ft_id, 8); - set_sci_style(sci, SCE_L_SHORTCMD, ft_id, 9); - set_sci_style(sci, SCE_L_SPECIAL, ft_id, 10); - set_sci_style(sci, SCE_L_CMDOPT, ft_id, 11); - set_sci_style(sci, SCE_L_ERROR, ft_id, 12); -} +#define STYLESET_FROM_MAPPING(sci, ft_id, lexer, lang_name) \ + styleset_from_mapping(sci, ft_id, lexer, \ + highlighting_styles_##lang_name, \ + highlighting_styles_##lang_name ? G_N_ELEMENTS(highlighting_styles_##lang_name) : 0, \ + highlighting_keywords_##lang_name, \ + highlighting_keywords_##lang_name ? G_N_ELEMENTS(highlighting_keywords_##lang_name) : 0, \ + highlighting_properties_##lang_name, \ + highlighting_properties_##lang_name ? G_N_ELEMENTS(highlighting_properties_##lang_name) : 0) static void styleset_php_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) @@ -1472,460 +1156,6 @@ static void styleset_markup(ScintillaObject *sci, gboolean set_keywords) } -static void styleset_java_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - styleset_c_like_init(config, config_home, ft_id); - - style_sets[ft_id].keywords = g_new(gchar*, 5); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - get_keyfile_keywords(config, config_home, "secondary", ft_id, 1); - get_keyfile_keywords(config, config_home, "doccomment", ft_id, 2); - get_keyfile_keywords(config, config_home, "typedefs", ft_id, 3); - style_sets[ft_id].keywords[4] = NULL; -} - - -static void styleset_java(ScintillaObject *sci, guint ft_id) -{ - styleset_c_like(sci, ft_id, SCLEX_CPP); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - /* SCI_SETKEYWORDS = 1 - secondary + global tags file types, see below */ - sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]); - /* SCI_SETKEYWORDS = 3 is for current session types - see editor_lexer_get_type_keyword_idx() */ - sci_set_keywords(sci, 4, style_sets[ft_id].keywords[3]); - - /* assign global types, merge them with user defined keywords and set them */ - merge_type_keywords(sci, ft_id, 1); -} - - -static void styleset_perl_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 45); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "error", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "preprocessor", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "scalar", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "pod", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "regex", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "array", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "hash", &style_sets[ft_id].styling[14]); - get_keyfile_style(config, config_home, "symboltable", &style_sets[ft_id].styling[15]); - get_keyfile_style(config, config_home, "backticks", &style_sets[ft_id].styling[16]); - get_keyfile_style(config, config_home, "pod_verbatim", &style_sets[ft_id].styling[17]); - get_keyfile_style(config, config_home, "reg_subst", &style_sets[ft_id].styling[18]); - get_keyfile_style(config, config_home, "datasection", &style_sets[ft_id].styling[19]); - get_keyfile_style(config, config_home, "here_delim", &style_sets[ft_id].styling[20]); - get_keyfile_style(config, config_home, "here_q", &style_sets[ft_id].styling[21]); - get_keyfile_style(config, config_home, "here_qq", &style_sets[ft_id].styling[22]); - get_keyfile_style(config, config_home, "here_qx", &style_sets[ft_id].styling[23]); - get_keyfile_style(config, config_home, "string_q", &style_sets[ft_id].styling[24]); - get_keyfile_style(config, config_home, "string_qq", &style_sets[ft_id].styling[25]); - get_keyfile_style(config, config_home, "string_qx", &style_sets[ft_id].styling[26]); - get_keyfile_style(config, config_home, "string_qr", &style_sets[ft_id].styling[27]); - get_keyfile_style(config, config_home, "string_qw", &style_sets[ft_id].styling[28]); - get_keyfile_style(config, config_home, "variable_indexer", &style_sets[ft_id].styling[29]); - get_keyfile_style(config, config_home, "punctuation", &style_sets[ft_id].styling[30]); - get_keyfile_style(config, config_home, "longquote", &style_sets[ft_id].styling[31]); - get_keyfile_style(config, config_home, "sub_prototype", &style_sets[ft_id].styling[32]); - get_keyfile_style(config, config_home, "format_ident", &style_sets[ft_id].styling[33]); - get_keyfile_style(config, config_home, "format", &style_sets[ft_id].styling[34]); - get_keyfile_style(config, config_home, "string_var", &style_sets[ft_id].styling[35]); - get_keyfile_style(config, config_home, "xlat", &style_sets[ft_id].styling[36]); - get_keyfile_style(config, config_home, "regex_var", &style_sets[ft_id].styling[37]); - get_keyfile_style(config, config_home, "regsubst_var", &style_sets[ft_id].styling[38]); - get_keyfile_style(config, config_home, "backticks_var", &style_sets[ft_id].styling[39]); - get_keyfile_style(config, config_home, "here_qq_var", &style_sets[ft_id].styling[40]); - get_keyfile_style(config, config_home, "here_qx_var", &style_sets[ft_id].styling[41]); - get_keyfile_style(config, config_home, "string_qq_var", &style_sets[ft_id].styling[42]); - get_keyfile_style(config, config_home, "string_qx_var", &style_sets[ft_id].styling[43]); - get_keyfile_style(config, config_home, "string_qr_var", &style_sets[ft_id].styling[44]); - - - style_sets[ft_id].keywords = g_new(gchar*, 2); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - style_sets[ft_id].keywords[1] = NULL; -} - - -static void styleset_perl(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_PERL, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_PL_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_PL_ERROR, ft_id, 1); - set_sci_style(sci, SCE_PL_COMMENTLINE, ft_id, 2); - set_sci_style(sci, SCE_PL_NUMBER, ft_id, 3); - set_sci_style(sci, SCE_PL_WORD, ft_id, 4); - set_sci_style(sci, SCE_PL_STRING, ft_id, 5); - set_sci_style(sci, SCE_PL_CHARACTER, ft_id, 6); - set_sci_style(sci, SCE_PL_PREPROCESSOR, ft_id, 7); - set_sci_style(sci, SCE_PL_OPERATOR, ft_id, 8); - set_sci_style(sci, SCE_PL_IDENTIFIER, ft_id, 9); - set_sci_style(sci, SCE_PL_SCALAR, ft_id, 10); - set_sci_style(sci, SCE_PL_POD, ft_id, 11); - set_sci_style(sci, SCE_PL_REGEX, ft_id, 12); - set_sci_style(sci, SCE_PL_ARRAY, ft_id, 13); - set_sci_style(sci, SCE_PL_HASH, ft_id, 14); - set_sci_style(sci, SCE_PL_SYMBOLTABLE, ft_id, 15); - set_sci_style(sci, SCE_PL_BACKTICKS, ft_id, 16); - set_sci_style(sci, SCE_PL_POD_VERB, ft_id, 17); - set_sci_style(sci, SCE_PL_REGSUBST, ft_id, 18); - set_sci_style(sci, SCE_PL_DATASECTION, ft_id, 19); - set_sci_style(sci, SCE_PL_HERE_DELIM, ft_id, 20); - set_sci_style(sci, SCE_PL_HERE_Q, ft_id, 21); - set_sci_style(sci, SCE_PL_HERE_QQ, ft_id, 22); - set_sci_style(sci, SCE_PL_HERE_QX, ft_id, 23); - set_sci_style(sci, SCE_PL_STRING_Q, ft_id, 24); - set_sci_style(sci, SCE_PL_STRING_QQ, ft_id, 25); - set_sci_style(sci, SCE_PL_STRING_QX, ft_id, 26); - set_sci_style(sci, SCE_PL_STRING_QR, ft_id, 27); - set_sci_style(sci, SCE_PL_STRING_QW, ft_id, 28); - set_sci_style(sci, SCE_PL_VARIABLE_INDEXER, ft_id, 29); - set_sci_style(sci, SCE_PL_PUNCTUATION, ft_id, 30); - set_sci_style(sci, SCE_PL_LONGQUOTE, ft_id, 31); - set_sci_style(sci, SCE_PL_SUB_PROTOTYPE, ft_id, 32); - set_sci_style(sci, SCE_PL_FORMAT_IDENT, ft_id, 33); - set_sci_style(sci, SCE_PL_FORMAT, ft_id, 34); - set_sci_style(sci, SCE_PL_STRING_VAR, ft_id, 35); - set_sci_style(sci, SCE_PL_XLAT, ft_id, 36); - set_sci_style(sci, SCE_PL_REGEX_VAR, ft_id, 37); - set_sci_style(sci, SCE_PL_REGSUBST_VAR, ft_id, 38); - set_sci_style(sci, SCE_PL_BACKTICKS_VAR, ft_id, 39); - set_sci_style(sci, SCE_PL_HERE_QQ_VAR, ft_id, 40); - set_sci_style(sci, SCE_PL_HERE_QX_VAR, ft_id, 41); - set_sci_style(sci, SCE_PL_STRING_QQ_VAR, ft_id, 42); - set_sci_style(sci, SCE_PL_STRING_QX_VAR, ft_id, 43); - set_sci_style(sci, SCE_PL_STRING_QR_VAR, ft_id, 44); -} - - -static void styleset_python_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 16); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "triple", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "tripledouble", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "classname", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "defname", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "commentblock", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "word2", &style_sets[ft_id].styling[14]); - get_keyfile_style(config, config_home, "decorator", &style_sets[ft_id].styling[15]); - - style_sets[ft_id].keywords = g_new(gchar*, 3); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - get_keyfile_keywords(config, config_home, "identifiers", ft_id, 1); - style_sets[ft_id].keywords[2] = NULL; -} - - -static void styleset_python(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_PYTHON, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_P_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_P_COMMENTLINE, ft_id, 1); - set_sci_style(sci, SCE_P_NUMBER, ft_id, 2); - set_sci_style(sci, SCE_P_STRING, ft_id, 3); - set_sci_style(sci, SCE_P_CHARACTER, ft_id, 4); - set_sci_style(sci, SCE_P_WORD, ft_id, 5); - set_sci_style(sci, SCE_P_TRIPLE, ft_id, 6); - set_sci_style(sci, SCE_P_TRIPLEDOUBLE, ft_id, 7); - set_sci_style(sci, SCE_P_CLASSNAME, ft_id, 8); - set_sci_style(sci, SCE_P_DEFNAME, ft_id, 9); - set_sci_style(sci, SCE_P_OPERATOR, ft_id, 10); - set_sci_style(sci, SCE_P_IDENTIFIER, ft_id, 11); - set_sci_style(sci, SCE_P_COMMENTBLOCK, ft_id, 12); - set_sci_style(sci, SCE_P_STRINGEOL, ft_id, 13); - set_sci_style(sci, SCE_P_WORD2, ft_id, 14); - set_sci_style(sci, SCE_P_DECORATOR, ft_id, 15); -} - - -static void styleset_cmake_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 15); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "stringdq", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "stringlq", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "stringrq", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "command", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "parameters", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "variable", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "userdefined", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "whiledef", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "foreachdef", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "ifdefinedef", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "macrodef", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "stringvar", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[14]); - - style_sets[ft_id].keywords = g_new(gchar*, 4); - get_keyfile_keywords(config, config_home, "commands", ft_id, 0); - get_keyfile_keywords(config, config_home, "parameters", ft_id, 1); - get_keyfile_keywords(config, config_home, "userdefined", ft_id, 2); - style_sets[ft_id].keywords[3] = NULL; -} - - -static void styleset_cmake(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_CMAKE, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); - sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_CMAKE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_CMAKE_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_CMAKE_STRINGDQ, ft_id, 2); - set_sci_style(sci, SCE_CMAKE_STRINGLQ, ft_id, 3); - set_sci_style(sci, SCE_CMAKE_STRINGRQ, ft_id, 4); - set_sci_style(sci, SCE_CMAKE_COMMANDS, ft_id, 5); - set_sci_style(sci, SCE_CMAKE_PARAMETERS, ft_id, 6); - set_sci_style(sci, SCE_CMAKE_VARIABLE, ft_id, 7); - set_sci_style(sci, SCE_CMAKE_USERDEFINED, ft_id, 8); - set_sci_style(sci, SCE_CMAKE_WHILEDEF, ft_id, 9); - set_sci_style(sci, SCE_CMAKE_FOREACHDEF, ft_id, 10); - set_sci_style(sci, SCE_CMAKE_IFDEFINEDEF, ft_id, 11); - set_sci_style(sci, SCE_CMAKE_MACRODEF, ft_id, 12); - set_sci_style(sci, SCE_CMAKE_STRINGVAR, ft_id, 13); - set_sci_style(sci, SCE_CMAKE_NUMBER, ft_id, 14); -} - - -static void styleset_cobol_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - styleset_c_like_init(config, config_home, ft_id); - - style_sets[ft_id].keywords = g_new(gchar*, 4); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - get_keyfile_keywords(config, config_home, "secondary", ft_id, 1); - get_keyfile_keywords(config, config_home, "extended_keywords", ft_id, 2); - style_sets[ft_id].keywords[3] = NULL; -} - - -static void styleset_cobol(ScintillaObject *sci, guint ft_id) -{ - styleset_c_like(sci, ft_id, SCLEX_COBOL); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); - sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]); -} - - -static void styleset_r_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 12); - - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "kword", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "basekword", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "otherkword", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "string2", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "infix", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "infixeol", &style_sets[ft_id].styling[11]); - - style_sets[ft_id].keywords = g_new(gchar*, 4); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - get_keyfile_keywords(config, config_home, "package", ft_id, 1); - get_keyfile_keywords(config, config_home, "package_other", ft_id, 2); - style_sets[ft_id].keywords[3] = NULL; -} - - -static void styleset_r(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_R, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); - sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_R_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_R_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_R_KWORD, ft_id, 2); - set_sci_style(sci, SCE_R_OPERATOR, ft_id, 3); - set_sci_style(sci, SCE_R_BASEKWORD, ft_id, 4); - set_sci_style(sci, SCE_R_OTHERKWORD, ft_id, 5); - set_sci_style(sci, SCE_R_NUMBER, ft_id, 6); - set_sci_style(sci, SCE_R_STRING, ft_id, 7); - set_sci_style(sci, SCE_R_STRING2, ft_id, 8); - set_sci_style(sci, SCE_R_IDENTIFIER, ft_id, 9); - set_sci_style(sci, SCE_R_INFIX, ft_id, 10); - set_sci_style(sci, SCE_R_INFIXEOL, ft_id, 11); -} - - -static void styleset_ruby_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 34); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "global", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "symbol", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "classname", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "defname", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "modulename", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "backticks", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "instancevar", &style_sets[ft_id].styling[14]); - get_keyfile_style(config, config_home, "classvar", &style_sets[ft_id].styling[15]); - get_keyfile_style(config, config_home, "datasection", &style_sets[ft_id].styling[16]); - get_keyfile_style(config, config_home, "heredelim", &style_sets[ft_id].styling[17]); - get_keyfile_style(config, config_home, "worddemoted", &style_sets[ft_id].styling[18]); - get_keyfile_style(config, config_home, "stdin", &style_sets[ft_id].styling[19]); - get_keyfile_style(config, config_home, "stdout", &style_sets[ft_id].styling[20]); - get_keyfile_style(config, config_home, "stderr", &style_sets[ft_id].styling[21]); - get_keyfile_style(config, config_home, "regex", &style_sets[ft_id].styling[22]); - get_keyfile_style(config, config_home, "here_q", &style_sets[ft_id].styling[23]); - get_keyfile_style(config, config_home, "here_qq", &style_sets[ft_id].styling[24]); - get_keyfile_style(config, config_home, "here_qx", &style_sets[ft_id].styling[25]); - get_keyfile_style(config, config_home, "string_q", &style_sets[ft_id].styling[26]); - get_keyfile_style(config, config_home, "string_qq", &style_sets[ft_id].styling[27]); - get_keyfile_style(config, config_home, "string_qx", &style_sets[ft_id].styling[28]); - get_keyfile_style(config, config_home, "string_qr", &style_sets[ft_id].styling[29]); - get_keyfile_style(config, config_home, "string_qw", &style_sets[ft_id].styling[30]); - get_keyfile_style(config, config_home, "upper_bound", &style_sets[ft_id].styling[31]); - get_keyfile_style(config, config_home, "error", &style_sets[ft_id].styling[32]); - get_keyfile_style(config, config_home, "pod", &style_sets[ft_id].styling[33]); - - style_sets[ft_id].keywords = g_new(gchar*, 2); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - style_sets[ft_id].keywords[1] = NULL; -} - - -static void styleset_ruby(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_RUBY, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_RB_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_RB_COMMENTLINE, ft_id, 1); - set_sci_style(sci, SCE_RB_NUMBER, ft_id, 2); - set_sci_style(sci, SCE_RB_STRING, ft_id, 3); - set_sci_style(sci, SCE_RB_CHARACTER, ft_id, 4); - set_sci_style(sci, SCE_RB_WORD, ft_id, 5); - set_sci_style(sci, SCE_RB_GLOBAL, ft_id, 6); - set_sci_style(sci, SCE_RB_SYMBOL, ft_id, 7); - set_sci_style(sci, SCE_RB_CLASSNAME, ft_id, 8); - set_sci_style(sci, SCE_RB_DEFNAME, ft_id, 9); - set_sci_style(sci, SCE_RB_OPERATOR, ft_id, 10); - set_sci_style(sci, SCE_RB_IDENTIFIER, ft_id, 11); - set_sci_style(sci, SCE_RB_MODULE_NAME, ft_id, 12); - set_sci_style(sci, SCE_RB_BACKTICKS, ft_id, 13); - set_sci_style(sci, SCE_RB_INSTANCE_VAR, ft_id, 14); - set_sci_style(sci, SCE_RB_CLASS_VAR, ft_id, 15); - set_sci_style(sci, SCE_RB_DATASECTION, ft_id, 16); - set_sci_style(sci, SCE_RB_HERE_DELIM, ft_id, 17); - set_sci_style(sci, SCE_RB_WORD_DEMOTED, ft_id, 18); - set_sci_style(sci, SCE_RB_STDIN, ft_id, 19); - set_sci_style(sci, SCE_RB_STDOUT, ft_id, 20); - set_sci_style(sci, SCE_RB_STDERR, ft_id, 21); - set_sci_style(sci, SCE_RB_REGEX, ft_id, 22); - set_sci_style(sci, SCE_RB_HERE_Q, ft_id, 23); - set_sci_style(sci, SCE_RB_HERE_QQ, ft_id, 24); - set_sci_style(sci, SCE_RB_HERE_QX, ft_id, 25); - set_sci_style(sci, SCE_RB_STRING_Q, ft_id, 26); - set_sci_style(sci, SCE_RB_STRING_QQ, ft_id, 27); - set_sci_style(sci, SCE_RB_STRING_QX, ft_id, 28); - set_sci_style(sci, SCE_RB_STRING_QR, ft_id, 29); - set_sci_style(sci, SCE_RB_STRING_QW, ft_id, 30); - set_sci_style(sci, SCE_RB_UPPER_BOUND, ft_id, 31); - set_sci_style(sci, SCE_RB_ERROR, ft_id, 32); - set_sci_style(sci, SCE_RB_POD, ft_id, 33); -} - - -static void styleset_sh_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 14); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "backticks", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "param", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "scalar", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "error", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "here_delim", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "here_q", &style_sets[ft_id].styling[13]); - - style_sets[ft_id].keywords = g_new(gchar*, 2); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - style_sets[ft_id].keywords[1] = NULL; -} - - -static void styleset_sh(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_BASH, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_SH_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_SH_COMMENTLINE, ft_id, 1); - set_sci_style(sci, SCE_SH_NUMBER, ft_id, 2); - set_sci_style(sci, SCE_SH_WORD, ft_id, 3); - set_sci_style(sci, SCE_SH_STRING, ft_id, 4); - set_sci_style(sci, SCE_SH_CHARACTER, ft_id, 5); - set_sci_style(sci, SCE_SH_OPERATOR, ft_id, 6); - set_sci_style(sci, SCE_SH_IDENTIFIER, ft_id, 7); - set_sci_style(sci, SCE_SH_BACKTICKS, ft_id, 8); - set_sci_style(sci, SCE_SH_PARAM, ft_id, 9); - set_sci_style(sci, SCE_SH_SCALAR, ft_id, 10); - set_sci_style(sci, SCE_SH_ERROR, ft_id, 11); - set_sci_style(sci, SCE_SH_HERE_DELIM, ft_id, 12); - set_sci_style(sci, SCE_SH_HERE_Q, ft_id, 13); -} - - static void styleset_xml(ScintillaObject *sci, guint ft_id) { apply_filetype_properties(sci, SCLEX_XML, ft_id); @@ -2030,1332 +1260,6 @@ static void styleset_default(ScintillaObject *sci, guint ft_id) } -static void styleset_css_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 23); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "tag", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "class", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "pseudoclass", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "unknown_pseudoclass", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "unknown_identifier", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "doublestring", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "singlestring", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "attribute", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "value", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "id", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "identifier2", &style_sets[ft_id].styling[14]); - get_keyfile_style(config, config_home, "important", &style_sets[ft_id].styling[15]); - get_keyfile_style(config, config_home, "directive", &style_sets[ft_id].styling[16]); - get_keyfile_style(config, config_home, "identifier3", &style_sets[ft_id].styling[17]); - get_keyfile_style(config, config_home, "pseudoelement", &style_sets[ft_id].styling[18]); - get_keyfile_style(config, config_home, "extended_identifier", &style_sets[ft_id].styling[19]); - get_keyfile_style(config, config_home, "extended_pseudoclass", &style_sets[ft_id].styling[20]); - get_keyfile_style(config, config_home, "extended_pseudoelement", &style_sets[ft_id].styling[21]); - get_keyfile_style(config, config_home, "media", &style_sets[ft_id].styling[22]); - - style_sets[ft_id].keywords = g_new(gchar*, 9); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - get_keyfile_keywords(config, config_home, "pseudoclasses", ft_id, 1); - get_keyfile_keywords(config, config_home, "secondary", ft_id, 2); - get_keyfile_keywords(config, config_home, "css3_properties", ft_id, 3); - get_keyfile_keywords(config, config_home, "pseudo_elements", ft_id, 4); - get_keyfile_keywords(config, config_home, "browser_css_properties", ft_id, 5); - get_keyfile_keywords(config, config_home, "browser_pseudo_classes", ft_id, 6); - get_keyfile_keywords(config, config_home, "browser_pseudo_elements", ft_id, 7); - style_sets[ft_id].keywords[8] = NULL; -} - - -static void styleset_css(ScintillaObject *sci, guint ft_id) -{ - guint i; - - apply_filetype_properties(sci, SCLEX_CSS, ft_id); - - for (i = 0; i < 8; i++) - { - sci_set_keywords(sci, i, style_sets[ft_id].keywords[i]); - } - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_CSS_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_CSS_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_CSS_TAG, ft_id, 2); - set_sci_style(sci, SCE_CSS_CLASS, ft_id, 3); - set_sci_style(sci, SCE_CSS_PSEUDOCLASS, ft_id, 4); - set_sci_style(sci, SCE_CSS_UNKNOWN_PSEUDOCLASS, ft_id, 5); - set_sci_style(sci, SCE_CSS_UNKNOWN_IDENTIFIER, ft_id, 6); - set_sci_style(sci, SCE_CSS_OPERATOR, ft_id, 7); - set_sci_style(sci, SCE_CSS_IDENTIFIER, ft_id, 8); - set_sci_style(sci, SCE_CSS_DOUBLESTRING, ft_id, 9); - set_sci_style(sci, SCE_CSS_SINGLESTRING, ft_id, 10); - set_sci_style(sci, SCE_CSS_ATTRIBUTE, ft_id, 11); - set_sci_style(sci, SCE_CSS_VALUE, ft_id, 12); - set_sci_style(sci, SCE_CSS_ID, ft_id, 13); - set_sci_style(sci, SCE_CSS_IDENTIFIER2, ft_id, 14); - set_sci_style(sci, SCE_CSS_IMPORTANT, ft_id, 15); - set_sci_style(sci, SCE_CSS_DIRECTIVE, ft_id, 16); - set_sci_style(sci, SCE_CSS_IDENTIFIER3, ft_id, 17); - set_sci_style(sci, SCE_CSS_PSEUDOELEMENT, ft_id, 18); - set_sci_style(sci, SCE_CSS_EXTENDED_IDENTIFIER, ft_id, 19); - set_sci_style(sci, SCE_CSS_EXTENDED_PSEUDOCLASS, ft_id, 20); - set_sci_style(sci, SCE_CSS_EXTENDED_PSEUDOELEMENT, ft_id, 21); - set_sci_style(sci, SCE_CSS_MEDIA, ft_id, 22); -} - - -static void styleset_nsis_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 19); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "stringdq", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "stringlq", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "stringrq", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "function", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "variable", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "label", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "userdefined", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "sectiondef", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "subsectiondef", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "ifdefinedef", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "macrodef", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "stringvar", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[14]); - get_keyfile_style(config, config_home, "sectiongroup", &style_sets[ft_id].styling[15]); - get_keyfile_style(config, config_home, "pageex", &style_sets[ft_id].styling[16]); - get_keyfile_style(config, config_home, "functiondef", &style_sets[ft_id].styling[17]); - get_keyfile_style(config, config_home, "commentbox", &style_sets[ft_id].styling[18]); - - style_sets[ft_id].keywords = g_new(gchar*, 5); - get_keyfile_keywords(config, config_home, "functions", ft_id, 0); - get_keyfile_keywords(config, config_home, "variables", ft_id, 1); - get_keyfile_keywords(config, config_home, "lables", ft_id, 2); - get_keyfile_keywords(config, config_home, "userdefined", ft_id, 3); - style_sets[ft_id].keywords[4] = NULL; -} - - -static void styleset_nsis(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_NSIS, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); - sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]); - sci_set_keywords(sci, 3, style_sets[ft_id].keywords[3]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_NSIS_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_NSIS_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_NSIS_STRINGDQ, ft_id, 2); - set_sci_style(sci, SCE_NSIS_STRINGLQ, ft_id, 3); - set_sci_style(sci, SCE_NSIS_STRINGRQ, ft_id, 4); - set_sci_style(sci, SCE_NSIS_FUNCTION, ft_id, 5); - set_sci_style(sci, SCE_NSIS_VARIABLE, ft_id, 6); - set_sci_style(sci, SCE_NSIS_LABEL, ft_id, 7); - set_sci_style(sci, SCE_NSIS_USERDEFINED, ft_id, 8); - set_sci_style(sci, SCE_NSIS_SECTIONDEF, ft_id, 9); - set_sci_style(sci, SCE_NSIS_SUBSECTIONDEF, ft_id, 10); - set_sci_style(sci, SCE_NSIS_IFDEFINEDEF, ft_id, 11); - set_sci_style(sci, SCE_NSIS_MACRODEF, ft_id, 12); - set_sci_style(sci, SCE_NSIS_STRINGVAR, ft_id, 13); - set_sci_style(sci, SCE_NSIS_NUMBER, ft_id, 14); - set_sci_style(sci, SCE_NSIS_SECTIONGROUP, ft_id, 15); - set_sci_style(sci, SCE_NSIS_PAGEEX, ft_id, 16); - set_sci_style(sci, SCE_NSIS_FUNCTIONDEF, ft_id, 17); - set_sci_style(sci, SCE_NSIS_COMMENTBOX, ft_id, 18); -} - - -static void styleset_po_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 9); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "msgid", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "msgid_text", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "msgstr", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "msgstr_text", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "msgctxt", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "msgctxt_text", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "fuzzy", &style_sets[ft_id].styling[8]); - - style_sets[ft_id].keywords = NULL; -} - - -static void styleset_po(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_PO, ft_id); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_PO_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_PO_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_PO_MSGID, ft_id, 2); - set_sci_style(sci, SCE_PO_MSGID_TEXT, ft_id, 3); - set_sci_style(sci, SCE_PO_MSGSTR, ft_id, 4); - set_sci_style(sci, SCE_PO_MSGSTR_TEXT, ft_id, 5); - set_sci_style(sci, SCE_PO_MSGCTXT, ft_id, 6); - set_sci_style(sci, SCE_PO_MSGCTXT_TEXT, ft_id, 7); - set_sci_style(sci, SCE_PO_FUZZY, ft_id, 8); -} - - -static void styleset_conf_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 6); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "section", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "key", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "assignment", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "defval", &style_sets[ft_id].styling[5]); - - style_sets[ft_id].keywords = NULL; -} - - -static void styleset_conf(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_PROPERTIES, ft_id); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_PROPS_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_PROPS_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_PROPS_SECTION, ft_id, 2); - set_sci_style(sci, SCE_PROPS_KEY, ft_id, 3); - set_sci_style(sci, SCE_PROPS_ASSIGNMENT, ft_id, 4); - set_sci_style(sci, SCE_PROPS_DEFVAL, ft_id, 5); -} - - -static void styleset_asm_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 16); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "cpuinstruction", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "mathinstruction", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "register", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "directive", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "directiveoperand", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "commentblock", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "extinstruction", &style_sets[ft_id].styling[14]); - get_keyfile_style(config, config_home, "commentdirective", &style_sets[ft_id].styling[15]); - - style_sets[ft_id].keywords = g_new(gchar*, 4); - get_keyfile_keywords(config, config_home, "instructions", ft_id, 0); - get_keyfile_keywords(config, config_home, "registers", ft_id, 1); - get_keyfile_keywords(config, config_home, "directives", ft_id, 2); - style_sets[ft_id].keywords[3] = NULL; -} - - -static void styleset_asm(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_ASM, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - /*sci_set_keywords(sci, 1, style_sets[ft_id].keywords[0]);*/ - sci_set_keywords(sci, 2, style_sets[ft_id].keywords[1]); - sci_set_keywords(sci, 3, style_sets[ft_id].keywords[2]); - /*sci_set_keywords(sci, 5, style_sets[ft_id].keywords[0]);*/ - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_ASM_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_ASM_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_ASM_NUMBER, ft_id, 2); - set_sci_style(sci, SCE_ASM_STRING, ft_id, 3); - set_sci_style(sci, SCE_ASM_OPERATOR, ft_id, 4); - set_sci_style(sci, SCE_ASM_IDENTIFIER, ft_id, 5); - set_sci_style(sci, SCE_ASM_CPUINSTRUCTION, ft_id, 6); - set_sci_style(sci, SCE_ASM_MATHINSTRUCTION, ft_id, 7); - set_sci_style(sci, SCE_ASM_REGISTER, ft_id, 8); - set_sci_style(sci, SCE_ASM_DIRECTIVE, ft_id, 9); - set_sci_style(sci, SCE_ASM_DIRECTIVEOPERAND, ft_id, 10); - set_sci_style(sci, SCE_ASM_COMMENTBLOCK, ft_id, 11); - set_sci_style(sci, SCE_ASM_CHARACTER, ft_id, 12); - set_sci_style(sci, SCE_ASM_STRINGEOL, ft_id, 13); - set_sci_style(sci, SCE_ASM_EXTINSTRUCTION, ft_id, 14); - set_sci_style(sci, SCE_ASM_COMMENTDIRECTIVE, ft_id, 15); -} - - -static void styleset_f77_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 15); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "string2", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "word2", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "word3", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "preprocessor", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "operator2", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "continuation", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "label", &style_sets[ft_id].styling[14]); - - style_sets[ft_id].keywords = g_new(gchar*, 4); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - get_keyfile_keywords(config, config_home, "intrinsic_functions", ft_id, 1); - get_keyfile_keywords(config, config_home, "user_functions", ft_id, 2); - style_sets[ft_id].keywords[3] = NULL; -} - - -static void styleset_f77(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_F77, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); - sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_F_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_F_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_F_NUMBER, ft_id, 2); - set_sci_style(sci, SCE_F_STRING1, ft_id, 3); - set_sci_style(sci, SCE_F_OPERATOR, ft_id, 4); - set_sci_style(sci, SCE_F_IDENTIFIER, ft_id, 5); - set_sci_style(sci, SCE_F_STRING2, ft_id, 6); - set_sci_style(sci, SCE_F_WORD, ft_id, 7); - set_sci_style(sci, SCE_F_WORD2, ft_id, 8); - set_sci_style(sci, SCE_F_WORD3, ft_id, 9); - set_sci_style(sci, SCE_F_PREPROCESSOR, ft_id, 10); - set_sci_style(sci, SCE_F_OPERATOR2, ft_id, 11); - set_sci_style(sci, SCE_F_CONTINUATION, ft_id, 12); - set_sci_style(sci, SCE_F_STRINGEOL, ft_id, 13); - set_sci_style(sci, SCE_F_LABEL, ft_id, 14); -} - - -static void styleset_forth_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 12); - - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "commentml", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "control", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "keyword", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "defword", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "preword1", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "preword2", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "locale", &style_sets[ft_id].styling[11]); - - style_sets[ft_id].keywords = g_new(gchar*, 2); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - style_sets[ft_id].keywords[1] = NULL; - -} - - -static void styleset_forth(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_FORTH, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_FORTH_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_FORTH_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_FORTH_COMMENT_ML, ft_id, 2); - set_sci_style(sci, SCE_FORTH_IDENTIFIER, ft_id, 3); - set_sci_style(sci, SCE_FORTH_CONTROL, ft_id, 4); - set_sci_style(sci, SCE_FORTH_KEYWORD, ft_id, 5); - set_sci_style(sci, SCE_FORTH_DEFWORD, ft_id, 6); - set_sci_style(sci, SCE_FORTH_PREWORD1, ft_id, 7); - set_sci_style(sci, SCE_FORTH_PREWORD2, ft_id, 8); - set_sci_style(sci, SCE_FORTH_NUMBER, ft_id, 9); - set_sci_style(sci, SCE_FORTH_STRING, ft_id, 10); - set_sci_style(sci, SCE_FORTH_LOCALE, ft_id, 11); -} - - -static void styleset_fortran_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 15); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "string2", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "word2", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "word3", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "preprocessor", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "operator2", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "continuation", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "label", &style_sets[ft_id].styling[14]); - - style_sets[ft_id].keywords = g_new(gchar*, 4); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - get_keyfile_keywords(config, config_home, "intrinsic_functions", ft_id, 1); - get_keyfile_keywords(config, config_home, "user_functions", ft_id, 2); - style_sets[ft_id].keywords[3] = NULL; -} - - -static void styleset_fortran(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_FORTRAN, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); - sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_F_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_F_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_F_NUMBER, ft_id, 2); - set_sci_style(sci, SCE_F_STRING1, ft_id, 3); - set_sci_style(sci, SCE_F_OPERATOR, ft_id, 4); - set_sci_style(sci, SCE_F_IDENTIFIER, ft_id, 5); - set_sci_style(sci, SCE_F_STRING2, ft_id, 6); - set_sci_style(sci, SCE_F_WORD, ft_id, 7); - set_sci_style(sci, SCE_F_WORD2, ft_id, 8); - set_sci_style(sci, SCE_F_WORD3, ft_id, 9); - set_sci_style(sci, SCE_F_PREPROCESSOR, ft_id, 10); - set_sci_style(sci, SCE_F_OPERATOR2, ft_id, 11); - set_sci_style(sci, SCE_F_CONTINUATION, ft_id, 12); - set_sci_style(sci, SCE_F_STRINGEOL, ft_id, 13); - set_sci_style(sci, SCE_F_LABEL, ft_id, 14); -} - - -static void styleset_sql_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 18); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "commentdoc", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "commentlinedoc", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "commentdockeyword", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "commentdockeyworderror", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "word2", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "sqlplus", &style_sets[ft_id].styling[14]); - get_keyfile_style(config, config_home, "sqlplus_prompt", &style_sets[ft_id].styling[15]); - get_keyfile_style(config, config_home, "sqlplus_comment", &style_sets[ft_id].styling[16]); - get_keyfile_style(config, config_home, "quotedidentifier", &style_sets[ft_id].styling[17]); - /*get_keyfile_style(config, config_home, "user1", &style_sets[ft_id].styling[18]); - get_keyfile_style(config, config_home, "user2", &style_sets[ft_id].styling[19]); - get_keyfile_style(config, config_home, "user3", &style_sets[ft_id].styling[20]); - get_keyfile_style(config, config_home, "user4", &style_sets[ft_id].styling[21]);*/ - - style_sets[ft_id].keywords = g_new(gchar*, 2); - get_keyfile_keywords(config, config_home, "keywords", ft_id, 0); - style_sets[ft_id].keywords[1] = NULL; -} - - -static void styleset_sql(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_SQL, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_SQL_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_SQL_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_SQL_COMMENTLINE, ft_id, 2); - set_sci_style(sci, SCE_SQL_COMMENTDOC, ft_id, 3); - set_sci_style(sci, SCE_SQL_COMMENTLINEDOC, ft_id, 4); - set_sci_style(sci, SCE_SQL_COMMENTDOCKEYWORD, ft_id, 5); - set_sci_style(sci, SCE_SQL_COMMENTDOCKEYWORDERROR, ft_id, 6); - set_sci_style(sci, SCE_SQL_NUMBER, ft_id, 7); - set_sci_style(sci, SCE_SQL_WORD, ft_id, 8); - set_sci_style(sci, SCE_SQL_WORD2, ft_id, 9); - set_sci_style(sci, SCE_SQL_STRING, ft_id, 10); - set_sci_style(sci, SCE_SQL_CHARACTER, ft_id, 11); - set_sci_style(sci, SCE_SQL_OPERATOR, ft_id, 12); - set_sci_style(sci, SCE_SQL_IDENTIFIER, ft_id, 13); - set_sci_style(sci, SCE_SQL_SQLPLUS, ft_id, 14); - set_sci_style(sci, SCE_SQL_SQLPLUS_PROMPT, ft_id, 15); - set_sci_style(sci, SCE_SQL_SQLPLUS_COMMENT, ft_id, 16); - set_sci_style(sci, SCE_SQL_QUOTEDIDENTIFIER, ft_id, 17); - /* these are for user-defined keywords we don't set yet */ - /*set_sci_style(sci, SCE_SQL_USER1, ft_id, 18); - set_sci_style(sci, SCE_SQL_USER2, ft_id, 19); - set_sci_style(sci, SCE_SQL_USER3, ft_id, 20); - set_sci_style(sci, SCE_SQL_USER4, ft_id, 21);*/ -} - - -static void styleset_markdown_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 17); - - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "strong", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "emphasis", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "header1", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "header2", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "header3", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "header4", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "header5", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "header6", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "ulist_item", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "olist_item", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "blockquote", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "strikeout", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "hrule", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "link", &style_sets[ft_id].styling[14]); - get_keyfile_style(config, config_home, "code", &style_sets[ft_id].styling[15]); - get_keyfile_style(config, config_home, "codebk", &style_sets[ft_id].styling[16]); - - style_sets[ft_id].keywords = NULL; -} - - -static void styleset_markdown(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_MARKDOWN, ft_id); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_MARKDOWN_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_MARKDOWN_LINE_BEGIN, ft_id, 0); - set_sci_style(sci, SCE_MARKDOWN_PRECHAR, ft_id, 0); - set_sci_style(sci, SCE_MARKDOWN_STRONG1, ft_id, 1); - set_sci_style(sci, SCE_MARKDOWN_STRONG2, ft_id, 1); - set_sci_style(sci, SCE_MARKDOWN_EM1, ft_id, 2); - set_sci_style(sci, SCE_MARKDOWN_EM2, ft_id, 2); - set_sci_style(sci, SCE_MARKDOWN_HEADER1, ft_id, 3); - set_sci_style(sci, SCE_MARKDOWN_HEADER2, ft_id, 4); - set_sci_style(sci, SCE_MARKDOWN_HEADER3, ft_id, 5); - set_sci_style(sci, SCE_MARKDOWN_HEADER4, ft_id, 6); - set_sci_style(sci, SCE_MARKDOWN_HEADER5, ft_id, 7); - set_sci_style(sci, SCE_MARKDOWN_HEADER6, ft_id, 8); - set_sci_style(sci, SCE_MARKDOWN_ULIST_ITEM, ft_id, 9); - set_sci_style(sci, SCE_MARKDOWN_OLIST_ITEM, ft_id, 10); - set_sci_style(sci, SCE_MARKDOWN_BLOCKQUOTE, ft_id, 11); - set_sci_style(sci, SCE_MARKDOWN_STRIKEOUT, ft_id, 12); - set_sci_style(sci, SCE_MARKDOWN_HRULE, ft_id, 13); - set_sci_style(sci, SCE_MARKDOWN_LINK, ft_id, 14); - set_sci_style(sci, SCE_MARKDOWN_CODE, ft_id, 15); - set_sci_style(sci, SCE_MARKDOWN_CODE2, ft_id, 15); - set_sci_style(sci, SCE_MARKDOWN_CODEBK, ft_id, 16); -} - - -static void styleset_haskell_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 17); - - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "commentblock", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "commentblock2", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "commentblock3", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "keyword", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "import", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "class", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "instance", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "capital", &style_sets[ft_id].styling[14]); - get_keyfile_style(config, config_home, "module", &style_sets[ft_id].styling[15]); - get_keyfile_style(config, config_home, "data", &style_sets[ft_id].styling[16]); - - style_sets[ft_id].keywords = g_new(gchar*, 2); - get_keyfile_keywords(config, config_home, "keywords", ft_id, 0); - style_sets[ft_id].keywords[1] = NULL; -} - - -static void styleset_haskell(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_HASKELL, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_HA_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_HA_COMMENTLINE, ft_id, 1); - set_sci_style(sci, SCE_HA_COMMENTBLOCK, ft_id, 2); - set_sci_style(sci, SCE_HA_COMMENTBLOCK2, ft_id, 3); - set_sci_style(sci, SCE_HA_COMMENTBLOCK3, ft_id, 4); - set_sci_style(sci, SCE_HA_NUMBER, ft_id, 5); - set_sci_style(sci, SCE_HA_KEYWORD, ft_id, 6); - set_sci_style(sci, SCE_HA_IMPORT, ft_id, 7); - set_sci_style(sci, SCE_HA_STRING, ft_id, 8); - set_sci_style(sci, SCE_HA_CHARACTER, ft_id, 9); - set_sci_style(sci, SCE_HA_CLASS, ft_id, 10); - set_sci_style(sci, SCE_HA_OPERATOR, ft_id, 11); - set_sci_style(sci, SCE_HA_IDENTIFIER, ft_id, 12); - set_sci_style(sci, SCE_HA_INSTANCE, ft_id, 13); - set_sci_style(sci, SCE_HA_CAPITAL, ft_id, 14); - set_sci_style(sci, SCE_HA_MODULE, ft_id, 15); - set_sci_style(sci, SCE_HA_DATA, ft_id, 16); -} - - -static void styleset_caml_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 16); - - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "comment1", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "comment2", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "comment3", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "keyword", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "keyword2", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "keyword3", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "char", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "tagname", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "linenum", &style_sets[ft_id].styling[14]); - get_keyfile_style(config, config_home, "white", &style_sets[ft_id].styling[15]); - - style_sets[ft_id].keywords = g_new(gchar*, 3); - get_keyfile_keywords(config, config_home, "keywords", ft_id, 0); - get_keyfile_keywords(config, config_home, "keywords_optional", ft_id, 1); - style_sets[ft_id].keywords[2] = NULL; -} - - -static void styleset_caml(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_CAML, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_CAML_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_CAML_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_CAML_COMMENT1, ft_id, 2); - set_sci_style(sci, SCE_CAML_COMMENT2, ft_id, 3); - set_sci_style(sci, SCE_CAML_COMMENT3, ft_id, 4); - set_sci_style(sci, SCE_CAML_NUMBER, ft_id, 5); - set_sci_style(sci, SCE_CAML_KEYWORD, ft_id, 6); - set_sci_style(sci, SCE_CAML_KEYWORD2, ft_id, 7); - set_sci_style(sci, SCE_CAML_KEYWORD3, ft_id, 8); - set_sci_style(sci, SCE_CAML_STRING, ft_id, 9); - set_sci_style(sci, SCE_CAML_CHAR, ft_id, 10); - set_sci_style(sci, SCE_CAML_OPERATOR, ft_id, 11); - set_sci_style(sci, SCE_CAML_IDENTIFIER, ft_id, 12); - set_sci_style(sci, SCE_CAML_TAGNAME, ft_id, 13); - set_sci_style(sci, SCE_CAML_LINENUM, ft_id, 14); - set_sci_style(sci, SCE_CAML_WHITE, ft_id, 15); -} - - -static void styleset_tcl_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 18); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "wordinquote", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "inquote", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "substitution", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "modifier", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "expand", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "wordtcl", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "wordtk", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "worditcl", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "wordtkcmds", &style_sets[ft_id].styling[14]); - get_keyfile_style(config, config_home, "wordexpand", &style_sets[ft_id].styling[15]); - get_keyfile_style(config, config_home, "commentbox", &style_sets[ft_id].styling[16]); - get_keyfile_style(config, config_home, "blockcomment", &style_sets[ft_id].styling[17]); - /*get_keyfile_style(config, config_home, "user1", &style_sets[ft_id].styling[18]); - get_keyfile_style(config, config_home, "user2", &style_sets[ft_id].styling[19]); - get_keyfile_style(config, config_home, "user3", &style_sets[ft_id].styling[20]);*/ - - style_sets[ft_id].keywords = g_new(gchar*, 6); - get_keyfile_keywords(config, config_home, "tcl", ft_id, 0); - get_keyfile_keywords(config, config_home, "tk", ft_id, 1); - get_keyfile_keywords(config, config_home, "itcl", ft_id, 2); - get_keyfile_keywords(config, config_home, "tkcommands", ft_id, 3); - get_keyfile_keywords(config, config_home, "expand", ft_id, 4); - style_sets[ft_id].keywords[5] = NULL; -} - - -static void styleset_tcl(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_TCL, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); - sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]); - sci_set_keywords(sci, 3, style_sets[ft_id].keywords[3]); - sci_set_keywords(sci, 4, style_sets[ft_id].keywords[4]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_TCL_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_TCL_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_TCL_COMMENTLINE, ft_id, 2); - set_sci_style(sci, SCE_TCL_NUMBER, ft_id, 3); - set_sci_style(sci, SCE_TCL_OPERATOR, ft_id, 4); - set_sci_style(sci, SCE_TCL_IDENTIFIER, ft_id, 5); - set_sci_style(sci, SCE_TCL_WORD_IN_QUOTE, ft_id, 6); - set_sci_style(sci, SCE_TCL_IN_QUOTE, ft_id, 7); - set_sci_style(sci, SCE_TCL_SUBSTITUTION, ft_id, 8); - set_sci_style(sci, SCE_TCL_MODIFIER, ft_id, 9); - set_sci_style(sci, SCE_TCL_EXPAND, ft_id, 10); - set_sci_style(sci, SCE_TCL_WORD, ft_id, 11); - set_sci_style(sci, SCE_TCL_WORD2, ft_id, 12); - set_sci_style(sci, SCE_TCL_WORD3, ft_id, 13); - set_sci_style(sci, SCE_TCL_WORD4, ft_id, 14); - set_sci_style(sci, SCE_TCL_WORD5, ft_id, 15); - set_sci_style(sci, SCE_TCL_COMMENT_BOX, ft_id, 16); - set_sci_style(sci, SCE_TCL_BLOCK_COMMENT, ft_id, 17); - /* these are for user-defined keywords we don't set yet */ - /*set_sci_style(sci, SCE_TCL_WORD6, ft_id, 18); - set_sci_style(sci, SCE_TCL_WORD7, ft_id, 19); - set_sci_style(sci, SCE_TCL_WORD8, ft_id, 20);*/ -} - -static void styleset_txt2tags_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 22); - - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "strong", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "emphasis", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "header1", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "header2", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "header3", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "header4", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "header5", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "header6", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "ulist_item", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "olist_item", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "blockquote", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "strikeout", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "hrule", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "link", &style_sets[ft_id].styling[14]); - get_keyfile_style(config, config_home, "code", &style_sets[ft_id].styling[15]); - get_keyfile_style(config, config_home, "codebk", &style_sets[ft_id].styling[16]); - get_keyfile_style(config, config_home, "underlined", &style_sets[ft_id].styling[17]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[18]); - get_keyfile_style(config, config_home, "option", &style_sets[ft_id].styling[19]); - get_keyfile_style(config, config_home, "preproc", &style_sets[ft_id].styling[20]); - get_keyfile_style(config, config_home, "postproc", &style_sets[ft_id].styling[21]); - - style_sets[ft_id].keywords = NULL; -} - - -static void styleset_txt2tags(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_TXT2TAGS, ft_id); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_TXT2TAGS_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_TXT2TAGS_LINE_BEGIN, ft_id, 0); - set_sci_style(sci, SCE_TXT2TAGS_PRECHAR, ft_id, 0); - set_sci_style(sci, SCE_TXT2TAGS_STRONG1, ft_id, 1); - set_sci_style(sci, SCE_TXT2TAGS_STRONG2, ft_id, 1); - set_sci_style(sci, SCE_TXT2TAGS_EM1, ft_id, 2); - set_sci_style(sci, SCE_TXT2TAGS_EM2, ft_id, 17); - set_sci_style(sci, SCE_TXT2TAGS_HEADER1, ft_id, 3); - set_sci_style(sci, SCE_TXT2TAGS_HEADER2, ft_id, 4); - set_sci_style(sci, SCE_TXT2TAGS_HEADER3, ft_id, 5); - set_sci_style(sci, SCE_TXT2TAGS_HEADER4, ft_id, 6); - set_sci_style(sci, SCE_TXT2TAGS_HEADER5, ft_id, 7); - set_sci_style(sci, SCE_TXT2TAGS_HEADER6, ft_id, 8); - set_sci_style(sci, SCE_TXT2TAGS_ULIST_ITEM, ft_id, 9); - set_sci_style(sci, SCE_TXT2TAGS_OLIST_ITEM, ft_id, 10); - set_sci_style(sci, SCE_TXT2TAGS_BLOCKQUOTE, ft_id, 11); - set_sci_style(sci, SCE_TXT2TAGS_STRIKEOUT, ft_id, 12); - set_sci_style(sci, SCE_TXT2TAGS_HRULE, ft_id, 13); - set_sci_style(sci, SCE_TXT2TAGS_LINK, ft_id, 14); - set_sci_style(sci, SCE_TXT2TAGS_CODE, ft_id, 15); - set_sci_style(sci, SCE_TXT2TAGS_CODE2, ft_id, 15); - set_sci_style(sci, SCE_TXT2TAGS_CODEBK, ft_id, 16); - set_sci_style(sci, SCE_TXT2TAGS_COMMENT, ft_id, 18); - set_sci_style(sci, SCE_TXT2TAGS_OPTION, ft_id, 19); - set_sci_style(sci, SCE_TXT2TAGS_PREPROC, ft_id, 20); - set_sci_style(sci, SCE_TXT2TAGS_POSTPROC, ft_id, 21); -} - - -static void styleset_matlab_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 9); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "command", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "keyword", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "doublequotedstring", &style_sets[ft_id].styling[8]); - - style_sets[ft_id].keywords = g_new(gchar*, 2); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - style_sets[ft_id].keywords[1] = NULL; -} - - -static void styleset_matlab(ScintillaObject *sci, guint ft_id) -{ - /* We use SCLEX_OCTAVE instead of SCLEX_MATLAB to also support Octave # comment char */ - apply_filetype_properties(sci, SCLEX_OCTAVE, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_MATLAB_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_MATLAB_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_MATLAB_COMMAND, ft_id, 2); - set_sci_style(sci, SCE_MATLAB_NUMBER, ft_id, 3); - set_sci_style(sci, SCE_MATLAB_KEYWORD, ft_id, 4); - set_sci_style(sci, SCE_MATLAB_STRING, ft_id, 5); - set_sci_style(sci, SCE_MATLAB_OPERATOR, ft_id, 6); - set_sci_style(sci, SCE_MATLAB_IDENTIFIER, ft_id, 7); - set_sci_style(sci, SCE_MATLAB_DOUBLEQUOTESTRING, ft_id, 8); -} - - -static void styleset_d_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 18); - - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "commentdoc", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "commentdocnested", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "word2", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "word3", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "typedef", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[14]); - get_keyfile_style(config, config_home, "commentlinedoc", &style_sets[ft_id].styling[15]); - get_keyfile_style(config, config_home, "commentdockeyword", &style_sets[ft_id].styling[16]); - get_keyfile_style(config, config_home, "commentdockeyworderror", &style_sets[ft_id].styling[17]); - /*get_keyfile_style(config, config_home, "word6", &style_sets[ft_id].styling[18]); - get_keyfile_style(config, config_home, "word7", &style_sets[ft_id].styling[19]);*/ - - style_sets[ft_id].keywords = g_new(gchar*, 5); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - get_keyfile_keywords(config, config_home, "secondary", ft_id, 1); - get_keyfile_keywords(config, config_home, "docComment", ft_id, 2); - get_keyfile_keywords(config, config_home, "types", ft_id, 3); - style_sets[ft_id].keywords[4] = NULL; -} - - -static void styleset_d(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_D, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - /* SCI_SETKEYWORDS = 1 - secondary + global tags file types, see below */ - sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]); - /* SCI_SETKEYWORDS = 3 is for current session types - see editor_lexer_get_type_keyword_idx() */ - sci_set_keywords(sci, 4, style_sets[ft_id].keywords[3]); - - /* assign global types, merge them with user defined keywords and set them */ - merge_type_keywords(sci, ft_id, 1); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_D_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_D_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_D_COMMENTLINE, ft_id, 2); - set_sci_style(sci, SCE_D_COMMENTDOC, ft_id, 3); - set_sci_style(sci, SCE_D_COMMENTNESTED, ft_id, 4); - set_sci_style(sci, SCE_D_NUMBER, ft_id, 5); - set_sci_style(sci, SCE_D_WORD, ft_id, 6); - set_sci_style(sci, SCE_D_WORD2, ft_id, 7); - set_sci_style(sci, SCE_D_WORD3, ft_id, 8); - set_sci_style(sci, SCE_D_TYPEDEF, ft_id, 9); - set_sci_style(sci, SCE_D_WORD5, ft_id, 9); - set_sci_style(sci, SCE_D_STRING, ft_id, 10); - set_sci_style(sci, SCE_D_STRINGB, ft_id, 10); - set_sci_style(sci, SCE_D_STRINGR, ft_id, 10); - set_sci_style(sci, SCE_D_STRINGEOL, ft_id, 11); - set_sci_style(sci, SCE_D_CHARACTER, ft_id, 12); - set_sci_style(sci, SCE_D_OPERATOR, ft_id, 13); - set_sci_style(sci, SCE_D_IDENTIFIER, ft_id, 14); - set_sci_style(sci, SCE_D_COMMENTLINEDOC, ft_id, 15); - set_sci_style(sci, SCE_D_COMMENTDOCKEYWORD, ft_id, 16); - set_sci_style(sci, SCE_D_COMMENTDOCKEYWORDERROR, ft_id, 17); - /* these are for user-defined keywords we don't set yet */ - /*set_sci_style(sci, SCE_D_WORD6, ft_id, 18); - set_sci_style(sci, SCE_D_WORD7, ft_id, 19);*/ -} - - -static void styleset_ferite_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - styleset_c_like_init(config, config_home, ft_id); - - style_sets[ft_id].keywords = g_new(gchar*, 4); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - get_keyfile_keywords(config, config_home, "types", ft_id, 1); - get_keyfile_keywords(config, config_home, "docComment", ft_id, 2); - style_sets[ft_id].keywords[3] = NULL; -} - - -static void styleset_ferite(ScintillaObject *sci, guint ft_id) -{ - styleset_c_like(sci, ft_id, SCLEX_CPP); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); - sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]); -} - - -static void styleset_vhdl_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 15); - - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "comment_line_bang", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "keyword", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "stdoperator", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "attribute", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "stdfunction", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "stdpackage", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "stdtype", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "userword", &style_sets[ft_id].styling[14]); - - style_sets[ft_id].keywords = g_new(gchar*, 8); - get_keyfile_keywords(config, config_home, "keywords", ft_id, 0); - get_keyfile_keywords(config, config_home, "operators", ft_id, 1); - get_keyfile_keywords(config, config_home, "attributes", ft_id, 2); - get_keyfile_keywords(config, config_home, "std_functions", ft_id, 3); - get_keyfile_keywords(config, config_home, "std_packages", ft_id, 4); - get_keyfile_keywords(config, config_home, "std_types", ft_id, 5); - get_keyfile_keywords(config, config_home, "userwords", ft_id, 6); - style_sets[ft_id].keywords[7] = NULL; -} - - -static void styleset_vhdl(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_VHDL, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); - sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]); - sci_set_keywords(sci, 3, style_sets[ft_id].keywords[3]); - sci_set_keywords(sci, 4, style_sets[ft_id].keywords[4]); - sci_set_keywords(sci, 5, style_sets[ft_id].keywords[5]); - sci_set_keywords(sci, 6, style_sets[ft_id].keywords[6]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_VHDL_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_VHDL_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_VHDL_COMMENTLINEBANG, ft_id, 2); - set_sci_style(sci, SCE_VHDL_NUMBER, ft_id, 3); - set_sci_style(sci, SCE_VHDL_STRING, ft_id, 4); - set_sci_style(sci, SCE_VHDL_OPERATOR, ft_id, 5); - set_sci_style(sci, SCE_VHDL_IDENTIFIER, ft_id, 6); - set_sci_style(sci, SCE_VHDL_STRINGEOL, ft_id, 7); - set_sci_style(sci, SCE_VHDL_KEYWORD, ft_id, 8); - set_sci_style(sci, SCE_VHDL_STDOPERATOR, ft_id, 9); - set_sci_style(sci, SCE_VHDL_ATTRIBUTE, ft_id, 10); - set_sci_style(sci, SCE_VHDL_STDFUNCTION, ft_id, 11); - set_sci_style(sci, SCE_VHDL_STDPACKAGE, ft_id, 12); - set_sci_style(sci, SCE_VHDL_STDTYPE, ft_id, 13); - set_sci_style(sci, SCE_VHDL_USERWORD, ft_id, 14); -} - - -static void styleset_verilog_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 14); - - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "comment_line", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "comment_line_bang", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "word2", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "word3", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "preprocessor", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "userword", &style_sets[ft_id].styling[13]); - - style_sets[ft_id].keywords = g_new(gchar*, 4); - get_keyfile_keywords(config, config_home, "word", ft_id, 0); - get_keyfile_keywords(config, config_home, "word2", ft_id, 1); - get_keyfile_keywords(config, config_home, "word3", ft_id, 2); - style_sets[ft_id].keywords[3] = NULL; -} - - -static void styleset_verilog(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_VERILOG, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); - sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_V_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_V_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_V_COMMENTLINE, ft_id, 2); - set_sci_style(sci, SCE_V_COMMENTLINEBANG, ft_id, 3); - set_sci_style(sci, SCE_V_NUMBER, ft_id, 4); - set_sci_style(sci, SCE_V_WORD, ft_id,5); - set_sci_style(sci, SCE_V_STRING, ft_id, 6); - set_sci_style(sci, SCE_V_WORD2, ft_id, 7); - set_sci_style(sci, SCE_V_WORD3, ft_id, 8); - set_sci_style(sci, SCE_V_PREPROCESSOR, ft_id, 9); - set_sci_style(sci, SCE_V_OPERATOR, ft_id, 10); - set_sci_style(sci, SCE_V_IDENTIFIER, ft_id, 11); - set_sci_style(sci, SCE_V_STRINGEOL, ft_id, 12); - set_sci_style(sci, SCE_V_USER, ft_id, 13); -} - - -static void styleset_yaml_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 10); - - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "keyword", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "reference", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "document", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "text", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "error", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[9]); - - style_sets[ft_id].keywords = g_new(gchar*, 2); - get_keyfile_keywords(config, config_home, "keywords", ft_id, 0); - style_sets[ft_id].keywords[1] = NULL; -} - - -static void styleset_yaml(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_YAML, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_YAML_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_YAML_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_YAML_IDENTIFIER, ft_id, 2); - set_sci_style(sci, SCE_YAML_KEYWORD, ft_id, 3); - set_sci_style(sci, SCE_YAML_NUMBER, ft_id, 4); - set_sci_style(sci, SCE_YAML_REFERENCE, ft_id, 5); - set_sci_style(sci, SCE_YAML_DOCUMENT, ft_id, 6); - set_sci_style(sci, SCE_YAML_TEXT, ft_id, 7); - set_sci_style(sci, SCE_YAML_ERROR, ft_id, 8); - set_sci_style(sci, SCE_YAML_OPERATOR, ft_id, 9); -} - - -static void styleset_js_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - styleset_c_like_init(config, config_home, ft_id); - - style_sets[ft_id].keywords = g_new(gchar*, 3); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - get_keyfile_keywords(config, config_home, "secondary", ft_id, 1); - style_sets[ft_id].keywords[2] = NULL; -} - - -static void styleset_js(ScintillaObject *sci, guint ft_id) -{ - styleset_c_like(sci, ft_id, SCLEX_CPP); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); -} - - -static void styleset_lua_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 21); - - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "commentdoc", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "literalstring", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "preprocessor", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "function_basic", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "function_other", &style_sets[ft_id].styling[14]); - get_keyfile_style(config, config_home, "coroutines", &style_sets[ft_id].styling[15]); - get_keyfile_style(config, config_home, "word5", &style_sets[ft_id].styling[16]); - get_keyfile_style(config, config_home, "word6", &style_sets[ft_id].styling[17]); - get_keyfile_style(config, config_home, "word7", &style_sets[ft_id].styling[18]); - get_keyfile_style(config, config_home, "word8", &style_sets[ft_id].styling[19]); - get_keyfile_style(config, config_home, "label", &style_sets[ft_id].styling[20]); - - style_sets[ft_id].keywords = g_new(gchar*, 9); - get_keyfile_keywords(config, config_home, "keywords", ft_id, 0); - get_keyfile_keywords(config, config_home, "function_basic", ft_id, 1); - get_keyfile_keywords(config, config_home, "function_other", ft_id, 2); - get_keyfile_keywords(config, config_home, "coroutines", ft_id, 3); - get_keyfile_keywords(config, config_home, "user1", ft_id, 4); - get_keyfile_keywords(config, config_home, "user2", ft_id, 5); - get_keyfile_keywords(config, config_home, "user3", ft_id, 6); - get_keyfile_keywords(config, config_home, "user4", ft_id, 7); - style_sets[ft_id].keywords[8] = NULL; -} - - -static void styleset_lua(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_LUA, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); - sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]); - sci_set_keywords(sci, 3, style_sets[ft_id].keywords[3]); - sci_set_keywords(sci, 4, style_sets[ft_id].keywords[4]); - sci_set_keywords(sci, 5, style_sets[ft_id].keywords[5]); - sci_set_keywords(sci, 6, style_sets[ft_id].keywords[6]); - sci_set_keywords(sci, 7, style_sets[ft_id].keywords[7]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_LUA_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_LUA_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_LUA_COMMENTLINE, ft_id, 2); - set_sci_style(sci, SCE_LUA_COMMENTDOC, ft_id, 3); - set_sci_style(sci, SCE_LUA_NUMBER, ft_id, 4); - set_sci_style(sci, SCE_LUA_WORD, ft_id, 5); - set_sci_style(sci, SCE_LUA_STRING, ft_id, 6); - set_sci_style(sci, SCE_LUA_CHARACTER, ft_id, 7); - set_sci_style(sci, SCE_LUA_LITERALSTRING, ft_id, 8); - set_sci_style(sci, SCE_LUA_PREPROCESSOR, ft_id, 9); - set_sci_style(sci, SCE_LUA_OPERATOR, ft_id, 10); - set_sci_style(sci, SCE_LUA_IDENTIFIER, ft_id, 11); - set_sci_style(sci, SCE_LUA_STRINGEOL, ft_id, 12); - set_sci_style(sci, SCE_LUA_WORD2, ft_id, 13); - set_sci_style(sci, SCE_LUA_WORD3, ft_id, 14); - set_sci_style(sci, SCE_LUA_WORD4, ft_id, 15); - set_sci_style(sci, SCE_LUA_WORD5, ft_id, 16); - set_sci_style(sci, SCE_LUA_WORD6, ft_id, 17); - set_sci_style(sci, SCE_LUA_WORD7, ft_id, 18); - set_sci_style(sci, SCE_LUA_WORD8, ft_id, 19); - set_sci_style(sci, SCE_LUA_LABEL, ft_id, 20); -} - - -static void styleset_basic_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 19); - - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "preprocessor", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "date", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "word2", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "word3", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "word4", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "constant", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "asm", &style_sets[ft_id].styling[14]); - get_keyfile_style(config, config_home, "label", &style_sets[ft_id].styling[15]); - get_keyfile_style(config, config_home, "error", &style_sets[ft_id].styling[16]); - get_keyfile_style(config, config_home, "hexnumber", &style_sets[ft_id].styling[17]); - get_keyfile_style(config, config_home, "binnumber", &style_sets[ft_id].styling[18]); - - style_sets[ft_id].keywords = g_new(gchar*, 5); - get_keyfile_keywords(config, config_home, "keywords", ft_id, 0); - get_keyfile_keywords(config, config_home, "preprocessor", ft_id, 1); - get_keyfile_keywords(config, config_home, "user1", ft_id, 2); - get_keyfile_keywords(config, config_home, "user2", ft_id, 3); - style_sets[ft_id].keywords[4] = NULL; -} - - -static void styleset_basic(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_FREEBASIC, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); - sci_set_keywords(sci, 2, style_sets[ft_id].keywords[2]); - sci_set_keywords(sci, 3, style_sets[ft_id].keywords[3]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_B_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_B_COMMENT, ft_id, 1); - set_sci_style(sci, SCE_B_NUMBER, ft_id, 2); - set_sci_style(sci, SCE_B_KEYWORD, ft_id, 3); - set_sci_style(sci, SCE_B_STRING, ft_id, 4); - set_sci_style(sci, SCE_B_PREPROCESSOR, ft_id, 5); - set_sci_style(sci, SCE_B_OPERATOR, ft_id, 6); - set_sci_style(sci, SCE_B_IDENTIFIER, ft_id, 7); - set_sci_style(sci, SCE_B_DATE, ft_id, 8); - set_sci_style(sci, SCE_B_STRINGEOL, ft_id, 9); - set_sci_style(sci, SCE_B_KEYWORD2, ft_id, 10); - set_sci_style(sci, SCE_B_KEYWORD3, ft_id, 11); - set_sci_style(sci, SCE_B_KEYWORD4, ft_id, 12); - set_sci_style(sci, SCE_B_CONSTANT, ft_id, 13); - set_sci_style(sci, SCE_B_ASM, ft_id, 14); /* (still?) unused by the lexer */ - set_sci_style(sci, SCE_B_LABEL, ft_id, 15); - set_sci_style(sci, SCE_B_ERROR, ft_id, 16); - set_sci_style(sci, SCE_B_HEXNUMBER, ft_id, 17); - set_sci_style(sci, SCE_B_BINNUMBER, ft_id, 18); -} - - -static void styleset_actionscript_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - styleset_c_like_init(config, config_home, ft_id); - - style_sets[ft_id].keywords = g_new(gchar *, 4); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - get_keyfile_keywords(config, config_home, "secondary", ft_id, 1); - get_keyfile_keywords(config, config_home, "classes", ft_id, 2); - style_sets[ft_id].keywords[3] = NULL; -} - - -static void styleset_actionscript(ScintillaObject *sci, guint ft_id) -{ - styleset_c_like(sci, ft_id, SCLEX_CPP); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[2]); - sci_set_keywords(sci, 3, style_sets[ft_id].keywords[1]); -} - - -static void styleset_haxe_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - styleset_c_like_init(config, config_home, ft_id); - - style_sets[ft_id].keywords = g_new(gchar*, 4); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - get_keyfile_keywords(config, config_home, "secondary", ft_id, 1); - get_keyfile_keywords(config, config_home, "classes", ft_id, 2); - style_sets[ft_id].keywords[3] = NULL; -} - - -static void styleset_haxe(ScintillaObject *sci, guint ft_id) -{ - styleset_c_like(sci, ft_id, SCLEX_CPP); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]); - sci_set_keywords(sci, 3, style_sets[ft_id].keywords[2]); -} - - -static void styleset_ada_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 12); - - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "word", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "delimiter", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "charactereol", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "label", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "commentline", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "illegal", &style_sets[ft_id].styling[11]); - - style_sets[ft_id].keywords = g_new(gchar*, 2); - get_keyfile_keywords(config, config_home, "primary", ft_id, 0); - style_sets[ft_id].keywords[1] = NULL; -} - - -static void styleset_ada(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_ADA, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_ADA_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_ADA_WORD, ft_id, 1); - set_sci_style(sci, SCE_ADA_IDENTIFIER, ft_id, 2); - set_sci_style(sci, SCE_ADA_NUMBER, ft_id, 3); - set_sci_style(sci, SCE_ADA_DELIMITER, ft_id, 4); - set_sci_style(sci, SCE_ADA_CHARACTER, ft_id, 5); - set_sci_style(sci, SCE_ADA_CHARACTEREOL, ft_id, 6); - set_sci_style(sci, SCE_ADA_STRING, ft_id, 7); - set_sci_style(sci, SCE_ADA_STRINGEOL, ft_id, 8); - set_sci_style(sci, SCE_ADA_LABEL, ft_id, 9); - set_sci_style(sci, SCE_ADA_COMMENTLINE, ft_id, 10); - set_sci_style(sci, SCE_ADA_ILLEGAL, ft_id, 11); -} - - static void get_key_values(GKeyFile *config, const gchar *group, gchar **keys, gchar **values) { while (*keys) @@ -3412,6 +1316,11 @@ static guint get_lexer_filetype(GeanyFiletype *ft) init_styleset_func(filetype_idx, config, configh); \ break +#define init_styleset_case_auto(LANG_NAME) \ + case (GEANY_FILETYPES_##LANG_NAME): \ + STYLESET_INIT_FROM_MAPPING(filetype_idx, config, configh, LANG_NAME); \ + break + /* Called by filetypes_load_config(). */ void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *configh) { @@ -3437,51 +1346,51 @@ void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *co switch (lexer_id) { - init_styleset_case(GEANY_FILETYPES_ADA, styleset_ada_init); - init_styleset_case(GEANY_FILETYPES_ASM, styleset_asm_init); - init_styleset_case(GEANY_FILETYPES_BASIC, styleset_basic_init); - init_styleset_case(GEANY_FILETYPES_C, styleset_c_init); - init_styleset_case(GEANY_FILETYPES_CAML, styleset_caml_init); - init_styleset_case(GEANY_FILETYPES_CMAKE, styleset_cmake_init); - init_styleset_case(GEANY_FILETYPES_COBOL, styleset_cobol_init); - init_styleset_case(GEANY_FILETYPES_CONF, styleset_conf_init); - init_styleset_case(GEANY_FILETYPES_CSS, styleset_css_init); - init_styleset_case(GEANY_FILETYPES_D, styleset_d_init); - init_styleset_case(GEANY_FILETYPES_DIFF, styleset_diff_init); - init_styleset_case(GEANY_FILETYPES_LISP, styleset_lisp_init); - init_styleset_case(GEANY_FILETYPES_ERLANG, styleset_erlang_init); + init_styleset_case_auto(ADA); + init_styleset_case_auto(ASM); + init_styleset_case_auto(BASIC); + init_styleset_case_auto(C); + init_styleset_case_auto(CAML); + init_styleset_case_auto(CMAKE); + init_styleset_case_auto(COBOL); + init_styleset_case_auto(CONF); + init_styleset_case_auto(CSS); + init_styleset_case_auto(D); + init_styleset_case_auto(DIFF); + init_styleset_case_auto(LISP); + init_styleset_case_auto(ERLANG); init_styleset_case(GEANY_FILETYPES_DOCBOOK, styleset_docbook_init); - init_styleset_case(GEANY_FILETYPES_FERITE, styleset_ferite_init); - init_styleset_case(GEANY_FILETYPES_F77, styleset_f77_init); - init_styleset_case(GEANY_FILETYPES_FORTH, styleset_forth_init); - init_styleset_case(GEANY_FILETYPES_FORTRAN, styleset_fortran_init); - init_styleset_case(GEANY_FILETYPES_HASKELL, styleset_haskell_init); - init_styleset_case(GEANY_FILETYPES_HAXE, styleset_haxe_init); - init_styleset_case(GEANY_FILETYPES_AS, styleset_actionscript_init); + init_styleset_case_auto(FERITE); + init_styleset_case_auto(F77); + init_styleset_case_auto(FORTH); + init_styleset_case_auto(FORTRAN); + init_styleset_case_auto(HASKELL); + init_styleset_case_auto(HAXE); + init_styleset_case_auto(AS); init_styleset_case(GEANY_FILETYPES_HTML, styleset_html_init); - init_styleset_case(GEANY_FILETYPES_JAVA, styleset_java_init); - init_styleset_case(GEANY_FILETYPES_JS, styleset_js_init); - init_styleset_case(GEANY_FILETYPES_LATEX, styleset_latex_init); - init_styleset_case(GEANY_FILETYPES_LUA, styleset_lua_init); - init_styleset_case(GEANY_FILETYPES_MAKE, styleset_makefile_init); - init_styleset_case(GEANY_FILETYPES_MATLAB, styleset_matlab_init); - init_styleset_case(GEANY_FILETYPES_MARKDOWN, styleset_markdown_init); - init_styleset_case(GEANY_FILETYPES_NSIS, styleset_nsis_init); - init_styleset_case(GEANY_FILETYPES_PASCAL, styleset_pascal_init); - init_styleset_case(GEANY_FILETYPES_PERL, styleset_perl_init); + init_styleset_case_auto(JAVA); + init_styleset_case_auto(JS); + init_styleset_case_auto(LATEX); + init_styleset_case_auto(LUA); + init_styleset_case_auto(MAKE); + init_styleset_case_auto(MATLAB); + init_styleset_case_auto(MARKDOWN); + init_styleset_case_auto(NSIS); + init_styleset_case_auto(PASCAL); + init_styleset_case_auto(PERL); init_styleset_case(GEANY_FILETYPES_PHP, styleset_php_init); - init_styleset_case(GEANY_FILETYPES_PO, styleset_po_init); - init_styleset_case(GEANY_FILETYPES_PYTHON, styleset_python_init); - init_styleset_case(GEANY_FILETYPES_R, styleset_r_init); - init_styleset_case(GEANY_FILETYPES_RUBY, styleset_ruby_init); - init_styleset_case(GEANY_FILETYPES_SH, styleset_sh_init); - init_styleset_case(GEANY_FILETYPES_SQL, styleset_sql_init); - init_styleset_case(GEANY_FILETYPES_TCL, styleset_tcl_init); - init_styleset_case(GEANY_FILETYPES_TXT2TAGS, styleset_txt2tags_init); - init_styleset_case(GEANY_FILETYPES_VHDL, styleset_vhdl_init); - init_styleset_case(GEANY_FILETYPES_VERILOG, styleset_verilog_init); + init_styleset_case_auto(PO); + init_styleset_case_auto(PYTHON); + init_styleset_case_auto(R); + init_styleset_case_auto(RUBY); + init_styleset_case_auto(SH); + init_styleset_case_auto(SQL); + init_styleset_case_auto(TCL); + init_styleset_case_auto(TXT2TAGS); + init_styleset_case_auto(VHDL); + init_styleset_case_auto(VERILOG); init_styleset_case(GEANY_FILETYPES_XML, styleset_markup_init); - init_styleset_case(GEANY_FILETYPES_YAML, styleset_yaml_init); + init_styleset_case_auto(YAML); default: if (ft->lexer_filetype) geany_debug("Filetype %s has a recursive lexer_filetype %s set!", @@ -3499,6 +1408,11 @@ void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *co styleset_func(sci, ft->id); \ break +#define styleset_case_auto(LANG_NAME) \ + case (GEANY_FILETYPES_##LANG_NAME): \ + STYLESET_FROM_MAPPING(sci, ft->id, highlighting_lexer_##LANG_NAME, LANG_NAME); \ + break + /** Sets up highlighting and other visual settings. * @param sci Scintilla widget. * @param ft Filetype settings to use. */ @@ -3510,51 +1424,51 @@ void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft) switch (lexer_id) { - styleset_case(GEANY_FILETYPES_ADA, styleset_ada); - styleset_case(GEANY_FILETYPES_ASM, styleset_asm); - styleset_case(GEANY_FILETYPES_BASIC, styleset_basic); - styleset_case(GEANY_FILETYPES_C, styleset_c); - styleset_case(GEANY_FILETYPES_CAML, styleset_caml); - styleset_case(GEANY_FILETYPES_CMAKE, styleset_cmake); - styleset_case(GEANY_FILETYPES_COBOL, styleset_cobol); - styleset_case(GEANY_FILETYPES_CONF, styleset_conf); - styleset_case(GEANY_FILETYPES_CSS, styleset_css); - styleset_case(GEANY_FILETYPES_D, styleset_d); - styleset_case(GEANY_FILETYPES_DIFF, styleset_diff); - styleset_case(GEANY_FILETYPES_LISP, styleset_lisp); - styleset_case(GEANY_FILETYPES_ERLANG, styleset_erlang); + styleset_case_auto(ADA); + styleset_case_auto(ASM); + styleset_case_auto(BASIC); + styleset_case_auto(C); + styleset_case_auto(CAML); + styleset_case_auto(CMAKE); + styleset_case_auto(COBOL); + styleset_case_auto(CONF); + styleset_case_auto(CSS); + styleset_case_auto(D); + styleset_case_auto(DIFF); + styleset_case_auto(LISP); + styleset_case_auto(ERLANG); styleset_case(GEANY_FILETYPES_DOCBOOK, styleset_docbook); - styleset_case(GEANY_FILETYPES_FERITE, styleset_ferite); - styleset_case(GEANY_FILETYPES_F77, styleset_f77); - styleset_case(GEANY_FILETYPES_FORTH, styleset_forth); - styleset_case(GEANY_FILETYPES_FORTRAN, styleset_fortran); - styleset_case(GEANY_FILETYPES_HASKELL, styleset_haskell); - styleset_case(GEANY_FILETYPES_HAXE, styleset_haxe); - styleset_case(GEANY_FILETYPES_AS, styleset_actionscript); + styleset_case_auto(FERITE); + styleset_case_auto(F77); + styleset_case_auto(FORTH); + styleset_case_auto(FORTRAN); + styleset_case_auto(HASKELL); + styleset_case_auto(HAXE); + styleset_case_auto(AS); styleset_case(GEANY_FILETYPES_HTML, styleset_html); - styleset_case(GEANY_FILETYPES_JAVA, styleset_java); - styleset_case(GEANY_FILETYPES_JS, styleset_js); - styleset_case(GEANY_FILETYPES_LATEX, styleset_latex); - styleset_case(GEANY_FILETYPES_LUA, styleset_lua); - styleset_case(GEANY_FILETYPES_MAKE, styleset_makefile); - styleset_case(GEANY_FILETYPES_MARKDOWN, styleset_markdown); - styleset_case(GEANY_FILETYPES_MATLAB, styleset_matlab); - styleset_case(GEANY_FILETYPES_NSIS, styleset_nsis); - styleset_case(GEANY_FILETYPES_PASCAL, styleset_pascal); - styleset_case(GEANY_FILETYPES_PERL, styleset_perl); + styleset_case_auto(JAVA); + styleset_case_auto(JS); + styleset_case_auto(LATEX); + styleset_case_auto(LUA); + styleset_case_auto(MAKE); + styleset_case_auto(MARKDOWN); + styleset_case_auto(MATLAB); + styleset_case_auto(NSIS); + styleset_case_auto(PASCAL); + styleset_case_auto(PERL); styleset_case(GEANY_FILETYPES_PHP, styleset_php); - styleset_case(GEANY_FILETYPES_PO, styleset_po); - styleset_case(GEANY_FILETYPES_PYTHON, styleset_python); - styleset_case(GEANY_FILETYPES_R, styleset_r); - styleset_case(GEANY_FILETYPES_RUBY, styleset_ruby); - styleset_case(GEANY_FILETYPES_SH, styleset_sh); - styleset_case(GEANY_FILETYPES_SQL, styleset_sql); - styleset_case(GEANY_FILETYPES_TCL, styleset_tcl); - styleset_case(GEANY_FILETYPES_TXT2TAGS, styleset_txt2tags); - styleset_case(GEANY_FILETYPES_VHDL, styleset_vhdl); - styleset_case(GEANY_FILETYPES_VERILOG, styleset_verilog); + styleset_case_auto(PO); + styleset_case_auto(PYTHON); + styleset_case_auto(R); + styleset_case_auto(RUBY); + styleset_case_auto(SH); + styleset_case_auto(SQL); + styleset_case_auto(TCL); + styleset_case_auto(TXT2TAGS); + styleset_case_auto(VHDL); + styleset_case_auto(VERILOG); styleset_case(GEANY_FILETYPES_XML, styleset_xml); - styleset_case(GEANY_FILETYPES_YAML, styleset_yaml); + styleset_case_auto(YAML); case GEANY_FILETYPES_NONE: default: styleset_default(sci, ft->id); diff --git a/src/highlightingmappings.h b/src/highlightingmappings.h new file mode 100644 index 00000000..b8d56b13 --- /dev/null +++ b/src/highlightingmappings.h @@ -0,0 +1,1193 @@ +/* + * highlightingmappings.h - this file is part of Geany, a fast and lightweight IDE + * + * Copyright 2005-2011 Enrico Tröger + * Copyright 2006-2011 Nick Treleaven + * Copyright 2011 Colomban Wendling + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +#ifndef GEANY_HIGHLIGHTINGMAPPINGS_H +#define GEANY_HIGHLIGHTINGMAPPINGS_H 1 + +#include "Scintilla.h" + + +/* contains all filtypes informations in the form of: + * - highlighting_lexer_LANG: the SCI lexer + * - highlighting_styles_LANG: SCI style/named style mappings + * - highlighting_keywords_LANG: keywords ID/name mappings + * - highlighting_properties_LANG: default SCI properties and their value + * where LANG is the lang part from GEANY_FILETYPE_LANG + * + * Using this scheme makes possible to automate style setup by simply listing LANG + * and let STYLESET_[INIT_]FROM_MAPPING() macro prepare the correct calls. + */ + + +/* first HLStyle array entry should always be the default style for that lexer */ +typedef struct +{ + guint style; /* SCI style */ + const gchar *name; /* style name in the filetypes.* file */ +} HLStyle; + +typedef struct +{ + guint id; /* SCI keyword ID */ + gboolean merge; /* whether to merge with session types */ + const gchar *key; /* keywords entry name in the filetypes.* file */ +} HLKeyword; + +typedef struct +{ + const gchar *property; + const gchar *value; +} HLProperty; + + +#define EMPTY_KEYWORDS ((HLKeyword *) NULL) +#define EMPTY_PROPERTIES ((HLProperty *) NULL) + + +/* Ada */ +#define highlighting_lexer_ADA SCLEX_ADA +static const HLStyle highlighting_styles_ADA[] = +{ + { SCE_ADA_DEFAULT, "default" }, + { SCE_ADA_WORD, "word" }, + { SCE_ADA_IDENTIFIER, "identifier" }, + { SCE_ADA_NUMBER, "number" }, + { SCE_ADA_DELIMITER, "delimiter" }, + { SCE_ADA_CHARACTER, "character" }, + { SCE_ADA_CHARACTEREOL, "charactereol" }, + { SCE_ADA_STRING, "string" }, + { SCE_ADA_STRINGEOL, "stringeol" }, + { SCE_ADA_LABEL, "label" }, + { SCE_ADA_COMMENTLINE, "commentline" }, + { SCE_ADA_ILLEGAL, "illegal" } +}; +static const HLKeyword highlighting_keywords_ADA[] = +{ + { 0, FALSE, "primary" } +}; +#define highlighting_properties_ADA EMPTY_PROPERTIES + + +/* ActionScript */ +#define highlighting_lexer_AS SCLEX_CPP +#define highlighting_styles_AS highlighting_styles_C +static const HLKeyword highlighting_keywords_AS[] = +{ + { 0, FALSE, "primary" }, + { 1, FALSE, "secondary" }, + { 3, FALSE, "classes" } +}; +#define highlighting_properties_AS highlighting_properties_C + + +/* ASM */ +#define highlighting_lexer_ASM SCLEX_ASM +static const HLStyle highlighting_styles_ASM[] = +{ + { SCE_ASM_DEFAULT, "default" }, + { SCE_ASM_COMMENT, "comment" }, + { SCE_ASM_NUMBER, "number" }, + { SCE_ASM_STRING, "string" }, + { SCE_ASM_OPERATOR, "operator" }, + { SCE_ASM_IDENTIFIER, "identifier" }, + { SCE_ASM_CPUINSTRUCTION, "cpuinstruction" }, + { SCE_ASM_MATHINSTRUCTION, "mathinstruction" }, + { SCE_ASM_REGISTER, "register" }, + { SCE_ASM_DIRECTIVE, "directive" }, + { SCE_ASM_DIRECTIVEOPERAND, "directiveoperand" }, + { SCE_ASM_COMMENTBLOCK, "commentblock" }, + { SCE_ASM_CHARACTER, "character" }, + { SCE_ASM_STRINGEOL, "stringeol" }, + { SCE_ASM_EXTINSTRUCTION, "extinstruction" }, + { SCE_ASM_COMMENTDIRECTIVE, "commentdirective" } +}; +static const HLKeyword highlighting_keywords_ASM[] = +{ + { 0, FALSE, "instructions" }, + /*{ 1, FALSE, "instructions" },*/ + { 2, FALSE, "registers" }, + { 3, FALSE, "directives" } + /*{ 5, FALSE, "instructions" }*/ +}; +#define highlighting_properties_ASM EMPTY_PROPERTIES + + +/* BASIC */ +#define highlighting_lexer_BASIC SCLEX_FREEBASIC +static const HLStyle highlighting_styles_BASIC[] = +{ + { SCE_B_DEFAULT, "default" }, + { SCE_B_COMMENT, "comment" }, + { SCE_B_NUMBER, "number" }, + { SCE_B_KEYWORD, "word" }, + { SCE_B_STRING, "string" }, + { SCE_B_PREPROCESSOR, "preprocessor" }, + { SCE_B_OPERATOR, "operator" }, + { SCE_B_IDENTIFIER, "identifier" }, + { SCE_B_DATE, "date" }, + { SCE_B_STRINGEOL, "stringeol" }, + { SCE_B_KEYWORD2, "word2" }, + { SCE_B_KEYWORD3, "word3" }, + { SCE_B_KEYWORD4, "word4" }, + { SCE_B_CONSTANT, "constant" }, + { SCE_B_ASM, "asm" }, + { SCE_B_LABEL, "label" }, + { SCE_B_ERROR, "error" }, + { SCE_B_HEXNUMBER, "hexnumber" }, + { SCE_B_BINNUMBER, "binnumber" } +}; +static const HLKeyword highlighting_keywords_BASIC[] = +{ + { 0, FALSE, "keywords" }, + { 1, FALSE, "preprocessor" }, + { 2, FALSE, "user1" }, + { 3, FALSE, "user2" } +}; +#define highlighting_properties_BASIC EMPTY_PROPERTIES + + +/* C */ +/* Also used by some other SCLEX_CPP-based filetypes */ +#define highlighting_lexer_C SCLEX_CPP +static const HLStyle highlighting_styles_C[] = +{ + { SCE_C_DEFAULT, "default" }, + { SCE_C_COMMENT, "comment" }, + { SCE_C_COMMENTLINE, "commentline" }, + { SCE_C_COMMENTDOC, "commentdoc" }, + { SCE_C_NUMBER, "number" }, + { SCE_C_WORD, "word" }, + { SCE_C_WORD2, "word2" }, + { SCE_C_STRING, "string" }, + { SCE_C_CHARACTER, "character" }, + { SCE_C_UUID, "uuid" }, + { SCE_C_PREPROCESSOR, "preprocessor" }, + { SCE_C_OPERATOR, "operator" }, + { SCE_C_IDENTIFIER, "identifier" }, + { SCE_C_STRINGEOL, "stringeol" }, + { SCE_C_VERBATIM, "verbatim" }, + /* triple verbatims use the same style */ + { SCE_C_TRIPLEVERBATIM, "verbatim" }, + { SCE_C_REGEX, "regex" }, + { SCE_C_COMMENTLINEDOC, "commentlinedoc" }, + { SCE_C_COMMENTDOCKEYWORD, "commentdockeyword" }, + { SCE_C_COMMENTDOCKEYWORDERROR, "commentdockeyworderror" }, + /* used for local structs and typedefs */ + { SCE_C_GLOBALCLASS, "globalclass" } +}; +static const HLKeyword highlighting_keywords_C[] = +{ + { 0, FALSE, "primary" }, + /* SCI_SETKEYWORDS = 1 - secondary + global tags file types, see below */ + { 1, TRUE, "secondary" }, + { 2, FALSE, "docComment" } + /* SCI_SETKEYWORDS = 3 is for current session types - see editor_lexer_get_type_keyword_idx() */ +}; +static const HLProperty highlighting_properties_C[] = +{ + { "fold.cpp.comment.explicit", "0" } +}; + + +/* Caml */ +#define highlighting_lexer_CAML SCLEX_CAML +static const HLStyle highlighting_styles_CAML[] = +{ + { SCE_CAML_DEFAULT, "default" }, + { SCE_CAML_COMMENT, "comment" }, + { SCE_CAML_COMMENT1, "comment1" }, + { SCE_CAML_COMMENT2, "comment2" }, + { SCE_CAML_COMMENT3, "comment3" }, + { SCE_CAML_NUMBER, "number" }, + { SCE_CAML_KEYWORD, "keyword" }, + { SCE_CAML_KEYWORD2, "keyword2" }, + { SCE_CAML_KEYWORD3, "keyword3" }, + { SCE_CAML_STRING, "string" }, + { SCE_CAML_CHAR, "char" }, + { SCE_CAML_OPERATOR, "operator" }, + { SCE_CAML_IDENTIFIER, "identifier" }, + { SCE_CAML_TAGNAME, "tagname" }, + { SCE_CAML_LINENUM, "linenum" }, + { SCE_CAML_WHITE, "white" } +}; +static const HLKeyword highlighting_keywords_CAML[] = +{ + { 0, FALSE, "keywords" }, + { 1, FALSE, "keywords_optional" } +}; +#define highlighting_properties_CAML EMPTY_PROPERTIES + + +/* CMake */ +#define highlighting_lexer_CMAKE SCLEX_CMAKE +static const HLStyle highlighting_styles_CMAKE[] = +{ + { SCE_CMAKE_DEFAULT, "default" }, + { SCE_CMAKE_COMMENT, "comment" }, + { SCE_CMAKE_STRINGDQ, "stringdq" }, + { SCE_CMAKE_STRINGLQ, "stringlq" }, + { SCE_CMAKE_STRINGRQ, "stringrq" }, + { SCE_CMAKE_COMMANDS, "command" }, + { SCE_CMAKE_PARAMETERS, "parameters" }, + { SCE_CMAKE_VARIABLE, "variable" }, + { SCE_CMAKE_USERDEFINED, "userdefined" }, + { SCE_CMAKE_WHILEDEF, "whiledef" }, + { SCE_CMAKE_FOREACHDEF, "foreachdef" }, + { SCE_CMAKE_IFDEFINEDEF, "ifdefinedef" }, + { SCE_CMAKE_MACRODEF, "macrodef" }, + { SCE_CMAKE_STRINGVAR, "stringvar" }, + { SCE_CMAKE_NUMBER, "number" } +}; +static const HLKeyword highlighting_keywords_CMAKE[] = +{ + { 0, FALSE, "commands" }, + { 1, FALSE, "parameters" }, + { 2, FALSE, "userdefined" } +}; +#define highlighting_properties_CMAKE EMPTY_PROPERTIES + + +/* CSS */ +#define highlighting_lexer_CSS SCLEX_CSS +static const HLStyle highlighting_styles_CSS[] = +{ + { SCE_CSS_DEFAULT, "default" }, + { SCE_CSS_COMMENT, "comment" }, + { SCE_CSS_TAG, "tag" }, + { SCE_CSS_CLASS, "class" }, + { SCE_CSS_PSEUDOCLASS, "pseudoclass" }, + { SCE_CSS_UNKNOWN_PSEUDOCLASS, "unknown_pseudoclass" }, + { SCE_CSS_UNKNOWN_IDENTIFIER, "unknown_identifier" }, + { SCE_CSS_OPERATOR, "operator" }, + { SCE_CSS_IDENTIFIER, "identifier" }, + { SCE_CSS_DOUBLESTRING, "doublestring" }, + { SCE_CSS_SINGLESTRING, "singlestring" }, + { SCE_CSS_ATTRIBUTE, "attribute" }, + { SCE_CSS_VALUE, "value" }, + { SCE_CSS_ID, "id" }, + { SCE_CSS_IDENTIFIER2, "identifier2" }, + { SCE_CSS_IMPORTANT, "important" }, + { SCE_CSS_DIRECTIVE, "directive" }, + { SCE_CSS_IDENTIFIER3, "identifier3" }, + { SCE_CSS_PSEUDOELEMENT, "pseudoelement" }, + { SCE_CSS_EXTENDED_IDENTIFIER, "extended_identifier" }, + { SCE_CSS_EXTENDED_PSEUDOCLASS, "extended_pseudoclass" }, + { SCE_CSS_EXTENDED_PSEUDOELEMENT, "extended_pseudoelement" }, + { SCE_CSS_MEDIA, "media" } +}; +static const HLKeyword highlighting_keywords_CSS[] = +{ + { 0, FALSE, "primary" }, + { 1, FALSE, "pseudoclasses" }, + { 2, FALSE, "secondary" }, + { 3, FALSE, "css3_properties" }, + { 4, FALSE, "pseudo_elements" }, + { 5, FALSE, "browser_css_properties" }, + { 6, FALSE, "browser_pseudo_classes" }, + { 7, FALSE, "browser_pseudo_elements" } +}; +#define highlighting_properties_CSS EMPTY_PROPERTIES + + +/* Cobol */ +#define highlighting_lexer_COBOL SCLEX_COBOL +#define highlighting_styles_COBOL highlighting_styles_C +static const HLKeyword highlighting_keywords_COBOL[] = +{ + { 0, FALSE, "primary" }, + { 1, FALSE, "secondary" }, + { 2, FALSE, "extended_keywords" } +}; +#define highlighting_properties_COBOL highlighting_properties_C + + +/* Conf */ +#define highlighting_lexer_CONF SCLEX_PROPERTIES +static const HLStyle highlighting_styles_CONF[] = +{ + { SCE_PROPS_DEFAULT, "default" }, + { SCE_PROPS_COMMENT, "comment" }, + { SCE_PROPS_SECTION, "section" }, + { SCE_PROPS_KEY, "key" }, + { SCE_PROPS_ASSIGNMENT, "assignment" }, + { SCE_PROPS_DEFVAL, "defval" } +}; +#define highlighting_keywords_CONF EMPTY_KEYWORDS +#define highlighting_properties_CONF EMPTY_PROPERTIES + + +/* D */ +#define highlighting_lexer_D SCLEX_D +static const HLStyle highlighting_styles_D[] = +{ + { SCE_D_DEFAULT, "default" }, + { SCE_D_COMMENT, "comment" }, + { SCE_D_COMMENTLINE, "commentline" }, + { SCE_D_COMMENTDOC, "commentdoc" }, + { SCE_D_COMMENTNESTED, "commentdocnested" }, + { SCE_D_NUMBER, "number" }, + { SCE_D_WORD, "word" }, + { SCE_D_WORD2, "word2" }, + { SCE_D_WORD3, "word3" }, + { SCE_D_TYPEDEF, "typedef" }, /* FIXME: don't remap here */ + { SCE_D_WORD5, "typedef" }, + { SCE_D_STRING, "string" }, + { SCE_D_STRINGB, "string" }, + { SCE_D_STRINGR, "string" }, + { SCE_D_STRINGEOL, "stringeol" }, + { SCE_D_CHARACTER, "character" }, + { SCE_D_OPERATOR, "operator" }, + { SCE_D_IDENTIFIER, "identifier" }, + { SCE_D_COMMENTLINEDOC, "commentlinedoc" }, + { SCE_D_COMMENTDOCKEYWORD, "commentdockeyword" }, + { SCE_D_COMMENTDOCKEYWORDERROR, "commentdockeyworderror" } + /* these are for user-defined keywords we don't set yet */ + /*{ SCE_D_WORD6, "word6" }, + { SCE_D_WORD7, "word7" }*/ +}; +static const HLKeyword highlighting_keywords_D[] = +{ + { 0, FALSE, "primary" }, + /* SCI_SETKEYWORDS = 1 - secondary + global tags file types */ + { 1, TRUE, "secondary" }, + { 2, FALSE, "docComment" }, + /* SCI_SETKEYWORDS = 3 is for current session types - see editor_lexer_get_type_keyword_idx() */ + { 4, FALSE, "types" }, +}; +#define highlighting_properties_D EMPTY_PROPERTIES + + +/* Diff */ +#define highlighting_lexer_DIFF SCLEX_DIFF +static const HLStyle highlighting_styles_DIFF[] = +{ + { SCE_DIFF_DEFAULT, "default" }, + { SCE_DIFF_COMMENT, "comment" }, + { SCE_DIFF_COMMAND, "command" }, + { SCE_DIFF_HEADER, "header" }, + { SCE_DIFF_POSITION, "position" }, + { SCE_DIFF_DELETED, "deleted" }, + { SCE_DIFF_ADDED, "added" }, + { SCE_DIFF_CHANGED, "changed" } +}; +#define highlighting_keywords_DIFF EMPTY_KEYWORDS +#define highlighting_properties_DIFF EMPTY_PROPERTIES + + +/* Erlang */ +#define highlighting_lexer_ERLANG SCLEX_ERLANG +static const HLStyle highlighting_styles_ERLANG[] = +{ + { SCE_ERLANG_DEFAULT, "default" }, + { SCE_ERLANG_COMMENT, "comment" }, + { SCE_ERLANG_VARIABLE, "variable" }, + { SCE_ERLANG_NUMBER, "number" }, + { SCE_ERLANG_KEYWORD, "keyword" }, + { SCE_ERLANG_STRING, "string" }, + { SCE_ERLANG_OPERATOR, "operator" }, + { SCE_ERLANG_ATOM, "atom" }, + { SCE_ERLANG_FUNCTION_NAME, "function_name" }, + { SCE_ERLANG_CHARACTER, "character" }, + { SCE_ERLANG_MACRO, "macro" }, + { SCE_ERLANG_RECORD, "record" }, + { SCE_ERLANG_PREPROC, "preproc" }, + { SCE_ERLANG_NODE_NAME, "node_name" }, + { SCE_ERLANG_COMMENT_FUNCTION, "comment_function" }, + { SCE_ERLANG_COMMENT_MODULE, "comment_module" }, + { SCE_ERLANG_COMMENT_DOC, "comment_doc" }, + { SCE_ERLANG_COMMENT_DOC_MACRO, "comment_doc_macro" }, + { SCE_ERLANG_ATOM_QUOTED, "atom_quoted" }, + { SCE_ERLANG_MACRO_QUOTED, "macro_quoted" }, + { SCE_ERLANG_RECORD_QUOTED, "record_quoted" }, + { SCE_ERLANG_NODE_NAME_QUOTED, "node_name_quoted" }, + { SCE_ERLANG_BIFS, "bifs" }, + { SCE_ERLANG_MODULES, "modules" }, + { SCE_ERLANG_MODULES_ATT, "modules_att" }, + { SCE_ERLANG_UNKNOWN, "unknown" } +}; +static const HLKeyword highlighting_keywords_ERLANG[] = +{ + { 0, FALSE, "keywords" }, + { 1, FALSE, "bifs" }, + { 2, FALSE, "preproc" }, + { 3, FALSE, "module" }, + { 4, FALSE, "doc" }, + { 5, FALSE, "doc_macro" } +}; +#define highlighting_properties_ERLANG EMPTY_PROPERTIES + + +/* F77 */ +#define highlighting_lexer_F77 SCLEX_F77 +static const HLStyle highlighting_styles_F77[] = +{ + { SCE_F_DEFAULT, "default" }, + { SCE_F_COMMENT, "comment" }, + { SCE_F_NUMBER, "number" }, + { SCE_F_STRING1, "string" }, + { SCE_F_OPERATOR, "operator" }, + { SCE_F_IDENTIFIER, "identifier" }, + { SCE_F_STRING2, "string2" }, + { SCE_F_WORD, "word" }, + { SCE_F_WORD2, "word2" }, + { SCE_F_WORD3, "word3" }, + { SCE_F_PREPROCESSOR, "preprocessor" }, + { SCE_F_OPERATOR2, "operator2" }, + { SCE_F_CONTINUATION, "continuation" }, + { SCE_F_STRINGEOL, "stringeol" }, + { SCE_F_LABEL, "label" } +}; +static const HLKeyword highlighting_keywords_F77[] = +{ + { 0, FALSE, "primary" }, + { 1, FALSE, "intrinsic_functions" }, + { 2, FALSE, "user_functions" } +}; +#define highlighting_properties_F77 EMPTY_PROPERTIES + + +/* Ferite */ +#define highlighting_lexer_FERITE SCLEX_CPP +#define highlighting_styles_FERITE highlighting_styles_C +static const HLKeyword highlighting_keywords_FERITE[] = +{ + { 0, FALSE, "primary" }, + { 1, FALSE, "types" }, + { 2, FALSE, "docComment" } +}; +#define highlighting_properties_FERITE highlighting_properties_C + + +/* Forth */ +#define highlighting_lexer_FORTH SCLEX_FORTH +static const HLStyle highlighting_styles_FORTH[] = +{ + { SCE_FORTH_DEFAULT, "default" }, + { SCE_FORTH_COMMENT, "comment" }, + { SCE_FORTH_COMMENT_ML, "commentml" }, + { SCE_FORTH_IDENTIFIER, "identifier" }, + { SCE_FORTH_CONTROL, "control" }, + { SCE_FORTH_KEYWORD, "keyword" }, + { SCE_FORTH_DEFWORD, "defword" }, + { SCE_FORTH_PREWORD1, "preword1" }, + { SCE_FORTH_PREWORD2, "preword2" }, + { SCE_FORTH_NUMBER, "number" }, + { SCE_FORTH_STRING, "string" }, + { SCE_FORTH_LOCALE, "locale" } +}; +static const HLKeyword highlighting_keywords_FORTH[] = +{ + { 0, FALSE, "primary" } +}; +#define highlighting_properties_FORTH EMPTY_PROPERTIES + + +/* Fortran */ +/* F77 and Fortran (F9x) uses different lexers but shares styles and keywords */ +#define highlighting_lexer_FORTRAN SCLEX_FORTRAN +#define highlighting_styles_FORTRAN highlighting_styles_F77 +#define highlighting_keywords_FORTRAN highlighting_keywords_F77 +#define highlighting_properties_FORTRAN highlighting_properties_F77 + + +/* Haskell */ +#define highlighting_lexer_HASKELL SCLEX_HASKELL +static const HLStyle highlighting_styles_HASKELL[] = +{ + { SCE_HA_DEFAULT, "default" }, + { SCE_HA_COMMENTLINE, "commentline" }, + { SCE_HA_COMMENTBLOCK, "commentblock" }, + { SCE_HA_COMMENTBLOCK2, "commentblock2" }, + { SCE_HA_COMMENTBLOCK3, "commentblock3" }, + { SCE_HA_NUMBER, "number" }, + { SCE_HA_KEYWORD, "keyword" }, + { SCE_HA_IMPORT, "import" }, + { SCE_HA_STRING, "string" }, + { SCE_HA_CHARACTER, "character" }, + { SCE_HA_CLASS, "class" }, + { SCE_HA_OPERATOR, "operator" }, + { SCE_HA_IDENTIFIER, "identifier" }, + { SCE_HA_INSTANCE, "instance" }, + { SCE_HA_CAPITAL, "capital" }, + { SCE_HA_MODULE, "module" }, + { SCE_HA_DATA, "data" } +}; +static const HLKeyword highlighting_keywords_HASKELL[] = +{ + { 0, FALSE, "keywords" } +}; +#define highlighting_properties_HASKELL EMPTY_PROPERTIES + + +/* HAXE */ +#define highlighting_lexer_HAXE SCLEX_CPP +#define highlighting_styles_HAXE highlighting_styles_C +static const HLKeyword highlighting_keywords_HAXE[] = +{ + { 0, FALSE, "primary" }, + { 1, FALSE, "secondary" }, + { 3, FALSE, "classes" } +}; +#define highlighting_properties_HAXE highlighting_properties_C + + +/* Java */ +#define highlighting_lexer_JAVA SCLEX_CPP +#define highlighting_styles_JAVA highlighting_styles_C +static const HLKeyword highlighting_keywords_JAVA[] = +{ + { 0, FALSE, "primary" }, + /* SCI_SETKEYWORDS = 1 - secondary + global tags file types, see below */ + { 1, TRUE, "secondary" }, + { 2, FALSE, "doccomment" }, + /* SCI_SETKEYWORDS = 3 is for current session types - see editor_lexer_get_type_keyword_idx() */ + { 4, FALSE, "typedefs" } +}; +#define highlighting_properties_JAVA highlighting_properties_C + + +/* JavaScript */ +#define highlighting_lexer_JS SCLEX_CPP +#define highlighting_styles_JS highlighting_styles_C +static const HLKeyword highlighting_keywords_JS[] = +{ + { 0, FALSE, "primary" }, + { 1, FALSE, "secondary" } +}; +#define highlighting_properties_JS highlighting_properties_C + + +/* LaTeX */ +#define highlighting_lexer_LATEX SCLEX_LATEX +static const HLStyle highlighting_styles_LATEX[] = +{ + { SCE_L_DEFAULT, "default" }, + { SCE_L_COMMAND, "command" }, + { SCE_L_TAG, "tag" }, + { SCE_L_MATH, "math" }, + { SCE_L_COMMENT, "comment" }, + { SCE_L_TAG2, "tag2" }, + { SCE_L_MATH2, "math2" }, + { SCE_L_COMMENT2, "comment2" }, + { SCE_L_VERBATIM, "verbatim" }, + { SCE_L_SHORTCMD, "shortcmd" }, + { SCE_L_SPECIAL, "special" }, + { SCE_L_CMDOPT, "cmdopt" }, + { SCE_L_ERROR, "error" } +}; +static const HLKeyword highlighting_keywords_LATEX[] = +{ + { 0, FALSE, "primary" } +}; +#define highlighting_properties_LATEX EMPTY_PROPERTIES + + +/* Lisp */ +#define highlighting_lexer_LISP SCLEX_LISP +static const HLStyle highlighting_styles_LISP[] = +{ + { SCE_LISP_DEFAULT, "default" }, + { SCE_LISP_COMMENT, "comment" }, + { SCE_LISP_MULTI_COMMENT, "multicomment" }, + { SCE_LISP_NUMBER, "number" }, + { SCE_LISP_KEYWORD, "keyword" }, + { SCE_LISP_SYMBOL, "symbol" }, + { SCE_LISP_STRING, "string" }, + { SCE_LISP_STRINGEOL, "stringeol" }, + { SCE_LISP_IDENTIFIER, "identifier" }, + { SCE_LISP_OPERATOR, "operator" }, + { SCE_LISP_SPECIAL, "special" }, + { SCE_LISP_KEYWORD_KW, "keywordkw" } +}; +static const HLKeyword highlighting_keywords_LISP[] = +{ + { 0, FALSE, "keywords" }, + { 1, FALSE, "special_keywords" } +}; +#define highlighting_properties_LISP EMPTY_PROPERTIES + + +/* Lua */ +#define highlighting_lexer_LUA SCLEX_LUA +static const HLStyle highlighting_styles_LUA[] = +{ + { SCE_LUA_DEFAULT, "default" }, + { SCE_LUA_COMMENT, "comment" }, + { SCE_LUA_COMMENTLINE, "commentline" }, + { SCE_LUA_COMMENTDOC, "commentdoc" }, + { SCE_LUA_NUMBER, "number" }, + { SCE_LUA_WORD, "word" }, + { SCE_LUA_STRING, "string" }, + { SCE_LUA_CHARACTER, "character" }, + { SCE_LUA_LITERALSTRING, "literalstring" }, + { SCE_LUA_PREPROCESSOR, "preprocessor" }, + { SCE_LUA_OPERATOR, "operator" }, + { SCE_LUA_IDENTIFIER, "identifier" }, + { SCE_LUA_STRINGEOL, "stringeol" }, + { SCE_LUA_WORD2, "function_basic" }, + { SCE_LUA_WORD3, "function_other" }, + { SCE_LUA_WORD4, "coroutines" }, + { SCE_LUA_WORD5, "word5" }, + { SCE_LUA_WORD6, "word6" }, + { SCE_LUA_WORD7, "word7" }, + { SCE_LUA_WORD8, "word8" }, + { SCE_LUA_LABEL, "label" } +}; +static const HLKeyword highlighting_keywords_LUA[] = +{ + { 0, FALSE, "keywords" }, + { 1, FALSE, "function_basic" }, + { 2, FALSE, "function_other" }, + { 3, FALSE, "coroutines" }, + { 4, FALSE, "user1" }, + { 5, FALSE, "user2" }, + { 6, FALSE, "user3" }, + { 7, FALSE, "user4" } +}; +#define highlighting_properties_LUA EMPTY_PROPERTIES + + +/* Makefile */ +#define highlighting_lexer_MAKE SCLEX_MAKEFILE +static const HLStyle highlighting_styles_MAKE[] = +{ + { SCE_MAKE_DEFAULT, "default" }, + { SCE_MAKE_COMMENT, "comment" }, + { SCE_MAKE_PREPROCESSOR, "preprocessor" }, + { SCE_MAKE_IDENTIFIER, "identifier" }, + { SCE_MAKE_OPERATOR, "operator" }, + { SCE_MAKE_TARGET, "target" }, + { SCE_MAKE_IDEOL, "ideol" } +}; +#define highlighting_keywords_MAKE EMPTY_KEYWORDS +#define highlighting_properties_MAKE EMPTY_PROPERTIES + + +/* Markdown */ +#define highlighting_lexer_MARKDOWN SCLEX_MARKDOWN +static const HLStyle highlighting_styles_MARKDOWN[] = +{ + { SCE_MARKDOWN_DEFAULT, "default" }, + { SCE_MARKDOWN_LINE_BEGIN, "default" }, /* FIXME: avoid in-code re-mappings */ + { SCE_MARKDOWN_PRECHAR, "default" }, + { SCE_MARKDOWN_STRONG1, "strong" }, + { SCE_MARKDOWN_STRONG2, "strong" }, + { SCE_MARKDOWN_EM1, "emphasis" }, + { SCE_MARKDOWN_EM2, "emphasis" }, + { SCE_MARKDOWN_HEADER1, "header1" }, + { SCE_MARKDOWN_HEADER2, "header2" }, + { SCE_MARKDOWN_HEADER3, "header3" }, + { SCE_MARKDOWN_HEADER4, "header4" }, + { SCE_MARKDOWN_HEADER5, "header5" }, + { SCE_MARKDOWN_HEADER6, "header6" }, + { SCE_MARKDOWN_ULIST_ITEM, "ulist_item" }, + { SCE_MARKDOWN_OLIST_ITEM, "olist_item" }, + { SCE_MARKDOWN_BLOCKQUOTE, "blockquote" }, + { SCE_MARKDOWN_STRIKEOUT, "strikeout" }, + { SCE_MARKDOWN_HRULE, "hrule" }, + { SCE_MARKDOWN_LINK, "link" }, + { SCE_MARKDOWN_CODE, "code" }, + { SCE_MARKDOWN_CODE2, "code" }, + { SCE_MARKDOWN_CODEBK, "codebk" } +}; +#define highlighting_keywords_MARKDOWN EMPTY_KEYWORDS +#define highlighting_properties_MARKDOWN EMPTY_PROPERTIES + + +/* Matlab */ +#define highlighting_lexer_MATLAB SCLEX_OCTAVE /* not MATLAB to support Octave's # comments */ +static const HLStyle highlighting_styles_MATLAB[] = +{ + { SCE_MATLAB_DEFAULT, "default" }, + { SCE_MATLAB_COMMENT, "comment" }, + { SCE_MATLAB_COMMAND, "command" }, + { SCE_MATLAB_NUMBER, "number" }, + { SCE_MATLAB_KEYWORD, "keyword" }, + { SCE_MATLAB_STRING, "string" }, + { SCE_MATLAB_OPERATOR, "operator" }, + { SCE_MATLAB_IDENTIFIER, "identifier" }, + { SCE_MATLAB_DOUBLEQUOTESTRING, "doublequotedstring" } +}; +static const HLKeyword highlighting_keywords_MATLAB[] = +{ + { 0, FALSE, "primary" } +}; +#define highlighting_properties_MATLAB EMPTY_PROPERTIES + + +/* NSIS */ +#define highlighting_lexer_NSIS SCLEX_NSIS +static const HLStyle highlighting_styles_NSIS[] = +{ + { SCE_NSIS_DEFAULT, "default" }, + { SCE_NSIS_COMMENT, "comment" }, + { SCE_NSIS_STRINGDQ, "stringdq" }, + { SCE_NSIS_STRINGLQ, "stringlq" }, + { SCE_NSIS_STRINGRQ, "stringrq" }, + { SCE_NSIS_FUNCTION, "function" }, + { SCE_NSIS_VARIABLE, "variable" }, + { SCE_NSIS_LABEL, "label" }, + { SCE_NSIS_USERDEFINED, "userdefined" }, + { SCE_NSIS_SECTIONDEF, "sectiondef" }, + { SCE_NSIS_SUBSECTIONDEF, "subsectiondef" }, + { SCE_NSIS_IFDEFINEDEF, "ifdefinedef" }, + { SCE_NSIS_MACRODEF, "macrodef" }, + { SCE_NSIS_STRINGVAR, "stringvar" }, + { SCE_NSIS_NUMBER, "number" }, + { SCE_NSIS_SECTIONGROUP, "sectiongroup" }, + { SCE_NSIS_PAGEEX, "pageex" }, + { SCE_NSIS_FUNCTIONDEF, "functiondef" }, + { SCE_NSIS_COMMENTBOX, "commentbox" } +}; +static const HLKeyword highlighting_keywords_NSIS[] = +{ + { 0, FALSE, "functions" }, + { 1, FALSE, "variables" }, + { 2, FALSE, "lables" }, + { 3, FALSE, "userdefined" } +}; +#define highlighting_properties_NSIS EMPTY_PROPERTIES + + +/* Pascal */ +#define highlighting_lexer_PASCAL SCLEX_PASCAL +static const HLStyle highlighting_styles_PASCAL[] = +{ + { SCE_PAS_DEFAULT, "default" }, + { SCE_PAS_IDENTIFIER, "identifier" }, + { SCE_PAS_COMMENT, "comment" }, + { SCE_PAS_COMMENT2, "comment2" }, + { SCE_PAS_COMMENTLINE, "commentline" }, + { SCE_PAS_PREPROCESSOR, "preprocessor" }, + { SCE_PAS_PREPROCESSOR2, "preprocessor2" }, + { SCE_PAS_NUMBER, "number" }, + { SCE_PAS_HEXNUMBER, "hexnumber" }, + { SCE_PAS_WORD, "word" }, + { SCE_PAS_STRING, "string" }, + { SCE_PAS_STRINGEOL, "stringeol" }, + { SCE_PAS_CHARACTER, "character" }, + { SCE_PAS_OPERATOR, "operator" }, + { SCE_PAS_ASM, "asm" } +}; +static const HLKeyword highlighting_keywords_PASCAL[] = +{ + { 0, FALSE, "primary" } +}; +#define highlighting_properties_PASCAL EMPTY_PROPERTIES + + +/* Perl */ +#define highlighting_lexer_PERL SCLEX_PERL +static const HLStyle highlighting_styles_PERL[] = +{ + { SCE_PL_DEFAULT, "default" }, + { SCE_PL_ERROR, "error" }, + { SCE_PL_COMMENTLINE, "commentline" }, + { SCE_PL_NUMBER, "number" }, + { SCE_PL_WORD, "word" }, + { SCE_PL_STRING, "string" }, + { SCE_PL_CHARACTER, "character" }, + { SCE_PL_PREPROCESSOR, "preprocessor" }, + { SCE_PL_OPERATOR, "operator" }, + { SCE_PL_IDENTIFIER, "identifier" }, + { SCE_PL_SCALAR, "scalar" }, + { SCE_PL_POD, "pod" }, + { SCE_PL_REGEX, "regex" }, + { SCE_PL_ARRAY, "array" }, + { SCE_PL_HASH, "hash" }, + { SCE_PL_SYMBOLTABLE, "symboltable" }, + { SCE_PL_BACKTICKS, "backticks" }, + { SCE_PL_POD_VERB, "pod_verbatim" }, + { SCE_PL_REGSUBST, "reg_subst" }, + { SCE_PL_DATASECTION, "datasection" }, + { SCE_PL_HERE_DELIM, "here_delim" }, + { SCE_PL_HERE_Q, "here_q" }, + { SCE_PL_HERE_QQ, "here_qq" }, + { SCE_PL_HERE_QX, "here_qx" }, + { SCE_PL_STRING_Q, "string_q" }, + { SCE_PL_STRING_QQ, "string_qq" }, + { SCE_PL_STRING_QX, "string_qx" }, + { SCE_PL_STRING_QR, "string_qr" }, + { SCE_PL_STRING_QW, "string_qw" }, + { SCE_PL_VARIABLE_INDEXER, "variable_indexer" }, + { SCE_PL_PUNCTUATION, "punctuation" }, + { SCE_PL_LONGQUOTE, "longquote" }, + { SCE_PL_SUB_PROTOTYPE, "sub_prototype" }, + { SCE_PL_FORMAT_IDENT, "format_ident" }, + { SCE_PL_FORMAT, "format" }, + { SCE_PL_STRING_VAR, "string_var" }, + { SCE_PL_XLAT, "xlat" }, + { SCE_PL_REGEX_VAR, "regex_var" }, + { SCE_PL_REGSUBST_VAR, "regsubst_var" }, + { SCE_PL_BACKTICKS_VAR, "backticks_var" }, + { SCE_PL_HERE_QQ_VAR, "here_qq_var" }, + { SCE_PL_HERE_QX_VAR, "here_qx_var" }, + { SCE_PL_STRING_QQ_VAR, "string_qq_var" }, + { SCE_PL_STRING_QX_VAR, "string_qx_var" }, + { SCE_PL_STRING_QR_VAR, "string_qr_var" } +}; +static const HLKeyword highlighting_keywords_PERL[] = +{ + { 0, FALSE, "primary" } +}; +#define highlighting_properties_PERL EMPTY_PROPERTIES + + +/* PO (gettext) */ +#define highlighting_lexer_PO SCLEX_PO +static const HLStyle highlighting_styles_PO[] = +{ + { SCE_PO_DEFAULT, "default" }, + { SCE_PO_COMMENT, "comment" }, + { SCE_PO_MSGID, "msgid" }, + { SCE_PO_MSGID_TEXT, "msgid_text" }, + { SCE_PO_MSGSTR, "msgstr" }, + { SCE_PO_MSGSTR_TEXT, "msgstr_text" }, + { SCE_PO_MSGCTXT, "msgctxt" }, + { SCE_PO_MSGCTXT_TEXT, "msgctxt_text" }, + { SCE_PO_FUZZY, "fuzzy" } +}; +#define highlighting_keywords_PO EMPTY_KEYWORDS +#define highlighting_properties_PO EMPTY_PROPERTIES + + +/* Python */ +#define highlighting_lexer_PYTHON SCLEX_PYTHON +static const HLStyle highlighting_styles_PYTHON[] = +{ + { SCE_P_DEFAULT, "default" }, + { SCE_P_COMMENTLINE, "commentline" }, + { SCE_P_NUMBER, "number" }, + { SCE_P_STRING, "string" }, + { SCE_P_CHARACTER, "character" }, + { SCE_P_WORD, "word" }, + { SCE_P_TRIPLE, "triple" }, + { SCE_P_TRIPLEDOUBLE, "tripledouble" }, + { SCE_P_CLASSNAME, "classname" }, + { SCE_P_DEFNAME, "defname" }, + { SCE_P_OPERATOR, "operator" }, + { SCE_P_IDENTIFIER, "identifier" }, + { SCE_P_COMMENTBLOCK, "commentblock" }, + { SCE_P_STRINGEOL, "stringeol" }, + { SCE_P_WORD2, "word2" }, + { SCE_P_DECORATOR, "decorator" } +}; +static const HLKeyword highlighting_keywords_PYTHON[] = +{ + { 0, FALSE, "primary" }, + { 1, FALSE, "identifiers" } +}; +#define highlighting_properties_PYTHON EMPTY_PROPERTIES + + +/* R */ +#define highlighting_lexer_R SCLEX_R +static const HLStyle highlighting_styles_R[] = +{ + { SCE_R_DEFAULT, "default" }, + { SCE_R_COMMENT, "comment" }, + { SCE_R_KWORD, "kword" }, + { SCE_R_OPERATOR, "operator" }, + { SCE_R_BASEKWORD, "basekword" }, + { SCE_R_OTHERKWORD, "otherkword" }, + { SCE_R_NUMBER, "number" }, + { SCE_R_STRING, "string" }, + { SCE_R_STRING2, "string2" }, + { SCE_R_IDENTIFIER, "identifier" }, + { SCE_R_INFIX, "infix" }, + { SCE_R_INFIXEOL, "infixeol" } +}; +static const HLKeyword highlighting_keywords_R[] = +{ + { 0, FALSE, "primary" }, + { 1, FALSE, "package" }, + { 2, FALSE, "package_other" } +}; +#define highlighting_properties_R EMPTY_PROPERTIES + + +/* Ruby */ +#define highlighting_lexer_RUBY SCLEX_RUBY +static const HLStyle highlighting_styles_RUBY[] = +{ + { SCE_RB_DEFAULT, "default" }, + { SCE_RB_COMMENTLINE, "commentline" }, + { SCE_RB_NUMBER, "number" }, + { SCE_RB_STRING, "string" }, + { SCE_RB_CHARACTER, "character" }, + { SCE_RB_WORD, "word" }, + { SCE_RB_GLOBAL, "global" }, + { SCE_RB_SYMBOL, "symbol" }, + { SCE_RB_CLASSNAME, "classname" }, + { SCE_RB_DEFNAME, "defname" }, + { SCE_RB_OPERATOR, "operator" }, + { SCE_RB_IDENTIFIER, "identifier" }, + { SCE_RB_MODULE_NAME, "modulename" }, + { SCE_RB_BACKTICKS, "backticks" }, + { SCE_RB_INSTANCE_VAR, "instancevar" }, + { SCE_RB_CLASS_VAR, "classvar" }, + { SCE_RB_DATASECTION, "datasection" }, + { SCE_RB_HERE_DELIM, "heredelim" }, + { SCE_RB_WORD_DEMOTED, "worddemoted" }, + { SCE_RB_STDIN, "stdin" }, + { SCE_RB_STDOUT, "stdout" }, + { SCE_RB_STDERR, "stderr" }, + { SCE_RB_REGEX, "regex" }, + { SCE_RB_HERE_Q, "here_q" }, + { SCE_RB_HERE_QQ, "here_qq" }, + { SCE_RB_HERE_QX, "here_qx" }, + { SCE_RB_STRING_Q, "string_q" }, + { SCE_RB_STRING_QQ, "string_qq" }, + { SCE_RB_STRING_QX, "string_qx" }, + { SCE_RB_STRING_QR, "string_qr" }, + { SCE_RB_STRING_QW, "string_qw" }, + { SCE_RB_UPPER_BOUND, "upper_bound" }, + { SCE_RB_ERROR, "error" }, + { SCE_RB_POD, "pod" } +}; +static const HLKeyword highlighting_keywords_RUBY[] = +{ + { 0, FALSE, "primary" } +}; +#define highlighting_properties_RUBY EMPTY_PROPERTIES + + +/* SH */ +#define highlighting_lexer_SH SCLEX_BASH +static const HLStyle highlighting_styles_SH[] = +{ + { SCE_SH_DEFAULT, "default" }, + { SCE_SH_COMMENTLINE, "commentline" }, + { SCE_SH_NUMBER, "number" }, + { SCE_SH_WORD, "word" }, + { SCE_SH_STRING, "string" }, + { SCE_SH_CHARACTER, "character" }, + { SCE_SH_OPERATOR, "operator" }, + { SCE_SH_IDENTIFIER, "identifier" }, + { SCE_SH_BACKTICKS, "backticks" }, + { SCE_SH_PARAM, "param" }, + { SCE_SH_SCALAR, "scalar" }, + { SCE_SH_ERROR, "error" }, + { SCE_SH_HERE_DELIM, "here_delim" }, + { SCE_SH_HERE_Q, "here_q" } +}; +static const HLKeyword highlighting_keywords_SH[] = +{ + { 0, FALSE, "primary" } +}; +#define highlighting_properties_SH EMPTY_PROPERTIES + + +/* SQL */ +#define highlighting_lexer_SQL SCLEX_SQL +static const HLStyle highlighting_styles_SQL[] = +{ + { SCE_SQL_DEFAULT, "default" }, + { SCE_SQL_COMMENT, "comment" }, + { SCE_SQL_COMMENTLINE, "commentline" }, + { SCE_SQL_COMMENTDOC, "commentdoc" }, + { SCE_SQL_COMMENTLINEDOC, "commentlinedoc" }, + { SCE_SQL_COMMENTDOCKEYWORD, "commentdockeyword" }, + { SCE_SQL_COMMENTDOCKEYWORDERROR, "commentdockeyworderror" }, + { SCE_SQL_NUMBER, "number" }, + { SCE_SQL_WORD, "word" }, + { SCE_SQL_WORD2, "word2" }, + { SCE_SQL_STRING, "string" }, + { SCE_SQL_CHARACTER, "character" }, + { SCE_SQL_OPERATOR, "operator" }, + { SCE_SQL_IDENTIFIER, "identifier" }, + { SCE_SQL_SQLPLUS, "sqlplus" }, + { SCE_SQL_SQLPLUS_PROMPT, "sqlplus_prompt" }, + { SCE_SQL_SQLPLUS_COMMENT, "sqlplus_comment" }, + { SCE_SQL_QUOTEDIDENTIFIER, "quotedidentifier" } + /* these are for user-defined keywords we don't set yet */ + /*{ SCE_SQL_USER1, "user1" }, + { SCE_SQL_USER2, "user2" }, + { SCE_SQL_USER3, "user3" }, + { SCE_SQL_USER4, "user4" }*/ +}; +static const HLKeyword highlighting_keywords_SQL[] = +{ + { 0, FALSE, "keywords" } +}; +#define highlighting_properties_SQL EMPTY_PROPERTIES + + +/* TCL */ +#define highlighting_lexer_TCL SCLEX_TCL +static const HLStyle highlighting_styles_TCL[] = +{ + { SCE_TCL_DEFAULT, "default" }, + { SCE_TCL_COMMENT, "comment" }, + { SCE_TCL_COMMENTLINE, "commentline" }, + { SCE_TCL_NUMBER, "number" }, + { SCE_TCL_OPERATOR, "operator" }, + { SCE_TCL_IDENTIFIER, "identifier" }, + { SCE_TCL_WORD_IN_QUOTE, "wordinquote" }, + { SCE_TCL_IN_QUOTE, "inquote" }, + { SCE_TCL_SUBSTITUTION, "substitution" }, + { SCE_TCL_MODIFIER, "modifier" }, + { SCE_TCL_EXPAND, "expand" }, + { SCE_TCL_WORD, "wordtcl" }, + { SCE_TCL_WORD2, "wordtk" }, + { SCE_TCL_WORD3, "worditcl" }, + { SCE_TCL_WORD4, "wordtkcmds" }, + { SCE_TCL_WORD5, "wordexpand" }, + { SCE_TCL_COMMENT_BOX, "commentbox" }, + { SCE_TCL_BLOCK_COMMENT, "blockcomment" } + /* these are for user-defined keywords we don't set yet */ + /*{ SCE_TCL_WORD6, "user2" }, + { SCE_TCL_WORD7, "user3" }, + { SCE_TCL_WORD8, "user4" }*/ +}; +static const HLKeyword highlighting_keywords_TCL[] = +{ + { 0, FALSE, "tcl" }, + { 1, FALSE, "tk" }, + { 2, FALSE, "itcl" }, + { 3, FALSE, "tkcommands" }, + { 4, FALSE, "expand" } +}; +#define highlighting_properties_TCL EMPTY_PROPERTIES + + +/* Txt2Tags */ +#define highlighting_lexer_TXT2TAGS SCLEX_TXT2TAGS +static const HLStyle highlighting_styles_TXT2TAGS[] = +{ + { SCE_TXT2TAGS_DEFAULT, "default" }, + { SCE_TXT2TAGS_LINE_BEGIN, "default" }, /* XIFME: remappings should be avoided */ + { SCE_TXT2TAGS_PRECHAR, "default" }, + { SCE_TXT2TAGS_STRONG1, "strong" }, + { SCE_TXT2TAGS_STRONG2, "strong" }, + { SCE_TXT2TAGS_EM1, "emphasis" }, + { SCE_TXT2TAGS_EM2, "underlined" }, /* WTF? */ + { SCE_TXT2TAGS_HEADER1, "header1" }, + { SCE_TXT2TAGS_HEADER2, "header2" }, + { SCE_TXT2TAGS_HEADER3, "header3" }, + { SCE_TXT2TAGS_HEADER4, "header4" }, + { SCE_TXT2TAGS_HEADER5, "header5" }, + { SCE_TXT2TAGS_HEADER6, "header6" }, + { SCE_TXT2TAGS_ULIST_ITEM, "ulist_item" }, + { SCE_TXT2TAGS_OLIST_ITEM, "olist_item" }, + { SCE_TXT2TAGS_BLOCKQUOTE, "blockquote" }, + { SCE_TXT2TAGS_STRIKEOUT, "strikeout" }, + { SCE_TXT2TAGS_HRULE, "hrule" }, + { SCE_TXT2TAGS_LINK, "link" }, + { SCE_TXT2TAGS_CODE, "code" }, + { SCE_TXT2TAGS_CODE2, "code" }, + { SCE_TXT2TAGS_CODEBK, "codebk" }, + { SCE_TXT2TAGS_COMMENT, "comment" }, + { SCE_TXT2TAGS_OPTION, "option" }, + { SCE_TXT2TAGS_PREPROC, "preproc" }, + { SCE_TXT2TAGS_POSTPROC, "postproc" } +}; +#define highlighting_keywords_TXT2TAGS EMPTY_KEYWORDS +#define highlighting_properties_TXT2TAGS EMPTY_PROPERTIES + + +/* VHDL */ +#define highlighting_lexer_VHDL SCLEX_VHDL +static const HLStyle highlighting_styles_VHDL[] = +{ + { SCE_VHDL_DEFAULT, "default" }, + { SCE_VHDL_COMMENT, "comment" }, + { SCE_VHDL_COMMENTLINEBANG, "comment_line_bang" }, + { SCE_VHDL_NUMBER, "number" }, + { SCE_VHDL_STRING, "string" }, + { SCE_VHDL_OPERATOR, "operator" }, + { SCE_VHDL_IDENTIFIER, "identifier" }, + { SCE_VHDL_STRINGEOL, "stringeol" }, + { SCE_VHDL_KEYWORD, "keyword" }, + { SCE_VHDL_STDOPERATOR, "stdoperator" }, + { SCE_VHDL_ATTRIBUTE, "attribute" }, + { SCE_VHDL_STDFUNCTION, "stdfunction" }, + { SCE_VHDL_STDPACKAGE, "stdpackage" }, + { SCE_VHDL_STDTYPE, "stdtype" }, + { SCE_VHDL_USERWORD, "userword" } +}; +static const HLKeyword highlighting_keywords_VHDL[] = +{ + { 0, FALSE, "keywords" }, + { 1, FALSE, "operators" }, + { 2, FALSE, "attributes" }, + { 3, FALSE, "std_functions" }, + { 4, FALSE, "std_packages" }, + { 5, FALSE, "std_types" }, + { 6, FALSE, "userwords" }, +}; +#define highlighting_properties_VHDL EMPTY_PROPERTIES + + +/* Verilog */ +#define highlighting_lexer_VERILOG SCLEX_VERILOG +static const HLStyle highlighting_styles_VERILOG[] = +{ + { SCE_V_DEFAULT, "default" }, + { SCE_V_COMMENT, "comment" }, + { SCE_V_COMMENTLINE, "comment_line" }, + { SCE_V_COMMENTLINEBANG, "comment_line_bang" }, + { SCE_V_NUMBER, "number" }, + { SCE_V_WORD, "word" }, + { SCE_V_STRING, "string" }, + { SCE_V_WORD2, "word2" }, + { SCE_V_WORD3, "word3" }, + { SCE_V_PREPROCESSOR, "preprocessor" }, + { SCE_V_OPERATOR, "operator" }, + { SCE_V_IDENTIFIER, "identifier" }, + { SCE_V_STRINGEOL, "stringeol" }, + { SCE_V_USER, "userword" } +}; +static const HLKeyword highlighting_keywords_VERILOG[] = +{ + { 0, FALSE, "word" }, + { 1, FALSE, "word2" }, + { 2, FALSE, "word3" } +}; +#define highlighting_properties_VERILOG EMPTY_PROPERTIES + + +/* YAML */ +#define highlighting_lexer_YAML SCLEX_YAML +static const HLStyle highlighting_styles_YAML[] = +{ + { SCE_YAML_DEFAULT, "default" }, + { SCE_YAML_COMMENT, "comment" }, + { SCE_YAML_IDENTIFIER, "identifier" }, + { SCE_YAML_KEYWORD, "keyword" }, + { SCE_YAML_NUMBER, "number" }, + { SCE_YAML_REFERENCE, "reference" }, + { SCE_YAML_DOCUMENT, "document" }, + { SCE_YAML_TEXT, "text" }, + { SCE_YAML_ERROR, "error" }, + { SCE_YAML_OPERATOR, "operator" } +}; +static const HLKeyword highlighting_keywords_YAML[] = +{ + { 0, FALSE, "keywords" } +}; +#define highlighting_properties_YAML EMPTY_PROPERTIES + + +#endif + From 1a91e53586cf814e8dc7dd1154cb14d95b392f61 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Tue, 8 Nov 2011 23:30:34 +0100 Subject: [PATCH 02/13] Rewrite two functions for better readability --- src/highlighting.c | 54 ++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/src/highlighting.c b/src/highlighting.c index 5d815921..58e7beab 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -796,51 +796,26 @@ apply_filetype_properties(ScintillaObject *sci, guint lexer, guint ft_id) } -/* styles: the HLStyle entries for the filetype. */ -static void load_style_entries_hlm(GKeyFile *config, GKeyFile *config_home, guint filetype_idx, - const HLStyle *styles, gsize n_styles) -{ - guint i; - - foreach_range(i, n_styles) - { - GeanyLexerStyle *style = &style_sets[filetype_idx].styling[i]; - - get_keyfile_style(config, config_home, styles[i].name, style); - } -} - - -/* styles: the style entries for the filetype. - * STYLE_DEFAULT will be set to match the first style. */ -static void apply_style_entries_hlm(ScintillaObject *sci, guint filetype_idx, - const HLStyle *styles, gsize n_styles) -{ - guint i; - - g_return_if_fail(n_styles > 0); - - set_sci_style(sci, STYLE_DEFAULT, filetype_idx, 0); - - foreach_range(i, n_styles) - set_sci_style(sci, styles[i].style, filetype_idx, i); -} - - static void styleset_init_from_mapping(guint ft_id, GKeyFile *config, GKeyFile *config_home, const HLStyle *styles, gsize n_styles, const HLKeyword *keywords, gsize n_keywords) { + gsize i; + /* styles */ new_styleset(ft_id, n_styles); - load_style_entries_hlm(config, config_home, ft_id, styles, n_styles); + foreach_range(i, n_styles) + { + GeanyLexerStyle *style = &style_sets[ft_id].styling[i]; + + get_keyfile_style(config, config_home, styles[i].name, style); + } + /* keywords */ if (n_keywords < 1) style_sets[ft_id].keywords = NULL; else { - gsize i; - style_sets[ft_id].keywords = g_new(gchar*, n_keywords + 1); foreach_range(i, n_keywords) get_keyfile_keywords(config, config_home, keywords[i].key, ft_id, i); @@ -857,6 +832,7 @@ static void styleset_init_from_mapping(guint ft_id, GKeyFile *config, GKeyFile * highlighting_keywords_##lang_name ? G_N_ELEMENTS(highlighting_keywords_##lang_name) : 0) +/* STYLE_DEFAULT will be set to match the first style. */ static void styleset_from_mapping(ScintillaObject *sci, guint ft_id, guint lexer, const HLStyle *styles, gsize n_styles, const HLKeyword *keywords, gsize n_keywords, @@ -866,7 +842,14 @@ static void styleset_from_mapping(ScintillaObject *sci, guint ft_id, guint lexer /* styles */ apply_filetype_properties(sci, lexer, ft_id); - apply_style_entries_hlm(sci, ft_id, styles, n_styles); + if (n_styles > 0) + { + /* first style is also default one */ + set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); + foreach_range(i, n_styles) + set_sci_style(sci, styles[i].style, ft_id, i); + } + /* keywords */ foreach_range(i, n_keywords) { @@ -875,6 +858,7 @@ static void styleset_from_mapping(ScintillaObject *sci, guint ft_id, guint lexer else sci_set_keywords(sci, keywords[i].id, style_sets[ft_id].keywords[i]); } + /* properties */ foreach_range(i, n_properties) sci_set_property(sci, properties[i].property, properties[i].value); From 80eeb484c696b3d8ae7f0ffb6cf7700b9503eeeb Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Tue, 8 Nov 2011 23:33:47 +0100 Subject: [PATCH 03/13] Remove lexer argument from STYLESET_FROM_MAPPING() --- src/highlighting.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/highlighting.c b/src/highlighting.c index 58e7beab..eb668683 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -865,8 +865,8 @@ static void styleset_from_mapping(ScintillaObject *sci, guint ft_id, guint lexer } -#define STYLESET_FROM_MAPPING(sci, ft_id, lexer, lang_name) \ - styleset_from_mapping(sci, ft_id, lexer, \ +#define STYLESET_FROM_MAPPING(sci, ft_id, lang_name) \ + styleset_from_mapping(sci, ft_id, highlighting_lexer_##lang_name, \ highlighting_styles_##lang_name, \ highlighting_styles_##lang_name ? G_N_ELEMENTS(highlighting_styles_##lang_name) : 0, \ highlighting_keywords_##lang_name, \ @@ -1394,7 +1394,7 @@ void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *co #define styleset_case_auto(LANG_NAME) \ case (GEANY_FILETYPES_##LANG_NAME): \ - STYLESET_FROM_MAPPING(sci, ft->id, highlighting_lexer_##LANG_NAME, LANG_NAME); \ + STYLESET_FROM_MAPPING(sci, ft->id, LANG_NAME); \ break /** Sets up highlighting and other visual settings. From 493b5284f71cd3b4d8777a3233c5d52363e329ac Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 9 Nov 2011 16:46:08 +0100 Subject: [PATCH 04/13] Remove some unnecessary initializers Leave some initialization to the implicit C initialization rules to have less unnecessary items in initializer lists --- src/highlightingmappings.h | 232 +++++++++++++++++++++---------------- 1 file changed, 130 insertions(+), 102 deletions(-) diff --git a/src/highlightingmappings.h b/src/highlightingmappings.h index b8d56b13..cfdb72bf 100644 --- a/src/highlightingmappings.h +++ b/src/highlightingmappings.h @@ -39,6 +39,34 @@ */ +/* + * Note about initializer lists below: + * + * Quoting C99 201x draft at 6.7.9§21: + * + * If there are fewer initializers in a brace-enclosed list than there are elements or + * members of an aggregate, or fewer characters in a string literal used to initialize + * an array of known size than there are elements in the array, the remainder of the + * aggregate shall be initialized implicitly the same as objects that have static + * storage duration. + * + * Which refers to 6.7.9§10: + * + * [...] If an object that has static or thread storage duration is not initialized + * explicitly, then: + * - if it has pointer type, it is initialized to a null pointer; + * - if it has arithmetic type, it is initialized to (positive or unsigned) zero; + * - if it is an aggregate, every member is initialized (recursively) according to + * these rules, and any padding is initialized to zero bits; + * - if it is a union, the first named member is initialized (recursively) according + * to these rules, and any padding is initialized to zero bits; + * + * We can then safely leave initializing of ending members to the implicit rules if we + * want them to be 0 (FALSE is 0, of course). This is used in the initializers below + * for better readability and smaller efforts. + */ + + /* first HLStyle array entry should always be the default style for that lexer */ typedef struct { @@ -49,8 +77,8 @@ typedef struct typedef struct { guint id; /* SCI keyword ID */ - gboolean merge; /* whether to merge with session types */ const gchar *key; /* keywords entry name in the filetypes.* file */ + gboolean merge; /* whether to merge with session types */ } HLKeyword; typedef struct @@ -83,7 +111,7 @@ static const HLStyle highlighting_styles_ADA[] = }; static const HLKeyword highlighting_keywords_ADA[] = { - { 0, FALSE, "primary" } + { 0, "primary" } }; #define highlighting_properties_ADA EMPTY_PROPERTIES @@ -93,9 +121,9 @@ static const HLKeyword highlighting_keywords_ADA[] = #define highlighting_styles_AS highlighting_styles_C static const HLKeyword highlighting_keywords_AS[] = { - { 0, FALSE, "primary" }, - { 1, FALSE, "secondary" }, - { 3, FALSE, "classes" } + { 0, "primary" }, + { 1, "secondary" }, + { 3, "classes" } }; #define highlighting_properties_AS highlighting_properties_C @@ -123,11 +151,11 @@ static const HLStyle highlighting_styles_ASM[] = }; static const HLKeyword highlighting_keywords_ASM[] = { - { 0, FALSE, "instructions" }, - /*{ 1, FALSE, "instructions" },*/ - { 2, FALSE, "registers" }, - { 3, FALSE, "directives" } - /*{ 5, FALSE, "instructions" }*/ + { 0, "instructions" }, + /*{ 1, "instructions" },*/ + { 2, "registers" }, + { 3, "directives" } + /*{ 5, "instructions" }*/ }; #define highlighting_properties_ASM EMPTY_PROPERTIES @@ -158,10 +186,10 @@ static const HLStyle highlighting_styles_BASIC[] = }; static const HLKeyword highlighting_keywords_BASIC[] = { - { 0, FALSE, "keywords" }, - { 1, FALSE, "preprocessor" }, - { 2, FALSE, "user1" }, - { 3, FALSE, "user2" } + { 0, "keywords" }, + { 1, "preprocessor" }, + { 2, "user1" }, + { 3, "user2" } }; #define highlighting_properties_BASIC EMPTY_PROPERTIES @@ -197,10 +225,10 @@ static const HLStyle highlighting_styles_C[] = }; static const HLKeyword highlighting_keywords_C[] = { - { 0, FALSE, "primary" }, + { 0, "primary" }, /* SCI_SETKEYWORDS = 1 - secondary + global tags file types, see below */ - { 1, TRUE, "secondary" }, - { 2, FALSE, "docComment" } + { 1, "secondary", TRUE }, + { 2, "docComment" } /* SCI_SETKEYWORDS = 3 is for current session types - see editor_lexer_get_type_keyword_idx() */ }; static const HLProperty highlighting_properties_C[] = @@ -232,8 +260,8 @@ static const HLStyle highlighting_styles_CAML[] = }; static const HLKeyword highlighting_keywords_CAML[] = { - { 0, FALSE, "keywords" }, - { 1, FALSE, "keywords_optional" } + { 0, "keywords" }, + { 1, "keywords_optional" } }; #define highlighting_properties_CAML EMPTY_PROPERTIES @@ -260,9 +288,9 @@ static const HLStyle highlighting_styles_CMAKE[] = }; static const HLKeyword highlighting_keywords_CMAKE[] = { - { 0, FALSE, "commands" }, - { 1, FALSE, "parameters" }, - { 2, FALSE, "userdefined" } + { 0, "commands" }, + { 1, "parameters" }, + { 2, "userdefined" } }; #define highlighting_properties_CMAKE EMPTY_PROPERTIES @@ -297,14 +325,14 @@ static const HLStyle highlighting_styles_CSS[] = }; static const HLKeyword highlighting_keywords_CSS[] = { - { 0, FALSE, "primary" }, - { 1, FALSE, "pseudoclasses" }, - { 2, FALSE, "secondary" }, - { 3, FALSE, "css3_properties" }, - { 4, FALSE, "pseudo_elements" }, - { 5, FALSE, "browser_css_properties" }, - { 6, FALSE, "browser_pseudo_classes" }, - { 7, FALSE, "browser_pseudo_elements" } + { 0, "primary" }, + { 1, "pseudoclasses" }, + { 2, "secondary" }, + { 3, "css3_properties" }, + { 4, "pseudo_elements" }, + { 5, "browser_css_properties" }, + { 6, "browser_pseudo_classes" }, + { 7, "browser_pseudo_elements" } }; #define highlighting_properties_CSS EMPTY_PROPERTIES @@ -314,9 +342,9 @@ static const HLKeyword highlighting_keywords_CSS[] = #define highlighting_styles_COBOL highlighting_styles_C static const HLKeyword highlighting_keywords_COBOL[] = { - { 0, FALSE, "primary" }, - { 1, FALSE, "secondary" }, - { 2, FALSE, "extended_keywords" } + { 0, "primary" }, + { 1, "secondary" }, + { 2, "extended_keywords" } }; #define highlighting_properties_COBOL highlighting_properties_C @@ -367,12 +395,12 @@ static const HLStyle highlighting_styles_D[] = }; static const HLKeyword highlighting_keywords_D[] = { - { 0, FALSE, "primary" }, + { 0, "primary" }, /* SCI_SETKEYWORDS = 1 - secondary + global tags file types */ - { 1, TRUE, "secondary" }, - { 2, FALSE, "docComment" }, + { 1, "secondary", TRUE }, + { 2, "docComment" }, /* SCI_SETKEYWORDS = 3 is for current session types - see editor_lexer_get_type_keyword_idx() */ - { 4, FALSE, "types" }, + { 4, "types" }, }; #define highlighting_properties_D EMPTY_PROPERTIES @@ -427,12 +455,12 @@ static const HLStyle highlighting_styles_ERLANG[] = }; static const HLKeyword highlighting_keywords_ERLANG[] = { - { 0, FALSE, "keywords" }, - { 1, FALSE, "bifs" }, - { 2, FALSE, "preproc" }, - { 3, FALSE, "module" }, - { 4, FALSE, "doc" }, - { 5, FALSE, "doc_macro" } + { 0, "keywords" }, + { 1, "bifs" }, + { 2, "preproc" }, + { 3, "module" }, + { 4, "doc" }, + { 5, "doc_macro" } }; #define highlighting_properties_ERLANG EMPTY_PROPERTIES @@ -459,9 +487,9 @@ static const HLStyle highlighting_styles_F77[] = }; static const HLKeyword highlighting_keywords_F77[] = { - { 0, FALSE, "primary" }, - { 1, FALSE, "intrinsic_functions" }, - { 2, FALSE, "user_functions" } + { 0, "primary" }, + { 1, "intrinsic_functions" }, + { 2, "user_functions" } }; #define highlighting_properties_F77 EMPTY_PROPERTIES @@ -471,9 +499,9 @@ static const HLKeyword highlighting_keywords_F77[] = #define highlighting_styles_FERITE highlighting_styles_C static const HLKeyword highlighting_keywords_FERITE[] = { - { 0, FALSE, "primary" }, - { 1, FALSE, "types" }, - { 2, FALSE, "docComment" } + { 0, "primary" }, + { 1, "types" }, + { 2, "docComment" } }; #define highlighting_properties_FERITE highlighting_properties_C @@ -497,7 +525,7 @@ static const HLStyle highlighting_styles_FORTH[] = }; static const HLKeyword highlighting_keywords_FORTH[] = { - { 0, FALSE, "primary" } + { 0, "primary" } }; #define highlighting_properties_FORTH EMPTY_PROPERTIES @@ -534,7 +562,7 @@ static const HLStyle highlighting_styles_HASKELL[] = }; static const HLKeyword highlighting_keywords_HASKELL[] = { - { 0, FALSE, "keywords" } + { 0, "keywords" } }; #define highlighting_properties_HASKELL EMPTY_PROPERTIES @@ -544,9 +572,9 @@ static const HLKeyword highlighting_keywords_HASKELL[] = #define highlighting_styles_HAXE highlighting_styles_C static const HLKeyword highlighting_keywords_HAXE[] = { - { 0, FALSE, "primary" }, - { 1, FALSE, "secondary" }, - { 3, FALSE, "classes" } + { 0, "primary" }, + { 1, "secondary" }, + { 3, "classes" } }; #define highlighting_properties_HAXE highlighting_properties_C @@ -556,12 +584,12 @@ static const HLKeyword highlighting_keywords_HAXE[] = #define highlighting_styles_JAVA highlighting_styles_C static const HLKeyword highlighting_keywords_JAVA[] = { - { 0, FALSE, "primary" }, + { 0, "primary" }, /* SCI_SETKEYWORDS = 1 - secondary + global tags file types, see below */ - { 1, TRUE, "secondary" }, - { 2, FALSE, "doccomment" }, + { 1, "secondary", TRUE }, + { 2, "doccomment" }, /* SCI_SETKEYWORDS = 3 is for current session types - see editor_lexer_get_type_keyword_idx() */ - { 4, FALSE, "typedefs" } + { 4, "typedefs" } }; #define highlighting_properties_JAVA highlighting_properties_C @@ -571,8 +599,8 @@ static const HLKeyword highlighting_keywords_JAVA[] = #define highlighting_styles_JS highlighting_styles_C static const HLKeyword highlighting_keywords_JS[] = { - { 0, FALSE, "primary" }, - { 1, FALSE, "secondary" } + { 0, "primary" }, + { 1, "secondary" } }; #define highlighting_properties_JS highlighting_properties_C @@ -597,7 +625,7 @@ static const HLStyle highlighting_styles_LATEX[] = }; static const HLKeyword highlighting_keywords_LATEX[] = { - { 0, FALSE, "primary" } + { 0, "primary" } }; #define highlighting_properties_LATEX EMPTY_PROPERTIES @@ -621,8 +649,8 @@ static const HLStyle highlighting_styles_LISP[] = }; static const HLKeyword highlighting_keywords_LISP[] = { - { 0, FALSE, "keywords" }, - { 1, FALSE, "special_keywords" } + { 0, "keywords" }, + { 1, "special_keywords" } }; #define highlighting_properties_LISP EMPTY_PROPERTIES @@ -655,14 +683,14 @@ static const HLStyle highlighting_styles_LUA[] = }; static const HLKeyword highlighting_keywords_LUA[] = { - { 0, FALSE, "keywords" }, - { 1, FALSE, "function_basic" }, - { 2, FALSE, "function_other" }, - { 3, FALSE, "coroutines" }, - { 4, FALSE, "user1" }, - { 5, FALSE, "user2" }, - { 6, FALSE, "user3" }, - { 7, FALSE, "user4" } + { 0, "keywords" }, + { 1, "function_basic" }, + { 2, "function_other" }, + { 3, "coroutines" }, + { 4, "user1" }, + { 5, "user2" }, + { 6, "user3" }, + { 7, "user4" } }; #define highlighting_properties_LUA EMPTY_PROPERTIES @@ -730,7 +758,7 @@ static const HLStyle highlighting_styles_MATLAB[] = }; static const HLKeyword highlighting_keywords_MATLAB[] = { - { 0, FALSE, "primary" } + { 0, "primary" } }; #define highlighting_properties_MATLAB EMPTY_PROPERTIES @@ -761,10 +789,10 @@ static const HLStyle highlighting_styles_NSIS[] = }; static const HLKeyword highlighting_keywords_NSIS[] = { - { 0, FALSE, "functions" }, - { 1, FALSE, "variables" }, - { 2, FALSE, "lables" }, - { 3, FALSE, "userdefined" } + { 0, "functions" }, + { 1, "variables" }, + { 2, "lables" }, + { 3, "userdefined" } }; #define highlighting_properties_NSIS EMPTY_PROPERTIES @@ -791,7 +819,7 @@ static const HLStyle highlighting_styles_PASCAL[] = }; static const HLKeyword highlighting_keywords_PASCAL[] = { - { 0, FALSE, "primary" } + { 0, "primary" } }; #define highlighting_properties_PASCAL EMPTY_PROPERTIES @@ -848,7 +876,7 @@ static const HLStyle highlighting_styles_PERL[] = }; static const HLKeyword highlighting_keywords_PERL[] = { - { 0, FALSE, "primary" } + { 0, "primary" } }; #define highlighting_properties_PERL EMPTY_PROPERTIES @@ -894,8 +922,8 @@ static const HLStyle highlighting_styles_PYTHON[] = }; static const HLKeyword highlighting_keywords_PYTHON[] = { - { 0, FALSE, "primary" }, - { 1, FALSE, "identifiers" } + { 0, "primary" }, + { 1, "identifiers" } }; #define highlighting_properties_PYTHON EMPTY_PROPERTIES @@ -919,9 +947,9 @@ static const HLStyle highlighting_styles_R[] = }; static const HLKeyword highlighting_keywords_R[] = { - { 0, FALSE, "primary" }, - { 1, FALSE, "package" }, - { 2, FALSE, "package_other" } + { 0, "primary" }, + { 1, "package" }, + { 2, "package_other" } }; #define highlighting_properties_R EMPTY_PROPERTIES @@ -967,7 +995,7 @@ static const HLStyle highlighting_styles_RUBY[] = }; static const HLKeyword highlighting_keywords_RUBY[] = { - { 0, FALSE, "primary" } + { 0, "primary" } }; #define highlighting_properties_RUBY EMPTY_PROPERTIES @@ -993,7 +1021,7 @@ static const HLStyle highlighting_styles_SH[] = }; static const HLKeyword highlighting_keywords_SH[] = { - { 0, FALSE, "primary" } + { 0, "primary" } }; #define highlighting_properties_SH EMPTY_PROPERTIES @@ -1028,7 +1056,7 @@ static const HLStyle highlighting_styles_SQL[] = }; static const HLKeyword highlighting_keywords_SQL[] = { - { 0, FALSE, "keywords" } + { 0, "keywords" } }; #define highlighting_properties_SQL EMPTY_PROPERTIES @@ -1062,11 +1090,11 @@ static const HLStyle highlighting_styles_TCL[] = }; static const HLKeyword highlighting_keywords_TCL[] = { - { 0, FALSE, "tcl" }, - { 1, FALSE, "tk" }, - { 2, FALSE, "itcl" }, - { 3, FALSE, "tkcommands" }, - { 4, FALSE, "expand" } + { 0, "tcl" }, + { 1, "tk" }, + { 2, "itcl" }, + { 3, "tkcommands" }, + { 4, "expand" } }; #define highlighting_properties_TCL EMPTY_PROPERTIES @@ -1128,13 +1156,13 @@ static const HLStyle highlighting_styles_VHDL[] = }; static const HLKeyword highlighting_keywords_VHDL[] = { - { 0, FALSE, "keywords" }, - { 1, FALSE, "operators" }, - { 2, FALSE, "attributes" }, - { 3, FALSE, "std_functions" }, - { 4, FALSE, "std_packages" }, - { 5, FALSE, "std_types" }, - { 6, FALSE, "userwords" }, + { 0, "keywords" }, + { 1, "operators" }, + { 2, "attributes" }, + { 3, "std_functions" }, + { 4, "std_packages" }, + { 5, "std_types" }, + { 6, "userwords" }, }; #define highlighting_properties_VHDL EMPTY_PROPERTIES @@ -1160,9 +1188,9 @@ static const HLStyle highlighting_styles_VERILOG[] = }; static const HLKeyword highlighting_keywords_VERILOG[] = { - { 0, FALSE, "word" }, - { 1, FALSE, "word2" }, - { 2, FALSE, "word3" } + { 0, "word" }, + { 1, "word2" }, + { 2, "word3" } }; #define highlighting_properties_VERILOG EMPTY_PROPERTIES @@ -1184,7 +1212,7 @@ static const HLStyle highlighting_styles_YAML[] = }; static const HLKeyword highlighting_keywords_YAML[] = { - { 0, FALSE, "keywords" } + { 0, "keywords" } }; #define highlighting_properties_YAML EMPTY_PROPERTIES From 69769e0edc3965af36fa47ed730200b963ac43ef Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 9 Nov 2011 17:14:05 +0100 Subject: [PATCH 05/13] Add support for EOLFILLED style flag --- src/highlighting.c | 4 ++++ src/highlightingmappings.h | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/highlighting.c b/src/highlighting.c index eb668683..352637a5 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -847,7 +847,11 @@ static void styleset_from_mapping(ScintillaObject *sci, guint ft_id, guint lexer /* first style is also default one */ set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); foreach_range(i, n_styles) + { + if (styles[i].fill_eol) + SSM(sci, SCI_STYLESETEOLFILLED, styles[i].style, TRUE); set_sci_style(sci, styles[i].style, ft_id, i); + } } /* keywords */ diff --git a/src/highlightingmappings.h b/src/highlightingmappings.h index cfdb72bf..8f61a678 100644 --- a/src/highlightingmappings.h +++ b/src/highlightingmappings.h @@ -70,8 +70,9 @@ /* first HLStyle array entry should always be the default style for that lexer */ typedef struct { - guint style; /* SCI style */ - const gchar *name; /* style name in the filetypes.* file */ + guint style; /* SCI style */ + const gchar *name; /* style name in the filetypes.* file */ + gboolean fill_eol; /* whether to set EOLFILLED flag to this style */ } HLStyle; typedef struct From 21e0c037da6ca4ab55619e8c0f531fb47392fd52 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 9 Nov 2011 17:14:48 +0100 Subject: [PATCH 06/13] Port DocBook filetype to new automated setup --- src/highlighting.c | 88 +------------------------------------- src/highlightingmappings.h | 41 ++++++++++++++++++ 2 files changed, 43 insertions(+), 86 deletions(-) diff --git a/src/highlighting.c b/src/highlighting.c index 352637a5..a5f0a516 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -1153,90 +1153,6 @@ static void styleset_xml(ScintillaObject *sci, guint ft_id) } -static void styleset_docbook_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(ft_id, 29); - get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]); - get_keyfile_style(config, config_home, "tag", &style_sets[ft_id].styling[1]); - get_keyfile_style(config, config_home, "tagunknown", &style_sets[ft_id].styling[2]); - get_keyfile_style(config, config_home, "attribute", &style_sets[ft_id].styling[3]); - get_keyfile_style(config, config_home, "attributeunknown", &style_sets[ft_id].styling[4]); - get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[5]); - get_keyfile_style(config, config_home, "doublestring", &style_sets[ft_id].styling[6]); - get_keyfile_style(config, config_home, "singlestring", &style_sets[ft_id].styling[7]); - get_keyfile_style(config, config_home, "other", &style_sets[ft_id].styling[8]); - get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[9]); - get_keyfile_style(config, config_home, "entity", &style_sets[ft_id].styling[10]); - get_keyfile_style(config, config_home, "tagend", &style_sets[ft_id].styling[11]); - get_keyfile_style(config, config_home, "xmlstart", &style_sets[ft_id].styling[12]); - get_keyfile_style(config, config_home, "xmlend", &style_sets[ft_id].styling[13]); - get_keyfile_style(config, config_home, "cdata", &style_sets[ft_id].styling[14]); - get_keyfile_style(config, config_home, "question", &style_sets[ft_id].styling[15]); - get_keyfile_style(config, config_home, "value", &style_sets[ft_id].styling[16]); - get_keyfile_style(config, config_home, "xccomment", &style_sets[ft_id].styling[17]); - get_keyfile_style(config, config_home, "sgml_default", &style_sets[ft_id].styling[18]); - get_keyfile_style(config, config_home, "sgml_comment", &style_sets[ft_id].styling[19]); - get_keyfile_style(config, config_home, "sgml_special", &style_sets[ft_id].styling[20]); - get_keyfile_style(config, config_home, "sgml_command", &style_sets[ft_id].styling[21]); - get_keyfile_style(config, config_home, "sgml_doublestring", &style_sets[ft_id].styling[22]); - get_keyfile_style(config, config_home, "sgml_simplestring", &style_sets[ft_id].styling[23]); - get_keyfile_style(config, config_home, "sgml_1st_param", &style_sets[ft_id].styling[24]); - get_keyfile_style(config, config_home, "sgml_entity", &style_sets[ft_id].styling[25]); - get_keyfile_style(config, config_home, "sgml_block_default", &style_sets[ft_id].styling[26]); - get_keyfile_style(config, config_home, "sgml_1st_param_comment", &style_sets[ft_id].styling[27]); - get_keyfile_style(config, config_home, "sgml_error", &style_sets[ft_id].styling[28]); - - style_sets[ft_id].keywords = g_new(gchar*, 3); - get_keyfile_keywords(config, config_home, "elements", ft_id, 0); - get_keyfile_keywords(config, config_home, "dtd", ft_id, 1); - style_sets[ft_id].keywords[2] = NULL; -} - - -static void styleset_docbook(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_XML, ft_id); - - sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]); - sci_set_keywords(sci, 5, style_sets[ft_id].keywords[1]); - - /* Unknown tags and attributes are highlighed in red. - * If a tag is actually OK, it should be added in lower case to the htmlKeyWords string. */ - - set_sci_style(sci, STYLE_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_H_DEFAULT, ft_id, 0); - set_sci_style(sci, SCE_H_TAG, ft_id, 1); - set_sci_style(sci, SCE_H_TAGUNKNOWN, ft_id, 2); - set_sci_style(sci, SCE_H_ATTRIBUTE, ft_id, 3); - set_sci_style(sci, SCE_H_ATTRIBUTEUNKNOWN, ft_id, 4); - set_sci_style(sci, SCE_H_NUMBER, ft_id, 5); - set_sci_style(sci, SCE_H_DOUBLESTRING, ft_id, 6); - set_sci_style(sci, SCE_H_SINGLESTRING, ft_id, 7); - set_sci_style(sci, SCE_H_OTHER, ft_id, 8); - set_sci_style(sci, SCE_H_COMMENT, ft_id, 9); - set_sci_style(sci, SCE_H_ENTITY, ft_id, 10); - set_sci_style(sci, SCE_H_TAGEND, ft_id, 11); - SSM(sci, SCI_STYLESETEOLFILLED, SCE_H_XMLSTART, 1); - set_sci_style(sci, SCE_H_XMLSTART, ft_id, 12); - set_sci_style(sci, SCE_H_XMLEND, ft_id, 13); - set_sci_style(sci, SCE_H_CDATA, ft_id, 14); - set_sci_style(sci, SCE_H_QUESTION, ft_id, 15); - set_sci_style(sci, SCE_H_VALUE, ft_id, 16); - set_sci_style(sci, SCE_H_XCCOMMENT, ft_id, 17); - set_sci_style(sci, SCE_H_SGML_DEFAULT, ft_id, 18); - set_sci_style(sci, SCE_H_DEFAULT, ft_id, 19); - set_sci_style(sci, SCE_H_SGML_SPECIAL, ft_id, 20); - set_sci_style(sci, SCE_H_SGML_COMMAND, ft_id, 21); - set_sci_style(sci, SCE_H_SGML_DOUBLESTRING, ft_id, 22); - set_sci_style(sci, SCE_H_SGML_SIMPLESTRING, ft_id, 23); - set_sci_style(sci, SCE_H_SGML_1ST_PARAM, ft_id, 24); - set_sci_style(sci, SCE_H_SGML_ENTITY, ft_id, 25); - set_sci_style(sci, SCE_H_SGML_BLOCK_DEFAULT, ft_id, 26); - set_sci_style(sci, SCE_H_SGML_1ST_PARAM_COMMENT, ft_id, 27); - set_sci_style(sci, SCE_H_SGML_ERROR, ft_id, 28); -} - - static void styleset_default(ScintillaObject *sci, guint ft_id) { SSM(sci, SCI_SETLEXER, SCLEX_NULL, 0); @@ -1347,7 +1263,7 @@ void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *co init_styleset_case_auto(DIFF); init_styleset_case_auto(LISP); init_styleset_case_auto(ERLANG); - init_styleset_case(GEANY_FILETYPES_DOCBOOK, styleset_docbook_init); + init_styleset_case_auto(DOCBOOK); init_styleset_case_auto(FERITE); init_styleset_case_auto(F77); init_styleset_case_auto(FORTH); @@ -1425,7 +1341,7 @@ void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft) styleset_case_auto(DIFF); styleset_case_auto(LISP); styleset_case_auto(ERLANG); - styleset_case(GEANY_FILETYPES_DOCBOOK, styleset_docbook); + styleset_case_auto(DOCBOOK); styleset_case_auto(FERITE); styleset_case_auto(F77); styleset_case_auto(FORTH); diff --git a/src/highlightingmappings.h b/src/highlightingmappings.h index 8f61a678..6e8c1c39 100644 --- a/src/highlightingmappings.h +++ b/src/highlightingmappings.h @@ -423,6 +423,47 @@ static const HLStyle highlighting_styles_DIFF[] = #define highlighting_properties_DIFF EMPTY_PROPERTIES +#define highlighting_lexer_DOCBOOK SCLEX_XML +static const HLStyle highlighting_styles_DOCBOOK[] = +{ + { SCE_H_DEFAULT, "default" }, + { SCE_H_TAG, "tag" }, + { SCE_H_TAGUNKNOWN, "tagunknown" }, + { SCE_H_ATTRIBUTE, "attribute" }, + { SCE_H_ATTRIBUTEUNKNOWN, "attributeunknown" }, + { SCE_H_NUMBER, "number" }, + { SCE_H_DOUBLESTRING, "doublestring" }, + { SCE_H_SINGLESTRING, "singlestring" }, + { SCE_H_OTHER, "other" }, + { SCE_H_COMMENT, "comment" }, + { SCE_H_ENTITY, "entity" }, + { SCE_H_TAGEND, "tagend" }, + { SCE_H_XMLSTART, "xmlstart", TRUE }, + { SCE_H_XMLEND, "xmlend" }, + { SCE_H_CDATA, "cdata" }, + { SCE_H_QUESTION, "question" }, + { SCE_H_VALUE, "value" }, + { SCE_H_XCCOMMENT, "xccomment" }, + { SCE_H_SGML_DEFAULT, "sgml_default" }, + { SCE_H_DEFAULT, "sgml_comment" }, + { SCE_H_SGML_SPECIAL, "sgml_special" }, + { SCE_H_SGML_COMMAND, "sgml_command" }, + { SCE_H_SGML_DOUBLESTRING, "sgml_doublestring" }, + { SCE_H_SGML_SIMPLESTRING, "sgml_simplestring" }, + { SCE_H_SGML_1ST_PARAM, "sgml_1st_param" }, + { SCE_H_SGML_ENTITY, "sgml_entity" }, + { SCE_H_SGML_BLOCK_DEFAULT, "sgml_block_default" }, + { SCE_H_SGML_1ST_PARAM_COMMENT, "sgml_1st_param_comment" }, + { SCE_H_SGML_ERROR, "sgml_error" } +}; +static const HLKeyword highlighting_keywords_DOCBOOK[] = +{ + { 0, "elements" }, + { 5, "dtd" } +}; +#define highlighting_properties_DOCBOOK EMPTY_PROPERTIES + + /* Erlang */ #define highlighting_lexer_ERLANG SCLEX_ERLANG static const HLStyle highlighting_styles_ERLANG[] = From 55edeb876d208fb05aefb0ebca5fdb434a1a9a72 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 9 Nov 2011 17:32:21 +0100 Subject: [PATCH 07/13] Fix a DocBook style mapping --- src/highlightingmappings.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/highlightingmappings.h b/src/highlightingmappings.h index 6e8c1c39..5d982ade 100644 --- a/src/highlightingmappings.h +++ b/src/highlightingmappings.h @@ -445,7 +445,7 @@ static const HLStyle highlighting_styles_DOCBOOK[] = { SCE_H_VALUE, "value" }, { SCE_H_XCCOMMENT, "xccomment" }, { SCE_H_SGML_DEFAULT, "sgml_default" }, - { SCE_H_DEFAULT, "sgml_comment" }, + { SCE_H_SGML_COMMENT, "sgml_comment" }, { SCE_H_SGML_SPECIAL, "sgml_special" }, { SCE_H_SGML_COMMAND, "sgml_command" }, { SCE_H_SGML_DOUBLESTRING, "sgml_doublestring" }, From ad1bc032ab58d5ec5f3b6751d3005f942ededcda Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 9 Nov 2011 22:50:26 +0100 Subject: [PATCH 08/13] Port XML, HTML and PHP filetypes to new automated setup This changes these three filetypes to "normal" ones rather than HTML and PHP being hard-coded together with XML. Now the definitions simply references each other and the filetypes.* files simply inherits styling and keywords from the appropriate filetype. This also makes these filetypes have their own Python styles like they had their own JavaScript ones, rather than trickily reference the Python ones. --- data/filetypes.html | 5 +- data/filetypes.php | 5 +- data/filetypes.xml | 14 ++ src/highlighting.c | 288 +------------------------------------ src/highlightingmappings.h | 164 +++++++++++++++++++++ 5 files changed, 190 insertions(+), 286 deletions(-) diff --git a/data/filetypes.html b/data/filetypes.html index 4a3f9d72..3cc9f7a5 100644 --- a/data/filetypes.html +++ b/data/filetypes.html @@ -1,6 +1,7 @@ # For complete documentation of this file, please see Geany's main documentation -[styling] -# styling for PHP/HTML is done in filetypes.xml +[styling=XML] + +[keywords=XML] [lexer_properties] # default scripting language for ASP diff --git a/data/filetypes.php b/data/filetypes.php index e3cc6145..f5713ca3 100644 --- a/data/filetypes.php +++ b/data/filetypes.php @@ -1,6 +1,7 @@ # For complete documentation of this file, please see Geany's main documentation -[styling] -# styling for PHP/HTML is done in filetypes.xml +[styling=XML] + +[keywords=XML] [lexer_properties] phpscript.mode=1 diff --git a/data/filetypes.xml b/data/filetypes.xml index 8582f551..710fab04 100644 --- a/data/filetypes.xml +++ b/data/filetypes.xml @@ -62,6 +62,20 @@ jscript_symbols=operator jscript_stringeol=string_eol jscript_regex=regex +python_default=default +python_commentline=comment_line +python_number=number_1 +python_string=string_1 +python_character=character +python_word=keyword_1 +python_triple=string_2 +python_tripledouble=string_2 +python_classname=type +python_defname=function +python_operator=operator +python_identifier=identifier_1 + + [keywords] html=a abbr acronym address applet area b base basefont bdo big blockquote body br button caption center cite code col colgroup dd del dfn dir div dl dt em embed fieldset font form frame frameset h1 h2 h3 h4 h5 h6 head hr html i iframe img input ins isindex kbd label legend li link map menu meta noframes noscript object ol optgroup option p param pre q quality s samp script select small span strike strong style sub sup table tbody td textarea tfoot th thead title tr tt u ul var xmlns leftmargin topmargin abbr accept-charset accept accesskey action align alink alt archive axis background bgcolor border cellpadding cellspacing char charoff charset checked cite class classid clear codebase codetype color cols colspan compact content coords data datafld dataformatas datapagesize datasrc datetime declare defer dir disabled enctype face for frame frameborder selected headers height href hreflang hspace http-equiv id ismap label lang language link longdesc marginwidth marginheight maxlength media framespacing method multiple name nohref noresize noshade nowrap object onblur onchange onclick ondblclick onfocus onkeydown onkeypress onkeyup onload onmousedown onmousemove onmouseover onmouseout onmouseup onreset onselect onsubmit onunload profile prompt pluginspage readonly rel rev rows rowspan rules scheme scope scrolling shape size span src standby start style summary tabindex target text title type usemap valign value valuetype version vlink vspace width text password checkbox radio submit reset file hidden image public doctype xml xml:lang article aside audio canvas command details datalist figure figcaption footer header hgroup keygen mark meter nav output progress section time video wbr async autocomplete autofocus contenteditable contextmenu draggable formaction formenctype formnovalidate formtarget list manifest max min novalidate pattern ping placeholder required reversed role sandbox scoped seamless sizes spellcheck srcdoc step ^data- ^aria- javascript=abs abstract acos anchor asin atan atan2 big bold boolean break byte case catch ceil char charAt charCodeAt class concat const continue cos Date debugger default delete do double else enum escape eval exp export extends false final finally fixed float floor fontcolor fontsize for fromCharCode function goto if implements import in indexOf Infinity instanceof int interface isFinite isNaN italics join lastIndexOf length link log long Math max MAX_VALUE min MIN_VALUE NaN native NEGATIVE_INFINITY new null Number package parseFloat parseInt pop POSITIVE_INFINITY pow private protected public push random return reverse round shift short sin slice small sort splice split sqrt static strike string String sub substr substring sup super switch synchronized tan this throw throws toLowerCase toString toUpperCase transient true try typeof undefined unescape unshift valueOf var void volatile while with diff --git a/src/highlighting.c b/src/highlighting.c index a5f0a516..3a272424 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -54,9 +54,6 @@ static gchar *whitespace_chars; -static void styleset_markup(ScintillaObject *sci, gboolean set_keywords); - - typedef struct { gsize count; /* number of styles */ @@ -879,279 +876,6 @@ static void styleset_from_mapping(ScintillaObject *sci, guint ft_id, guint lexer highlighting_properties_##lang_name ? G_N_ELEMENTS(highlighting_properties_##lang_name) : 0) -static void styleset_php_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - style_sets[ft_id].styling = NULL; - style_sets[ft_id].keywords = NULL; -} - - -static void styleset_php(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_HTML, ft_id); - - /* use the same colouring as for XML */ - styleset_markup(sci, TRUE); -} - - -static void styleset_html_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - style_sets[ft_id].styling = NULL; - style_sets[ft_id].keywords = NULL; -} - - -static void styleset_html(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_HTML, ft_id); - - /* use the same colouring for HTML; XML and so on */ - styleset_markup(sci, TRUE); -} - - -static void styleset_markup_init(guint ft_id, GKeyFile *config, GKeyFile *config_home) -{ - new_styleset(GEANY_FILETYPES_XML, 56); - get_keyfile_style(config, config_home, "html_default", &style_sets[GEANY_FILETYPES_XML].styling[0]); - get_keyfile_style(config, config_home, "html_tag", &style_sets[GEANY_FILETYPES_XML].styling[1]); - get_keyfile_style(config, config_home, "html_tagunknown", &style_sets[GEANY_FILETYPES_XML].styling[2]); - get_keyfile_style(config, config_home, "html_attribute", &style_sets[GEANY_FILETYPES_XML].styling[3]); - get_keyfile_style(config, config_home, "html_attributeunknown", &style_sets[GEANY_FILETYPES_XML].styling[4]); - get_keyfile_style(config, config_home, "html_number", &style_sets[GEANY_FILETYPES_XML].styling[5]); - get_keyfile_style(config, config_home, "html_doublestring", &style_sets[GEANY_FILETYPES_XML].styling[6]); - get_keyfile_style(config, config_home, "html_singlestring", &style_sets[GEANY_FILETYPES_XML].styling[7]); - get_keyfile_style(config, config_home, "html_other", &style_sets[GEANY_FILETYPES_XML].styling[8]); - get_keyfile_style(config, config_home, "html_comment", &style_sets[GEANY_FILETYPES_XML].styling[9]); - get_keyfile_style(config, config_home, "html_entity", &style_sets[GEANY_FILETYPES_XML].styling[10]); - get_keyfile_style(config, config_home, "html_tagend", &style_sets[GEANY_FILETYPES_XML].styling[11]); - get_keyfile_style(config, config_home, "html_xmlstart", &style_sets[GEANY_FILETYPES_XML].styling[12]); - get_keyfile_style(config, config_home, "html_xmlend", &style_sets[GEANY_FILETYPES_XML].styling[13]); - get_keyfile_style(config, config_home, "html_script", &style_sets[GEANY_FILETYPES_XML].styling[14]); - get_keyfile_style(config, config_home, "html_asp", &style_sets[GEANY_FILETYPES_XML].styling[15]); - get_keyfile_style(config, config_home, "html_aspat", &style_sets[GEANY_FILETYPES_XML].styling[16]); - get_keyfile_style(config, config_home, "html_cdata", &style_sets[GEANY_FILETYPES_XML].styling[17]); - get_keyfile_style(config, config_home, "html_question", &style_sets[GEANY_FILETYPES_XML].styling[18]); - get_keyfile_style(config, config_home, "html_value", &style_sets[GEANY_FILETYPES_XML].styling[19]); - get_keyfile_style(config, config_home, "html_xccomment", &style_sets[GEANY_FILETYPES_XML].styling[20]); - - get_keyfile_style(config, config_home, "sgml_default", &style_sets[GEANY_FILETYPES_XML].styling[21]); - get_keyfile_style(config, config_home, "sgml_comment", &style_sets[GEANY_FILETYPES_XML].styling[22]); - get_keyfile_style(config, config_home, "sgml_special", &style_sets[GEANY_FILETYPES_XML].styling[23]); - get_keyfile_style(config, config_home, "sgml_command", &style_sets[GEANY_FILETYPES_XML].styling[24]); - get_keyfile_style(config, config_home, "sgml_doublestring", &style_sets[GEANY_FILETYPES_XML].styling[25]); - get_keyfile_style(config, config_home, "sgml_simplestring", &style_sets[GEANY_FILETYPES_XML].styling[26]); - get_keyfile_style(config, config_home, "sgml_1st_param", &style_sets[GEANY_FILETYPES_XML].styling[27]); - get_keyfile_style(config, config_home, "sgml_entity", &style_sets[GEANY_FILETYPES_XML].styling[28]); - get_keyfile_style(config, config_home, "sgml_block_default", &style_sets[GEANY_FILETYPES_XML].styling[29]); - get_keyfile_style(config, config_home, "sgml_1st_param_comment", &style_sets[GEANY_FILETYPES_XML].styling[30]); - get_keyfile_style(config, config_home, "sgml_error", &style_sets[GEANY_FILETYPES_XML].styling[31]); - - get_keyfile_style(config, config_home, "php_default", &style_sets[GEANY_FILETYPES_XML].styling[32]); - get_keyfile_style(config, config_home, "php_simplestring", &style_sets[GEANY_FILETYPES_XML].styling[33]); - get_keyfile_style(config, config_home, "php_hstring", &style_sets[GEANY_FILETYPES_XML].styling[34]); - get_keyfile_style(config, config_home, "php_number", &style_sets[GEANY_FILETYPES_XML].styling[35]); - get_keyfile_style(config, config_home, "php_word", &style_sets[GEANY_FILETYPES_XML].styling[36]); - get_keyfile_style(config, config_home, "php_variable", &style_sets[GEANY_FILETYPES_XML].styling[37]); - get_keyfile_style(config, config_home, "php_comment", &style_sets[GEANY_FILETYPES_XML].styling[38]); - get_keyfile_style(config, config_home, "php_commentline", &style_sets[GEANY_FILETYPES_XML].styling[39]); - get_keyfile_style(config, config_home, "php_operator", &style_sets[GEANY_FILETYPES_XML].styling[40]); - get_keyfile_style(config, config_home, "php_hstring_variable", &style_sets[GEANY_FILETYPES_XML].styling[41]); - get_keyfile_style(config, config_home, "php_complex_variable", &style_sets[GEANY_FILETYPES_XML].styling[42]); - - get_keyfile_style(config, config_home, "jscript_start", &style_sets[GEANY_FILETYPES_XML].styling[43]); - get_keyfile_style(config, config_home, "jscript_default", &style_sets[GEANY_FILETYPES_XML].styling[44]); - get_keyfile_style(config, config_home, "jscript_comment", &style_sets[GEANY_FILETYPES_XML].styling[45]); - get_keyfile_style(config, config_home, "jscript_commentline", &style_sets[GEANY_FILETYPES_XML].styling[46]); - get_keyfile_style(config, config_home, "jscript_commentdoc", &style_sets[GEANY_FILETYPES_XML].styling[47]); - get_keyfile_style(config, config_home, "jscript_number", &style_sets[GEANY_FILETYPES_XML].styling[48]); - get_keyfile_style(config, config_home, "jscript_word", &style_sets[GEANY_FILETYPES_XML].styling[49]); - get_keyfile_style(config, config_home, "jscript_keyword", &style_sets[GEANY_FILETYPES_XML].styling[50]); - get_keyfile_style(config, config_home, "jscript_doublestring", &style_sets[GEANY_FILETYPES_XML].styling[51]); - get_keyfile_style(config, config_home, "jscript_singlestring", &style_sets[GEANY_FILETYPES_XML].styling[52]); - get_keyfile_style(config, config_home, "jscript_symbols", &style_sets[GEANY_FILETYPES_XML].styling[53]); - get_keyfile_style(config, config_home, "jscript_stringeol", &style_sets[GEANY_FILETYPES_XML].styling[54]); - get_keyfile_style(config, config_home, "jscript_regex", &style_sets[GEANY_FILETYPES_XML].styling[55]); - - style_sets[GEANY_FILETYPES_XML].keywords = g_new(gchar*, 7); - get_keyfile_keywords(config, config_home, "html", GEANY_FILETYPES_XML, 0); - get_keyfile_keywords(config, config_home, "javascript", GEANY_FILETYPES_XML, 1); - get_keyfile_keywords(config, config_home, "vbscript", GEANY_FILETYPES_XML, 2); - get_keyfile_keywords(config, config_home, "python", GEANY_FILETYPES_XML, 3); - get_keyfile_keywords(config, config_home, "php", GEANY_FILETYPES_XML, 4); - get_keyfile_keywords(config, config_home, "sgml", GEANY_FILETYPES_XML, 5); - style_sets[GEANY_FILETYPES_XML].keywords[6] = NULL; -} - - -static void styleset_markup(ScintillaObject *sci, gboolean set_keywords) -{ - guint i; - const gchar *keywords; - - /* Used by several filetypes */ - if (style_sets[GEANY_FILETYPES_XML].styling == NULL) - filetypes_load_config(GEANY_FILETYPES_XML, FALSE); - - /* manually initialise filetype Python for use with embedded Python */ - filetypes_load_config(GEANY_FILETYPES_PYTHON, FALSE); - - /* Set keywords. If we don't want to use keywords, we must at least unset maybe previously set - * keywords, e.g. when switching between filetypes. */ - for (i = 0; i < 5; i++) - { - keywords = (set_keywords) ? style_sets[GEANY_FILETYPES_XML].keywords[i] : ""; - sci_set_keywords(sci, i, keywords); - } - /* always set SGML keywords */ - sci_set_keywords(sci, 5, style_sets[GEANY_FILETYPES_XML].keywords[5]); - - set_sci_style(sci, STYLE_DEFAULT, GEANY_FILETYPES_XML, 0); - set_sci_style(sci, SCE_H_DEFAULT, GEANY_FILETYPES_XML, 0); - set_sci_style(sci, SCE_H_TAG, GEANY_FILETYPES_XML, 1); - set_sci_style(sci, SCE_H_TAGUNKNOWN, GEANY_FILETYPES_XML, 2); - set_sci_style(sci, SCE_H_ATTRIBUTE, GEANY_FILETYPES_XML, 3); - set_sci_style(sci, SCE_H_ATTRIBUTEUNKNOWN, GEANY_FILETYPES_XML, 4); - set_sci_style(sci, SCE_H_NUMBER, GEANY_FILETYPES_XML, 5); - set_sci_style(sci, SCE_H_DOUBLESTRING, GEANY_FILETYPES_XML, 6); - set_sci_style(sci, SCE_H_SINGLESTRING, GEANY_FILETYPES_XML, 7); - set_sci_style(sci, SCE_H_OTHER, GEANY_FILETYPES_XML, 8); - set_sci_style(sci, SCE_H_COMMENT, GEANY_FILETYPES_XML, 9); - set_sci_style(sci, SCE_H_ENTITY, GEANY_FILETYPES_XML, 10); - set_sci_style(sci, SCE_H_TAGEND, GEANY_FILETYPES_XML, 11); - SSM(sci, SCI_STYLESETEOLFILLED, SCE_H_XMLSTART, 1); - set_sci_style(sci, SCE_H_XMLSTART, GEANY_FILETYPES_XML, 12); - set_sci_style(sci, SCE_H_XMLEND, GEANY_FILETYPES_XML, 13); - set_sci_style(sci, SCE_H_SCRIPT, GEANY_FILETYPES_XML, 14); - SSM(sci, SCI_STYLESETEOLFILLED, SCE_H_ASP, 1); - set_sci_style(sci, SCE_H_ASP, GEANY_FILETYPES_XML, 15); - SSM(sci, SCI_STYLESETEOLFILLED, SCE_H_ASPAT, 1); - set_sci_style(sci, SCE_H_ASPAT, GEANY_FILETYPES_XML, 16); - set_sci_style(sci, SCE_H_CDATA, GEANY_FILETYPES_XML, 17); - set_sci_style(sci, SCE_H_QUESTION, GEANY_FILETYPES_XML, 18); - set_sci_style(sci, SCE_H_VALUE, GEANY_FILETYPES_XML, 19); - set_sci_style(sci, SCE_H_XCCOMMENT, GEANY_FILETYPES_XML, 20); - - set_sci_style(sci, SCE_H_SGML_DEFAULT, GEANY_FILETYPES_XML, 21); - set_sci_style(sci, SCE_H_SGML_COMMENT, GEANY_FILETYPES_XML, 22); - set_sci_style(sci, SCE_H_SGML_SPECIAL, GEANY_FILETYPES_XML, 23); - set_sci_style(sci, SCE_H_SGML_COMMAND, GEANY_FILETYPES_XML, 24); - set_sci_style(sci, SCE_H_SGML_DOUBLESTRING, GEANY_FILETYPES_XML, 25); - set_sci_style(sci, SCE_H_SGML_SIMPLESTRING, GEANY_FILETYPES_XML, 26); - set_sci_style(sci, SCE_H_SGML_1ST_PARAM, GEANY_FILETYPES_XML, 27); - set_sci_style(sci, SCE_H_SGML_ENTITY, GEANY_FILETYPES_XML, 28); - set_sci_style(sci, SCE_H_SGML_BLOCK_DEFAULT, GEANY_FILETYPES_XML, 29); - set_sci_style(sci, SCE_H_SGML_1ST_PARAM_COMMENT, GEANY_FILETYPES_XML, 30); - set_sci_style(sci, SCE_H_SGML_ERROR, GEANY_FILETYPES_XML, 31); - - /* embedded JavaScript */ - set_sci_style(sci, SCE_HJ_START, GEANY_FILETYPES_XML, 43); - set_sci_style(sci, SCE_HJ_DEFAULT, GEANY_FILETYPES_XML, 44); - set_sci_style(sci, SCE_HJ_COMMENT, GEANY_FILETYPES_XML, 45); - set_sci_style(sci, SCE_HJ_COMMENTLINE, GEANY_FILETYPES_XML, 46); - set_sci_style(sci, SCE_HJ_COMMENTDOC, GEANY_FILETYPES_XML, 47); - set_sci_style(sci, SCE_HJ_NUMBER, GEANY_FILETYPES_XML, 48); - set_sci_style(sci, SCE_HJ_WORD, GEANY_FILETYPES_XML, 49); - set_sci_style(sci, SCE_HJ_KEYWORD, GEANY_FILETYPES_XML, 50); - set_sci_style(sci, SCE_HJ_DOUBLESTRING, GEANY_FILETYPES_XML, 51); - set_sci_style(sci, SCE_HJ_SINGLESTRING, GEANY_FILETYPES_XML, 52); - set_sci_style(sci, SCE_HJ_SYMBOLS, GEANY_FILETYPES_XML, 53); - set_sci_style(sci, SCE_HJ_STRINGEOL, GEANY_FILETYPES_XML, 54); - set_sci_style(sci, SCE_HJ_REGEX, GEANY_FILETYPES_XML, 55); - - /* for HB, VBScript?, use the same styles as for JavaScript */ - set_sci_style(sci, SCE_HB_START, GEANY_FILETYPES_XML, 43); - set_sci_style(sci, SCE_HB_DEFAULT, GEANY_FILETYPES_XML, 44); - set_sci_style(sci, SCE_HB_COMMENTLINE, GEANY_FILETYPES_XML, 46); - set_sci_style(sci, SCE_HB_NUMBER, GEANY_FILETYPES_XML, 48); - set_sci_style(sci, SCE_HB_WORD, GEANY_FILETYPES_XML, 50); /* keywords */ - set_sci_style(sci, SCE_HB_STRING, GEANY_FILETYPES_XML, 51); - set_sci_style(sci, SCE_HB_IDENTIFIER, GEANY_FILETYPES_XML, 53); - set_sci_style(sci, SCE_HB_STRINGEOL, GEANY_FILETYPES_XML, 54); - - /* for HBA, VBScript?, use the same styles as for JavaScript */ - set_sci_style(sci, SCE_HBA_START, GEANY_FILETYPES_XML, 43); - set_sci_style(sci, SCE_HBA_DEFAULT, GEANY_FILETYPES_XML, 44); - set_sci_style(sci, SCE_HBA_COMMENTLINE, GEANY_FILETYPES_XML, 46); - set_sci_style(sci, SCE_HBA_NUMBER, GEANY_FILETYPES_XML, 48); - set_sci_style(sci, SCE_HBA_WORD, GEANY_FILETYPES_XML, 50); /* keywords */ - set_sci_style(sci, SCE_HBA_STRING, GEANY_FILETYPES_XML, 51); - set_sci_style(sci, SCE_HBA_IDENTIFIER, GEANY_FILETYPES_XML, 53); - set_sci_style(sci, SCE_HBA_STRINGEOL, GEANY_FILETYPES_XML, 54); - - /* for HJA, ASP Javascript, use the same styles as for JavaScript */ - set_sci_style(sci, SCE_HJA_START, GEANY_FILETYPES_XML, 43); - set_sci_style(sci, SCE_HJA_DEFAULT, GEANY_FILETYPES_XML, 44); - set_sci_style(sci, SCE_HJA_COMMENT, GEANY_FILETYPES_XML, 45); - set_sci_style(sci, SCE_HJA_COMMENTLINE, GEANY_FILETYPES_XML, 46); - set_sci_style(sci, SCE_HJA_COMMENTDOC, GEANY_FILETYPES_XML, 47); - set_sci_style(sci, SCE_HJA_NUMBER, GEANY_FILETYPES_XML, 48); - set_sci_style(sci, SCE_HJA_WORD, GEANY_FILETYPES_XML, 49); - set_sci_style(sci, SCE_HJA_KEYWORD, GEANY_FILETYPES_XML, 50); - set_sci_style(sci, SCE_HJA_DOUBLESTRING, GEANY_FILETYPES_XML, 51); - set_sci_style(sci, SCE_HJA_SINGLESTRING, GEANY_FILETYPES_XML, 52); - set_sci_style(sci, SCE_HJA_SYMBOLS, GEANY_FILETYPES_XML, 53); - set_sci_style(sci, SCE_HJA_STRINGEOL, GEANY_FILETYPES_XML, 54); - set_sci_style(sci, SCE_HJA_REGEX, GEANY_FILETYPES_XML, 55); - - /* for embedded Python we use the Python styles */ - set_sci_style(sci, SCE_HP_START, GEANY_FILETYPES_XML, 43); - set_sci_style(sci, SCE_HP_DEFAULT, GEANY_FILETYPES_PYTHON, 0); - set_sci_style(sci, SCE_HP_COMMENTLINE, GEANY_FILETYPES_PYTHON, 1); - set_sci_style(sci, SCE_HP_NUMBER, GEANY_FILETYPES_PYTHON, 2); - set_sci_style(sci, SCE_HP_STRING, GEANY_FILETYPES_PYTHON, 3); - set_sci_style(sci, SCE_HP_CHARACTER, GEANY_FILETYPES_PYTHON, 4); - set_sci_style(sci, SCE_HP_WORD, GEANY_FILETYPES_PYTHON, 5); - set_sci_style(sci, SCE_HP_TRIPLE, GEANY_FILETYPES_PYTHON, 6); - set_sci_style(sci, SCE_HP_TRIPLEDOUBLE, GEANY_FILETYPES_PYTHON, 7); - set_sci_style(sci, SCE_HP_CLASSNAME, GEANY_FILETYPES_PYTHON, 8); - set_sci_style(sci, SCE_HP_DEFNAME, GEANY_FILETYPES_PYTHON, 9); - set_sci_style(sci, SCE_HP_OPERATOR, GEANY_FILETYPES_PYTHON, 10); - set_sci_style(sci, SCE_HP_IDENTIFIER, GEANY_FILETYPES_PYTHON, 11); - - /* for embedded HPA (what is this?) we use the Python styles */ - set_sci_style(sci, SCE_HPA_START, GEANY_FILETYPES_XML, 43); - set_sci_style(sci, SCE_HPA_DEFAULT, GEANY_FILETYPES_PYTHON, 0); - set_sci_style(sci, SCE_HPA_COMMENTLINE, GEANY_FILETYPES_PYTHON, 1); - set_sci_style(sci, SCE_HPA_NUMBER, GEANY_FILETYPES_PYTHON, 2); - set_sci_style(sci, SCE_HPA_STRING, GEANY_FILETYPES_PYTHON, 3); - set_sci_style(sci, SCE_HPA_CHARACTER, GEANY_FILETYPES_PYTHON, 4); - set_sci_style(sci, SCE_HPA_WORD, GEANY_FILETYPES_PYTHON, 5); - set_sci_style(sci, SCE_HPA_TRIPLE, GEANY_FILETYPES_PYTHON, 6); - set_sci_style(sci, SCE_HPA_TRIPLEDOUBLE, GEANY_FILETYPES_PYTHON, 7); - set_sci_style(sci, SCE_HPA_CLASSNAME, GEANY_FILETYPES_PYTHON, 8); - set_sci_style(sci, SCE_HPA_DEFNAME, GEANY_FILETYPES_PYTHON, 9); - set_sci_style(sci, SCE_HPA_OPERATOR, GEANY_FILETYPES_PYTHON, 10); - set_sci_style(sci, SCE_HPA_IDENTIFIER, GEANY_FILETYPES_PYTHON, 11); - - /* PHP */ - set_sci_style(sci, SCE_HPHP_DEFAULT, GEANY_FILETYPES_XML, 32); - set_sci_style(sci, SCE_HPHP_SIMPLESTRING, GEANY_FILETYPES_XML, 33); - set_sci_style(sci, SCE_HPHP_HSTRING, GEANY_FILETYPES_XML, 34); - set_sci_style(sci, SCE_HPHP_NUMBER, GEANY_FILETYPES_XML, 35); - set_sci_style(sci, SCE_HPHP_WORD, GEANY_FILETYPES_XML, 36); - set_sci_style(sci, SCE_HPHP_VARIABLE, GEANY_FILETYPES_XML, 37); - set_sci_style(sci, SCE_HPHP_COMMENT, GEANY_FILETYPES_XML, 38); - set_sci_style(sci, SCE_HPHP_COMMENTLINE, GEANY_FILETYPES_XML, 39); - set_sci_style(sci, SCE_HPHP_OPERATOR, GEANY_FILETYPES_XML, 40); - set_sci_style(sci, SCE_HPHP_HSTRING_VARIABLE, GEANY_FILETYPES_XML, 41); - set_sci_style(sci, SCE_HPHP_COMPLEX_VARIABLE, GEANY_FILETYPES_XML, 42); - - /* note: normally this would be in the filetype file instead */ - sci_set_property(sci, "fold.html", "1"); - sci_set_property(sci, "fold.html.preprocessor", "0"); -} - - -static void styleset_xml(ScintillaObject *sci, guint ft_id) -{ - apply_filetype_properties(sci, SCLEX_XML, ft_id); - - /* use the same colouring for HTML; XML and so on */ - styleset_markup(sci, FALSE); -} - static void styleset_default(ScintillaObject *sci, guint ft_id) { @@ -1271,7 +995,7 @@ void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *co init_styleset_case_auto(HASKELL); init_styleset_case_auto(HAXE); init_styleset_case_auto(AS); - init_styleset_case(GEANY_FILETYPES_HTML, styleset_html_init); + init_styleset_case_auto(HTML); init_styleset_case_auto(JAVA); init_styleset_case_auto(JS); init_styleset_case_auto(LATEX); @@ -1282,7 +1006,7 @@ void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *co init_styleset_case_auto(NSIS); init_styleset_case_auto(PASCAL); init_styleset_case_auto(PERL); - init_styleset_case(GEANY_FILETYPES_PHP, styleset_php_init); + init_styleset_case_auto(PHP); init_styleset_case_auto(PO); init_styleset_case_auto(PYTHON); init_styleset_case_auto(R); @@ -1293,7 +1017,7 @@ void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *co init_styleset_case_auto(TXT2TAGS); init_styleset_case_auto(VHDL); init_styleset_case_auto(VERILOG); - init_styleset_case(GEANY_FILETYPES_XML, styleset_markup_init); + init_styleset_case_auto(XML); init_styleset_case_auto(YAML); default: if (ft->lexer_filetype) @@ -1349,7 +1073,7 @@ void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft) styleset_case_auto(HASKELL); styleset_case_auto(HAXE); styleset_case_auto(AS); - styleset_case(GEANY_FILETYPES_HTML, styleset_html); + styleset_case_auto(HTML); styleset_case_auto(JAVA); styleset_case_auto(JS); styleset_case_auto(LATEX); @@ -1360,7 +1084,7 @@ void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft) styleset_case_auto(NSIS); styleset_case_auto(PASCAL); styleset_case_auto(PERL); - styleset_case(GEANY_FILETYPES_PHP, styleset_php); + styleset_case_auto(PHP); styleset_case_auto(PO); styleset_case_auto(PYTHON); styleset_case_auto(R); @@ -1371,7 +1095,7 @@ void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft) styleset_case_auto(TXT2TAGS); styleset_case_auto(VHDL); styleset_case_auto(VERILOG); - styleset_case(GEANY_FILETYPES_XML, styleset_xml); + styleset_case_auto(XML); styleset_case_auto(YAML); case GEANY_FILETYPES_NONE: default: diff --git a/src/highlightingmappings.h b/src/highlightingmappings.h index 5d982ade..1ba7554a 100644 --- a/src/highlightingmappings.h +++ b/src/highlightingmappings.h @@ -621,6 +621,153 @@ static const HLKeyword highlighting_keywords_HAXE[] = #define highlighting_properties_HAXE highlighting_properties_C +/* HTML */ +#define highlighting_lexer_HTML SCLEX_HTML +static const HLStyle highlighting_styles_HTML[] = +{ + { SCE_H_DEFAULT, "html_default" }, + { SCE_H_TAG, "html_tag" }, + { SCE_H_TAGUNKNOWN, "html_tagunknown" }, + { SCE_H_ATTRIBUTE, "html_attribute" }, + { SCE_H_ATTRIBUTEUNKNOWN, "html_attributeunknown" }, + { SCE_H_NUMBER, "html_number" }, + { SCE_H_DOUBLESTRING, "html_doublestring" }, + { SCE_H_SINGLESTRING, "html_singlestring" }, + { SCE_H_OTHER, "html_other" }, + { SCE_H_COMMENT, "html_comment" }, + { SCE_H_ENTITY, "html_entity" }, + { SCE_H_TAGEND, "html_tagend" }, + { SCE_H_XMLSTART, "html_xmlstart", TRUE }, + { SCE_H_XMLEND, "html_xmlend" }, + { SCE_H_SCRIPT, "html_script" }, + { SCE_H_ASP, "html_asp", TRUE }, + { SCE_H_ASPAT, "html_aspat", TRUE }, + { SCE_H_CDATA, "html_cdata" }, + { SCE_H_QUESTION, "html_question" }, + { SCE_H_VALUE, "html_value" }, + { SCE_H_XCCOMMENT, "html_xccomment" }, + + { SCE_H_SGML_DEFAULT, "sgml_default" }, + { SCE_H_SGML_COMMENT, "sgml_comment" }, + { SCE_H_SGML_SPECIAL, "sgml_special" }, + { SCE_H_SGML_COMMAND, "sgml_command" }, + { SCE_H_SGML_DOUBLESTRING, "sgml_doublestring" }, + { SCE_H_SGML_SIMPLESTRING, "sgml_simplestring" }, + { SCE_H_SGML_1ST_PARAM, "sgml_1st_param" }, + { SCE_H_SGML_ENTITY, "sgml_entity" }, + { SCE_H_SGML_BLOCK_DEFAULT, "sgml_block_default" }, + { SCE_H_SGML_1ST_PARAM_COMMENT, "sgml_1st_param_comment" }, + { SCE_H_SGML_ERROR, "sgml_error" }, + + /* embedded JavaScript */ + { SCE_HJ_START, "jscript_start" }, + { SCE_HJ_DEFAULT, "jscript_default" }, + { SCE_HJ_COMMENT, "jscript_comment" }, + { SCE_HJ_COMMENTLINE, "jscript_commentline" }, + { SCE_HJ_COMMENTDOC, "jscript_commentdoc" }, + { SCE_HJ_NUMBER, "jscript_number" }, + { SCE_HJ_WORD, "jscript_word" }, + { SCE_HJ_KEYWORD, "jscript_keyword" }, + { SCE_HJ_DOUBLESTRING, "jscript_doublestring" }, + { SCE_HJ_SINGLESTRING, "jscript_singlestring" }, + { SCE_HJ_SYMBOLS, "jscript_symbols" }, + { SCE_HJ_STRINGEOL, "jscript_stringeol" }, + { SCE_HJ_REGEX, "jscript_regex" }, + + /* for HB, VBScript?, use the same styles as for JavaScript */ + { SCE_HB_START, "jscript_start" }, + { SCE_HB_DEFAULT, "jscript_default" }, + { SCE_HB_COMMENTLINE, "jscript_commentline" }, + { SCE_HB_NUMBER, "jscript_number" }, + { SCE_HB_WORD, "jscript_keyword" }, /* keywords */ + { SCE_HB_STRING, "jscript_doublestring" }, + { SCE_HB_IDENTIFIER, "jscript_symbols" }, + { SCE_HB_STRINGEOL, "jscript_stringeol" }, + + /* for HBA, VBScript?, use the same styles as for JavaScript */ + { SCE_HBA_START, "jscript_start" }, + { SCE_HBA_DEFAULT, "jscript_default" }, + { SCE_HBA_COMMENTLINE, "jscript_commentline" }, + { SCE_HBA_NUMBER, "jscript_number" }, + { SCE_HBA_WORD, "jscript_keyword" }, /* keywords */ + { SCE_HBA_STRING, "jscript_doublestring" }, + { SCE_HBA_IDENTIFIER, "jscript_symbols" }, + { SCE_HBA_STRINGEOL, "jscript_stringeol" }, + + /* for HJA, ASP Javascript, use the same styles as for JavaScript */ + { SCE_HJA_START, "jscript_start" }, + { SCE_HJA_DEFAULT, "jscript_default" }, + { SCE_HJA_COMMENT, "jscript_comment" }, + { SCE_HJA_COMMENTLINE, "jscript_commentline" }, + { SCE_HJA_COMMENTDOC, "jscript_commentdoc" }, + { SCE_HJA_NUMBER, "jscript_number" }, + { SCE_HJA_WORD, "jscript_word" }, + { SCE_HJA_KEYWORD, "jscript_keyword" }, + { SCE_HJA_DOUBLESTRING, "jscript_doublestring" }, + { SCE_HJA_SINGLESTRING, "jscript_singlestring" }, + { SCE_HJA_SYMBOLS, "jscript_symbols" }, + { SCE_HJA_STRINGEOL, "jscript_stringeol" }, + { SCE_HJA_REGEX, "jscript_regex" }, + + /* embedded Python */ + { SCE_HP_START, "jscript_start" }, + { SCE_HP_DEFAULT, "python_default" }, + { SCE_HP_COMMENTLINE, "python_commentline" }, + { SCE_HP_NUMBER, "python_number" }, + { SCE_HP_STRING, "python_string" }, + { SCE_HP_CHARACTER, "python_character" }, + { SCE_HP_WORD, "python_word" }, + { SCE_HP_TRIPLE, "python_triple" }, + { SCE_HP_TRIPLEDOUBLE, "python_tripledouble" }, + { SCE_HP_CLASSNAME, "python_classname" }, + { SCE_HP_DEFNAME, "python_defname" }, + { SCE_HP_OPERATOR, "python_operator" }, + { SCE_HP_IDENTIFIER, "python_identifier" }, + + /* for embedded HPA (what is this?) we use the Python styles */ + { SCE_HPA_START, "jscript_start" }, + { SCE_HPA_DEFAULT, "python_default" }, + { SCE_HPA_COMMENTLINE, "python_commentline" }, + { SCE_HPA_NUMBER, "python_number" }, + { SCE_HPA_STRING, "python_string" }, + { SCE_HPA_CHARACTER, "python_character" }, + { SCE_HPA_WORD, "python_word" }, + { SCE_HPA_TRIPLE, "python_triple" }, + { SCE_HPA_TRIPLEDOUBLE, "python_tripledouble" }, + { SCE_HPA_CLASSNAME, "python_classname" }, + { SCE_HPA_DEFNAME, "python_defname" }, + { SCE_HPA_OPERATOR, "python_operator" }, + { SCE_HPA_IDENTIFIER, "python_identifier" }, + + /* PHP */ + { SCE_HPHP_DEFAULT, "php_default" }, + { SCE_HPHP_SIMPLESTRING, "php_simplestring" }, + { SCE_HPHP_HSTRING, "php_hstring" }, + { SCE_HPHP_NUMBER, "php_number" }, + { SCE_HPHP_WORD, "php_word" }, + { SCE_HPHP_VARIABLE, "php_variable" }, + { SCE_HPHP_COMMENT, "php_comment" }, + { SCE_HPHP_COMMENTLINE, "php_commentline" }, + { SCE_HPHP_OPERATOR, "php_operator" }, + { SCE_HPHP_HSTRING_VARIABLE, "php_hstring_variable" }, + { SCE_HPHP_COMPLEX_VARIABLE, "php_complex_variable" } +}; +static const HLKeyword highlighting_keywords_HTML[] = +{ + { 0, "html" }, + { 1, "javascript" }, + { 2, "vbscript" }, + { 3, "python" }, + { 4, "php" }, + { 5, "sgml" } +}; +static const HLProperty highlighting_properties_HTML[] = +{ + { "fold.html", "1" }, + { "fold.html.preprocessor", "0" } +}; + + /* Java */ #define highlighting_lexer_JAVA SCLEX_CPP #define highlighting_styles_JAVA highlighting_styles_C @@ -923,6 +1070,13 @@ static const HLKeyword highlighting_keywords_PERL[] = #define highlighting_properties_PERL EMPTY_PROPERTIES +/* PHP */ +#define highlighting_lexer_PHP SCLEX_HTML +#define highlighting_styles_PHP highlighting_styles_HTML +#define highlighting_keywords_PHP highlighting_keywords_HTML +#define highlighting_properties_PHP highlighting_properties_HTML + + /* PO (gettext) */ #define highlighting_lexer_PO SCLEX_PO static const HLStyle highlighting_styles_PO[] = @@ -1237,6 +1391,16 @@ static const HLKeyword highlighting_keywords_VERILOG[] = #define highlighting_properties_VERILOG EMPTY_PROPERTIES +/* XML */ +#define highlighting_lexer_XML SCLEX_XML +#define highlighting_styles_XML highlighting_styles_HTML +static const HLKeyword highlighting_keywords_XML[] = +{ + { 5, "sgml" } +}; +#define highlighting_properties_XML highlighting_properties_HTML + + /* YAML */ #define highlighting_lexer_YAML SCLEX_YAML static const HLStyle highlighting_styles_YAML[] = From b96d22374a04e58fbb0eb017d8baf099ea34e7ad Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 9 Nov 2011 22:59:56 +0100 Subject: [PATCH 09/13] Make HTML filetype the "primary" one XML and PHP inherits from XML used to be the one holding the actual definitions, but the HTML filetype is actually superset of XML (XML filetypes had definitions for non-XML things), and most definitions names referenced HTML rather than XML. So, move the actual definitions from filetypes.xml to filetypes.html and make XML and PHP inherit from HTML. --- data/filetypes.html | 86 +++++++++++++++++++++++++++++++++++++++++++-- data/filetypes.php | 4 +-- data/filetypes.xml | 86 ++------------------------------------------- 3 files changed, 88 insertions(+), 88 deletions(-) diff --git a/data/filetypes.html b/data/filetypes.html index 3cc9f7a5..70f500a0 100644 --- a/data/filetypes.html +++ b/data/filetypes.html @@ -1,7 +1,89 @@ # For complete documentation of this file, please see Geany's main documentation -[styling=XML] +[styling] +# Edit these in the colorscheme .conf file instead +html_default=default +html_tag=tag +html_tagunknown=tag_unknown +html_attribute=attribute +html_attributeunknown=attribute_unknown +html_number=number_1 +html_doublestring=string_1 +html_singlestring=string_1 +html_other=other +html_comment=comment +html_entity=entity +html_tagend=tag_end +html_xmlstart=tag +html_xmlend=tag_end +html_script=tag +html_asp=tag +html_aspat=tag +html_cdata=string_2 +html_question=number_2 +html_value=value +html_xccomment=comment + +sgml_default=default +sgml_comment=comment +sgml_special=number_1 +sgml_command=number_2 +sgml_doublestring=string_1 +sgml_simplestring=string_1 +sgml_1st_param=attribute +sgml_entity=entity +sgml_block_default=default +sgml_1st_param_comment=comment +sgml_error=error + +php_default=default +php_simplestring=string_1 +php_hstring=string_1 +php_number=number_1 +php_word=keyword_1 +php_variable=preprocessor +php_comment=comment +php_commentline=comment_line +php_operator=operator +php_hstring_variable=string_2 +php_complex_variable=preprocessor + +jscript_start=tag +jscript_default=default +jscript_comment=comment +jscript_commentline=comment_line +jscript_commentdoc=comment_doc +jscript_number=number_1 +jscript_word=keyword_1 +jscript_keyword=keyword_2 +jscript_doublestring=string_1 +jscript_singlestring=string_1 + +jscript_symbols=operator +jscript_stringeol=string_eol +jscript_regex=regex + +python_default=default +python_commentline=comment_line +python_number=number_1 +python_string=string_1 +python_character=character +python_word=keyword_1 +python_triple=string_2 +python_tripledouble=string_2 +python_classname=type +python_defname=function +python_operator=operator +python_identifier=identifier_1 + + +[keywords] +html=a abbr acronym address applet area b base basefont bdo big blockquote body br button caption center cite code col colgroup dd del dfn dir div dl dt em embed fieldset font form frame frameset h1 h2 h3 h4 h5 h6 head hr html i iframe img input ins isindex kbd label legend li link map menu meta noframes noscript object ol optgroup option p param pre q quality s samp script select small span strike strong style sub sup table tbody td textarea tfoot th thead title tr tt u ul var xmlns leftmargin topmargin abbr accept-charset accept accesskey action align alink alt archive axis background bgcolor border cellpadding cellspacing char charoff charset checked cite class classid clear codebase codetype color cols colspan compact content coords data datafld dataformatas datapagesize datasrc datetime declare defer dir disabled enctype face for frame frameborder selected headers height href hreflang hspace http-equiv id ismap label lang language link longdesc marginwidth marginheight maxlength media framespacing method multiple name nohref noresize noshade nowrap object onblur onchange onclick ondblclick onfocus onkeydown onkeypress onkeyup onload onmousedown onmousemove onmouseover onmouseout onmouseup onreset onselect onsubmit onunload profile prompt pluginspage readonly rel rev rows rowspan rules scheme scope scrolling shape size span src standby start style summary tabindex target text title type usemap valign value valuetype version vlink vspace width text password checkbox radio submit reset file hidden image public doctype xml xml:lang article aside audio canvas command details datalist figure figcaption footer header hgroup keygen mark meter nav output progress section time video wbr async autocomplete autofocus contenteditable contextmenu draggable formaction formenctype formnovalidate formtarget list manifest max min novalidate pattern ping placeholder required reversed role sandbox scoped seamless sizes spellcheck srcdoc step ^data- ^aria- +javascript=abs abstract acos anchor asin atan atan2 big bold boolean break byte case catch ceil char charAt charCodeAt class concat const continue cos Date debugger default delete do double else enum escape eval exp export extends false final finally fixed float floor fontcolor fontsize for fromCharCode function goto if implements import in indexOf Infinity instanceof int interface isFinite isNaN italics join lastIndexOf length link log long Math max MAX_VALUE min MIN_VALUE NaN native NEGATIVE_INFINITY new null Number package parseFloat parseInt pop POSITIVE_INFINITY pow private protected public push random return reverse round shift short sin slice small sort splice split sqrt static strike string String sub substr substring sup super switch synchronized tan this throw throws toLowerCase toString toUpperCase transient true try typeof undefined unescape unshift valueOf var void volatile while with +vbscript=and as boolean byref byte byval call case class const continue currency date dim do double each else elseif empty end error exit false for function get global goto if in integer long loop me new next not nothing object on optional or private property public put redim rem resume select set single string sub then to true type until variant wend while with +python=and assert break class continue complex def del elif else except exec finally for from global if import in inherit is int lambda not or pass print raise return tuple try unicode while yield long float str list +php=abstract and array as bool boolean break case catch cfunction __class__ class clone const continue declare default die __dir__ directory do double echo else elseif empty enddeclare endfor endforeach endif endswitch endwhile eval exception exit extends false __file__ final float for foreach __function__ function goto global if implements include include_once instanceof int integer interface isset __line__ list __method__ namespace __namespace__ new null object old_function or parent php_user_filter print private protected public real require require_once resource return __sleep static stdclass string switch this throw true try unset use var __wakeup while xor insteadof trait +sgml=ELEMENT DOCTYPE ATTLIST ENTITY NOTATION -[keywords=XML] [lexer_properties] # default scripting language for ASP diff --git a/data/filetypes.php b/data/filetypes.php index f5713ca3..3aadd841 100644 --- a/data/filetypes.php +++ b/data/filetypes.php @@ -1,7 +1,7 @@ # For complete documentation of this file, please see Geany's main documentation -[styling=XML] +[styling=HTML] -[keywords=XML] +[keywords=HTML] [lexer_properties] phpscript.mode=1 diff --git a/data/filetypes.xml b/data/filetypes.xml index 710fab04..9496356f 100644 --- a/data/filetypes.xml +++ b/data/filetypes.xml @@ -1,89 +1,7 @@ # For complete documentation of this file, please see Geany's main documentation -[styling] -# Edit these in the colorscheme .conf file instead -html_default=default -html_tag=tag -html_tagunknown=tag_unknown -html_attribute=attribute -html_attributeunknown=attribute_unknown -html_number=number_1 -html_doublestring=string_1 -html_singlestring=string_1 -html_other=other -html_comment=comment -html_entity=entity -html_tagend=tag_end -html_xmlstart=tag -html_xmlend=tag_end -html_script=tag -html_asp=tag -html_aspat=tag -html_cdata=string_2 -html_question=number_2 -html_value=value -html_xccomment=comment - -sgml_default=default -sgml_comment=comment -sgml_special=number_1 -sgml_command=number_2 -sgml_doublestring=string_1 -sgml_simplestring=string_1 -sgml_1st_param=attribute -sgml_entity=entity -sgml_block_default=default -sgml_1st_param_comment=comment -sgml_error=error - -php_default=default -php_simplestring=string_1 -php_hstring=string_1 -php_number=number_1 -php_word=keyword_1 -php_variable=preprocessor -php_comment=comment -php_commentline=comment_line -php_operator=operator -php_hstring_variable=string_2 -php_complex_variable=preprocessor - -jscript_start=tag -jscript_default=default -jscript_comment=comment -jscript_commentline=comment_line -jscript_commentdoc=comment_doc -jscript_number=number_1 -jscript_word=keyword_1 -jscript_keyword=keyword_2 -jscript_doublestring=string_1 -jscript_singlestring=string_1 - -jscript_symbols=operator -jscript_stringeol=string_eol -jscript_regex=regex - -python_default=default -python_commentline=comment_line -python_number=number_1 -python_string=string_1 -python_character=character -python_word=keyword_1 -python_triple=string_2 -python_tripledouble=string_2 -python_classname=type -python_defname=function -python_operator=operator -python_identifier=identifier_1 - - -[keywords] -html=a abbr acronym address applet area b base basefont bdo big blockquote body br button caption center cite code col colgroup dd del dfn dir div dl dt em embed fieldset font form frame frameset h1 h2 h3 h4 h5 h6 head hr html i iframe img input ins isindex kbd label legend li link map menu meta noframes noscript object ol optgroup option p param pre q quality s samp script select small span strike strong style sub sup table tbody td textarea tfoot th thead title tr tt u ul var xmlns leftmargin topmargin abbr accept-charset accept accesskey action align alink alt archive axis background bgcolor border cellpadding cellspacing char charoff charset checked cite class classid clear codebase codetype color cols colspan compact content coords data datafld dataformatas datapagesize datasrc datetime declare defer dir disabled enctype face for frame frameborder selected headers height href hreflang hspace http-equiv id ismap label lang language link longdesc marginwidth marginheight maxlength media framespacing method multiple name nohref noresize noshade nowrap object onblur onchange onclick ondblclick onfocus onkeydown onkeypress onkeyup onload onmousedown onmousemove onmouseover onmouseout onmouseup onreset onselect onsubmit onunload profile prompt pluginspage readonly rel rev rows rowspan rules scheme scope scrolling shape size span src standby start style summary tabindex target text title type usemap valign value valuetype version vlink vspace width text password checkbox radio submit reset file hidden image public doctype xml xml:lang article aside audio canvas command details datalist figure figcaption footer header hgroup keygen mark meter nav output progress section time video wbr async autocomplete autofocus contenteditable contextmenu draggable formaction formenctype formnovalidate formtarget list manifest max min novalidate pattern ping placeholder required reversed role sandbox scoped seamless sizes spellcheck srcdoc step ^data- ^aria- -javascript=abs abstract acos anchor asin atan atan2 big bold boolean break byte case catch ceil char charAt charCodeAt class concat const continue cos Date debugger default delete do double else enum escape eval exp export extends false final finally fixed float floor fontcolor fontsize for fromCharCode function goto if implements import in indexOf Infinity instanceof int interface isFinite isNaN italics join lastIndexOf length link log long Math max MAX_VALUE min MIN_VALUE NaN native NEGATIVE_INFINITY new null Number package parseFloat parseInt pop POSITIVE_INFINITY pow private protected public push random return reverse round shift short sin slice small sort splice split sqrt static strike string String sub substr substring sup super switch synchronized tan this throw throws toLowerCase toString toUpperCase transient true try typeof undefined unescape unshift valueOf var void volatile while with -vbscript=and as boolean byref byte byval call case class const continue currency date dim do double each else elseif empty end error exit false for function get global goto if in integer long loop me new next not nothing object on optional or private property public put redim rem resume select set single string sub then to true type until variant wend while with -python=and assert break class continue complex def del elif else except exec finally for from global if import in inherit is int lambda not or pass print raise return tuple try unicode while yield long float str list -php=abstract and array as bool boolean break case catch cfunction __class__ class clone const continue declare default die __dir__ directory do double echo else elseif empty enddeclare endfor endforeach endif endswitch endwhile eval exception exit extends false __file__ final float for foreach __function__ function goto global if implements include include_once instanceof int integer interface isset __line__ list __method__ namespace __namespace__ new null object old_function or parent php_user_filter print private protected public real require require_once resource return __sleep static stdclass string switch this throw true try unset use var __wakeup while xor insteadof trait -sgml=ELEMENT DOCTYPE ATTLIST ENTITY NOTATION +[styling=HTML] +[keywords=HTML] [settings] # default extension used when saving files From cc63453a972bae703836bc80bd60d8116ee30387 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Thu, 10 Nov 2011 15:35:03 +0100 Subject: [PATCH 10/13] Remove now unused old init_styleset_case() and rename new one --- src/highlighting.c | 196 +++++++++++++++++++++------------------------ 1 file changed, 92 insertions(+), 104 deletions(-) diff --git a/src/highlighting.c b/src/highlighting.c index 3a272424..085dd02a 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -938,13 +938,7 @@ static guint get_lexer_filetype(GeanyFiletype *ft) } -/* lang_name is the name used for the styleset_foo_init function, e.g. foo. */ -#define init_styleset_case(ft_id, init_styleset_func) \ - case (ft_id): \ - init_styleset_func(filetype_idx, config, configh); \ - break - -#define init_styleset_case_auto(LANG_NAME) \ +#define init_styleset_case(LANG_NAME) \ case (GEANY_FILETYPES_##LANG_NAME): \ STYLESET_INIT_FROM_MAPPING(filetype_idx, config, configh, LANG_NAME); \ break @@ -974,51 +968,51 @@ void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *co switch (lexer_id) { - init_styleset_case_auto(ADA); - init_styleset_case_auto(ASM); - init_styleset_case_auto(BASIC); - init_styleset_case_auto(C); - init_styleset_case_auto(CAML); - init_styleset_case_auto(CMAKE); - init_styleset_case_auto(COBOL); - init_styleset_case_auto(CONF); - init_styleset_case_auto(CSS); - init_styleset_case_auto(D); - init_styleset_case_auto(DIFF); - init_styleset_case_auto(LISP); - init_styleset_case_auto(ERLANG); - init_styleset_case_auto(DOCBOOK); - init_styleset_case_auto(FERITE); - init_styleset_case_auto(F77); - init_styleset_case_auto(FORTH); - init_styleset_case_auto(FORTRAN); - init_styleset_case_auto(HASKELL); - init_styleset_case_auto(HAXE); - init_styleset_case_auto(AS); - init_styleset_case_auto(HTML); - init_styleset_case_auto(JAVA); - init_styleset_case_auto(JS); - init_styleset_case_auto(LATEX); - init_styleset_case_auto(LUA); - init_styleset_case_auto(MAKE); - init_styleset_case_auto(MATLAB); - init_styleset_case_auto(MARKDOWN); - init_styleset_case_auto(NSIS); - init_styleset_case_auto(PASCAL); - init_styleset_case_auto(PERL); - init_styleset_case_auto(PHP); - init_styleset_case_auto(PO); - init_styleset_case_auto(PYTHON); - init_styleset_case_auto(R); - init_styleset_case_auto(RUBY); - init_styleset_case_auto(SH); - init_styleset_case_auto(SQL); - init_styleset_case_auto(TCL); - init_styleset_case_auto(TXT2TAGS); - init_styleset_case_auto(VHDL); - init_styleset_case_auto(VERILOG); - init_styleset_case_auto(XML); - init_styleset_case_auto(YAML); + init_styleset_case(ADA); + init_styleset_case(ASM); + init_styleset_case(BASIC); + init_styleset_case(C); + init_styleset_case(CAML); + init_styleset_case(CMAKE); + init_styleset_case(COBOL); + init_styleset_case(CONF); + init_styleset_case(CSS); + init_styleset_case(D); + init_styleset_case(DIFF); + init_styleset_case(LISP); + init_styleset_case(ERLANG); + init_styleset_case(DOCBOOK); + init_styleset_case(FERITE); + init_styleset_case(F77); + init_styleset_case(FORTH); + init_styleset_case(FORTRAN); + init_styleset_case(HASKELL); + init_styleset_case(HAXE); + init_styleset_case(AS); + init_styleset_case(HTML); + init_styleset_case(JAVA); + init_styleset_case(JS); + init_styleset_case(LATEX); + init_styleset_case(LUA); + init_styleset_case(MAKE); + init_styleset_case(MATLAB); + init_styleset_case(MARKDOWN); + init_styleset_case(NSIS); + init_styleset_case(PASCAL); + init_styleset_case(PERL); + init_styleset_case(PHP); + init_styleset_case(PO); + init_styleset_case(PYTHON); + init_styleset_case(R); + init_styleset_case(RUBY); + init_styleset_case(SH); + init_styleset_case(SQL); + init_styleset_case(TCL); + init_styleset_case(TXT2TAGS); + init_styleset_case(VHDL); + init_styleset_case(VERILOG); + init_styleset_case(XML); + init_styleset_case(YAML); default: if (ft->lexer_filetype) geany_debug("Filetype %s has a recursive lexer_filetype %s set!", @@ -1030,13 +1024,7 @@ void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *co } -/* lang_name is the name used for the styleset_foo function, e.g. foo. */ -#define styleset_case(ft_id, styleset_func) \ - case (ft_id): \ - styleset_func(sci, ft->id); \ - break - -#define styleset_case_auto(LANG_NAME) \ +#define styleset_case(LANG_NAME) \ case (GEANY_FILETYPES_##LANG_NAME): \ STYLESET_FROM_MAPPING(sci, ft->id, LANG_NAME); \ break @@ -1052,51 +1040,51 @@ void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft) switch (lexer_id) { - styleset_case_auto(ADA); - styleset_case_auto(ASM); - styleset_case_auto(BASIC); - styleset_case_auto(C); - styleset_case_auto(CAML); - styleset_case_auto(CMAKE); - styleset_case_auto(COBOL); - styleset_case_auto(CONF); - styleset_case_auto(CSS); - styleset_case_auto(D); - styleset_case_auto(DIFF); - styleset_case_auto(LISP); - styleset_case_auto(ERLANG); - styleset_case_auto(DOCBOOK); - styleset_case_auto(FERITE); - styleset_case_auto(F77); - styleset_case_auto(FORTH); - styleset_case_auto(FORTRAN); - styleset_case_auto(HASKELL); - styleset_case_auto(HAXE); - styleset_case_auto(AS); - styleset_case_auto(HTML); - styleset_case_auto(JAVA); - styleset_case_auto(JS); - styleset_case_auto(LATEX); - styleset_case_auto(LUA); - styleset_case_auto(MAKE); - styleset_case_auto(MARKDOWN); - styleset_case_auto(MATLAB); - styleset_case_auto(NSIS); - styleset_case_auto(PASCAL); - styleset_case_auto(PERL); - styleset_case_auto(PHP); - styleset_case_auto(PO); - styleset_case_auto(PYTHON); - styleset_case_auto(R); - styleset_case_auto(RUBY); - styleset_case_auto(SH); - styleset_case_auto(SQL); - styleset_case_auto(TCL); - styleset_case_auto(TXT2TAGS); - styleset_case_auto(VHDL); - styleset_case_auto(VERILOG); - styleset_case_auto(XML); - styleset_case_auto(YAML); + styleset_case(ADA); + styleset_case(ASM); + styleset_case(BASIC); + styleset_case(C); + styleset_case(CAML); + styleset_case(CMAKE); + styleset_case(COBOL); + styleset_case(CONF); + styleset_case(CSS); + styleset_case(D); + styleset_case(DIFF); + styleset_case(LISP); + styleset_case(ERLANG); + styleset_case(DOCBOOK); + styleset_case(FERITE); + styleset_case(F77); + styleset_case(FORTH); + styleset_case(FORTRAN); + styleset_case(HASKELL); + styleset_case(HAXE); + styleset_case(AS); + styleset_case(HTML); + styleset_case(JAVA); + styleset_case(JS); + styleset_case(LATEX); + styleset_case(LUA); + styleset_case(MAKE); + styleset_case(MARKDOWN); + styleset_case(MATLAB); + styleset_case(NSIS); + styleset_case(PASCAL); + styleset_case(PERL); + styleset_case(PHP); + styleset_case(PO); + styleset_case(PYTHON); + styleset_case(R); + styleset_case(RUBY); + styleset_case(SH); + styleset_case(SQL); + styleset_case(TCL); + styleset_case(TXT2TAGS); + styleset_case(VHDL); + styleset_case(VERILOG); + styleset_case(XML); + styleset_case(YAML); case GEANY_FILETYPES_NONE: default: styleset_default(sci, ft->id); From 511d5276a324033992d0142ae18d1dacd9cb4169 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Thu, 10 Nov 2011 15:40:30 +0100 Subject: [PATCH 11/13] Merge apply_filetype_properties() into styleset_from_mapping() --- src/highlighting.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/highlighting.c b/src/highlighting.c index 085dd02a..697b13fc 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -781,18 +781,6 @@ static void merge_type_keywords(ScintillaObject *sci, guint ft_id, guint keyword } -/* All stylesets except None should call this. */ -static void -apply_filetype_properties(ScintillaObject *sci, guint lexer, guint ft_id) -{ - g_assert(ft_id != GEANY_FILETYPES_NONE); - - SSM(sci, SCI_SETLEXER, lexer, 0); - - styleset_common(sci, ft_id); -} - - static void styleset_init_from_mapping(guint ft_id, GKeyFile *config, GKeyFile *config_home, const HLStyle *styles, gsize n_styles, const HLKeyword *keywords, gsize n_keywords) @@ -837,8 +825,13 @@ static void styleset_from_mapping(ScintillaObject *sci, guint ft_id, guint lexer { gsize i; + g_assert(ft_id != GEANY_FILETYPES_NONE); + + /* lexer */ + SSM(sci, SCI_SETLEXER, lexer, 0); + /* styles */ - apply_filetype_properties(sci, lexer, ft_id); + styleset_common(sci, ft_id); if (n_styles > 0) { /* first style is also default one */ From d8d6f2908eb6c810fa9a2f0a458c8c113353be45 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Fri, 11 Nov 2011 20:02:59 +0100 Subject: [PATCH 12/13] Remove an unnecessary macro indirection --- src/highlighting.c | 32 ++++++++++++-------------------- src/highlightingmappings.h | 3 +++ 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/highlighting.c b/src/highlighting.c index 697b13fc..93462b10 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -809,14 +809,6 @@ static void styleset_init_from_mapping(guint ft_id, GKeyFile *config, GKeyFile * } -#define STYLESET_INIT_FROM_MAPPING(ft_id, config, config_home, lang_name) \ - styleset_init_from_mapping(ft_id, config, config_home, \ - highlighting_styles_##lang_name, \ - highlighting_styles_##lang_name ? G_N_ELEMENTS(highlighting_styles_##lang_name) : 0, \ - highlighting_keywords_##lang_name, \ - highlighting_keywords_##lang_name ? G_N_ELEMENTS(highlighting_keywords_##lang_name) : 0) - - /* STYLE_DEFAULT will be set to match the first style. */ static void styleset_from_mapping(ScintillaObject *sci, guint ft_id, guint lexer, const HLStyle *styles, gsize n_styles, @@ -859,16 +851,6 @@ static void styleset_from_mapping(ScintillaObject *sci, guint ft_id, guint lexer } -#define STYLESET_FROM_MAPPING(sci, ft_id, lang_name) \ - styleset_from_mapping(sci, ft_id, highlighting_lexer_##lang_name, \ - highlighting_styles_##lang_name, \ - highlighting_styles_##lang_name ? G_N_ELEMENTS(highlighting_styles_##lang_name) : 0, \ - highlighting_keywords_##lang_name, \ - highlighting_keywords_##lang_name ? G_N_ELEMENTS(highlighting_keywords_##lang_name) : 0, \ - highlighting_properties_##lang_name, \ - highlighting_properties_##lang_name ? G_N_ELEMENTS(highlighting_properties_##lang_name) : 0) - - static void styleset_default(ScintillaObject *sci, guint ft_id) { @@ -933,7 +915,11 @@ static guint get_lexer_filetype(GeanyFiletype *ft) #define init_styleset_case(LANG_NAME) \ case (GEANY_FILETYPES_##LANG_NAME): \ - STYLESET_INIT_FROM_MAPPING(filetype_idx, config, configh, LANG_NAME); \ + styleset_init_from_mapping(filetype_idx, config, configh, \ + highlighting_styles_##LANG_NAME, \ + HL_N_ENTRIES(highlighting_styles_##LANG_NAME), \ + highlighting_keywords_##LANG_NAME, \ + HL_N_ENTRIES(highlighting_keywords_##LANG_NAME)); \ break /* Called by filetypes_load_config(). */ @@ -1019,7 +1005,13 @@ void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *co #define styleset_case(LANG_NAME) \ case (GEANY_FILETYPES_##LANG_NAME): \ - STYLESET_FROM_MAPPING(sci, ft->id, LANG_NAME); \ + styleset_from_mapping(sci, ft->id, highlighting_lexer_##LANG_NAME, \ + highlighting_styles_##LANG_NAME, \ + HL_N_ENTRIES(highlighting_styles_##LANG_NAME), \ + highlighting_keywords_##LANG_NAME, \ + HL_N_ENTRIES(highlighting_keywords_##LANG_NAME), \ + highlighting_properties_##LANG_NAME, \ + HL_N_ENTRIES(highlighting_properties_##LANG_NAME)); \ break /** Sets up highlighting and other visual settings. diff --git a/src/highlightingmappings.h b/src/highlightingmappings.h index 1ba7554a..4f11bc3c 100644 --- a/src/highlightingmappings.h +++ b/src/highlightingmappings.h @@ -92,6 +92,9 @@ typedef struct #define EMPTY_KEYWORDS ((HLKeyword *) NULL) #define EMPTY_PROPERTIES ((HLProperty *) NULL) +/* like G_N_ELEMENTS() but supports @array being NULL (for empty entries) */ +#define HL_N_ENTRIES(array) ((array) ? G_N_ELEMENTS(array) : 0) + /* Ada */ #define highlighting_lexer_ADA SCLEX_ADA From a00366b266cac650134370103f5b3b5d3a08a700 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Sat, 12 Nov 2011 02:07:36 +0100 Subject: [PATCH 13/13] Update HACKING for highlighting setup refactoring --- HACKING | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/HACKING b/HACKING index df7bd1f2..1ae5b0d2 100644 --- a/HACKING +++ b/HACKING @@ -419,8 +419,8 @@ Programming languages should have: * [build_settings] for commands to run. For languages with a Scintilla lexer, there should be a [styling] section, -to correspond to the styles used in styleset_foo() in highlighting.c - -see below. +to correspond to the styles used in highlighting_styles_FOO[] in +highlightingmappings.h - see below. Syntax highlighting ^^^^^^^^^^^^^^^^^^^ @@ -440,21 +440,33 @@ When adding a lexer, update: * wscript * scintilla/KeyWords.cxx - add a LINK_LEXER command *manually* -For syntax highlighting, you will need to edit highlighting.c and add -the following things: +For syntax highlighting, you will need to edit highlighting.c and +highlightingmappings.h and add the following things: -1. Write styleset_foo_init() to setup lexer styles and load style - settings from the filetypes.foo configuration file. You should probably - start by copying and adapting another filetype's initialization, such - as styleset_tcl_init(). You may want to use load_style_entries(). -2. Write styleset_foo() to apply styles when a new scintilla widget - is created. Again you could copy and adapt a function like - styleset_tcl(). You may want to use apply_style_entries(). -3. In highlighting_init_styles(), add - ``init_styleset_case(GEANY_FILETYPES_FOO, styleset_foo_init);``. -4. In highlighting_set_styles(), add - ``styleset_case(GEANY_FILETYPES_FOO, styleset_foo);``. -5. Write data/filetypes.foo configuration file [styling] section. See +1. In highlightingmappings.h: + + a. define ``highlighting_lexer_FOO`` to the Scintilla lexer ID for + this filtype, e.g. ``SCLEX_CPP``. + b. define the ``highlighting_styles_FOO`` array that maps Scintilla + style states to style names in the configuration file. + c. define ``highlighting_keywords_FOO`` to ``EMPTY_KEYWORDS`` if the + filtype has no keywords, or as an ``HLKeyword`` array mapping + the Scintilla keyword IDs to names in the configuration file. + d. define ``highlighting_properties_FOO`` to ``EMPTY_PROPERTIES``, or + as an array of ``HLProperty`` if the filetype requires some lexer + properties to be set. However, note that properties should + normally be set in the ``[lexer_properties]`` section of the + configuration file instead. + + You may look at other filtype's definitions for some examples + (Ada, CSS or Diff being good examples). + +2. In highlighting.c: + + a. Add ``init_styleset_case(FOO);`` in ``highlighting_init_styles()``. + b. Add ``styleset_case(FOO);`` in ``highlighting_set_styles()``. + +3. Write data/filetypes.foo configuration file [styling] section. See the manual and see data/filetypes.d for a named style example. .. note::