From a6fe1f46f07b813293ac045db753030e6e1063d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sun, 3 May 2009 18:13:34 +0000 Subject: [PATCH] Update Pascal styles as they changed in Scintilla. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3770 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 2 ++ data/filetypes.pascal | 21 ++++++++------ src/editor.c | 20 ++++++++++++-- src/highlighting.c | 64 ++++++++++++++++++++++++------------------- 4 files changed, 69 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index b03b3b07..85081b0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * wscript, scintilla/*, scintilla/include/*, src/plugindata.h: Update Scintilla to version 1.78. + * src/editor.c, src/highlighting.c: + Update Pascal styles as they changed in Scintilla. 2009-05-02 Enrico Tröger diff --git a/data/filetypes.pascal b/data/filetypes.pascal index 9b9da4cb..ac309b2e 100644 --- a/data/filetypes.pascal +++ b/data/filetypes.pascal @@ -1,21 +1,26 @@ # For complete documentation of this file, please see Geany's main documentation [styling] # foreground;background;bold;italic -default=0x0000ff;0xffffff;false;false +default=0x000000;0xffffff;false;false +identifier=0x000000;0xffffff;false;false comment=0xd00000;0xffffff;false;false -number=0x007f00;0xffffff;false;false +comment2=0x3f5fbf;0xffffff;false;false +commentline=0xd00000;0xffffff;false;false +preprocessor=0x007f7f;0xffffff;false;false +preprocessor2=0x007f7f;0xffffff;false;false +number=0x007F00;0xffffff;false;false +hexnumber=0x007F00;0xffffff;false;false word=0x111199;0xffffff;true;false string=0xff901e;0xffffff;false;false +stringeol=0x000000;0xe0c0e0;false;false character=0x404000;0xffffff;false;false -preprocessor=0x007f7f;0xffffff;false;false operator=0x301010;0xffffff;false;false -identifier=0x000000;0xffffff;false;false -regex=0x1b6313;0xffffff;false;false -commentline=0xd00000;0xffffff;false;false -commentdoc=0x3f5fbf;0xffffff;false;false +asm=0x804080;0xffffff;false;false + [keywords] -primary=absolute and array asm begin break case const constructor continue destructor div do downto dynamic else end end. file for function goto if implementation in inherited inline interface label message mod nil not object of on operator or overload outpacked procedure program record reintroduce repeat self set shl shr string then to type unit until uses var while with xor as class except exports finalization finally initialization is library on property raise threadvar try dispose exit false new true absolute abstract alias assembler cdecl cppdecl default export external far far16 forward index name near oldfpccall override pascal private protected public published read register safecall softfloat stdcall virtual write +# all items must be in one line +primary=absolute abstract add and array as asm assembler automated begin byte case cdecl char class const constructor contains default deprecated destructor dispid dispinterface div do downto dynamic else end except export exports external far file final finalization finally for forward function goto if implementation implements in index inherited initialization inline integer interface is label library message mod name near nil nodefault not object of on or out overload override package packed pascal platform private procedure program property protected public published raise read readonly real record register reintroduce remove repeat requires resourcestring safecall sealed set shl shr static stdcall stored strict string then threadvar to try type unit unsafe until uses var varargs virtual while with word write writeonly xor [settings] diff --git a/src/editor.c b/src/editor.c index ab776864..d3a2ed8e 100644 --- a/src/editor.c +++ b/src/editor.c @@ -2489,6 +2489,7 @@ gint editor_do_uncomment(GeanyEditor *editor, gint line, gboolean toggle) case SCLEX_SQL: style_comment = SCE_SQL_COMMENT; break; case SCLEX_CAML: style_comment = SCE_CAML_COMMENT; break; case SCLEX_D: style_comment = SCE_D_COMMENT; break; + case SCLEX_PASCAL: style_comment = SCE_PAS_COMMENT; break; default: style_comment = SCE_C_COMMENT; } if (sci_get_style_at(editor->sci, line_start + x) == style_comment) @@ -2636,6 +2637,7 @@ void editor_do_comment_toggle(GeanyEditor *editor) case SCLEX_D: style_comment = SCE_D_COMMENT; break; case SCLEX_RUBY: style_comment = SCE_RB_POD; break; case SCLEX_PERL: style_comment = SCE_PL_POD; break; + case SCLEX_PASCAL: style_comment = SCE_PAS_COMMENT; break; default: style_comment = SCE_C_COMMENT; } if (sci_get_style_at(editor->sci, line_start + x) == style_comment) @@ -2793,6 +2795,8 @@ void editor_do_comment(GeanyEditor *editor, gint line, gboolean allow_empty_line /* skip lines which are already comments */ switch (lexer) { /* I will list only those lexers which support multi line comments */ + /* FIXME Update the list of filetypes and move this switch into a separate + * function to avoid duplicate code. */ case SCLEX_XML: case SCLEX_HTML: { @@ -2805,6 +2809,7 @@ void editor_do_comment(GeanyEditor *editor, gint line, gboolean allow_empty_line case SCLEX_SQL: style_comment = SCE_SQL_COMMENT; break; case SCLEX_CAML: style_comment = SCE_CAML_COMMENT; break; case SCLEX_D: style_comment = SCE_D_COMMENT; break; + case SCLEX_PASCAL: style_comment = SCE_PAS_COMMENT; break; default: style_comment = SCE_C_COMMENT; } if (sci_get_style_at(editor->sci, line_start + x) == style_comment) continue; @@ -2878,6 +2883,10 @@ static gboolean in_block_comment(gint lexer, gint style) return (style == SCE_C_COMMENT || style == SCE_C_COMMENTDOC); + case SCLEX_PASCAL: + return (style == SCE_PAS_COMMENT || + style == SCE_PAS_COMMENT2); + case SCLEX_D: return (style == SCE_D_COMMENT || style == SCE_D_COMMENTDOC || @@ -2976,10 +2985,13 @@ static gboolean is_string_style(gint lexer, gint style) switch (lexer) { case SCLEX_CPP: - case SCLEX_PASCAL: return (style == SCE_C_CHARACTER || style == SCE_C_STRING); + case SCLEX_PASCAL: + return (style == SCE_PAS_CHARACTER || + style == SCE_PAS_STRING); + case SCLEX_D: return (style == SCE_D_CHARACTER || style == SCE_D_STRING); @@ -3097,7 +3109,6 @@ static gboolean is_comment_style(gint lexer, gint style) switch (lexer) { case SCLEX_CPP: - case SCLEX_PASCAL: return (style == SCE_C_COMMENT || style == SCE_C_COMMENTLINE || style == SCE_C_COMMENTDOC || @@ -3105,6 +3116,11 @@ static gboolean is_comment_style(gint lexer, gint style) style == SCE_C_COMMENTDOCKEYWORD || style == SCE_C_COMMENTDOCKEYWORDERROR); + case SCLEX_PASCAL: + return (style == SCE_PAS_COMMENT || + style == SCE_PAS_COMMENT2 || + style == SCE_PAS_COMMENTLINE); + case SCLEX_D: return (style == SCE_D_COMMENT || style == SCE_D_COMMENTLINE || diff --git a/src/highlighting.c b/src/highlighting.c index 06e2b9af..8e9553c9 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -988,24 +988,27 @@ static void styleset_vala(ScintillaObject *sci) static void styleset_pascal_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_PASCAL, 12); - get_keyfile_hex(config, config_home, "styling", "default", "0x0000ff", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[0]); - get_keyfile_style(config, config_home, "comment", &gsd_comment, &style_sets[GEANY_FILETYPES_PASCAL].styling[1]); - get_keyfile_hex(config, config_home, "styling", "number", "0x007F00", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[2]); - get_keyfile_hex(config, config_home, "styling", "word", "0x111199", "0xffffff", "true", &style_sets[GEANY_FILETYPES_PASCAL].styling[3]); - get_keyfile_hex(config, config_home, "styling", "string", "0xff901e", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[4]); - get_keyfile_hex(config, config_home, "styling", "character", "0x404000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[5]); - get_keyfile_hex(config, config_home, "styling", "preprocessor", "0x007f7f", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[6]); - get_keyfile_hex(config, config_home, "styling", "operator", "0x301010", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[7]); - get_keyfile_hex(config, config_home, "styling", "identifier", "0x000000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[8]); - get_keyfile_hex(config, config_home, "styling", "regex", "0x1b6313", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[9]); - get_keyfile_style(config, config_home, "commentline", &gsd_comment, &style_sets[GEANY_FILETYPES_PASCAL].styling[10]); - get_keyfile_style(config, config_home, "commentdoc", &gsd_comment_doc, &style_sets[GEANY_FILETYPES_PASCAL].styling[11]); + new_style_array(GEANY_FILETYPES_PASCAL, 15); + get_keyfile_hex(config, config_home, "styling", "default", "0x000000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[0]); + get_keyfile_hex(config, config_home, "styling", "identifier", "0x000000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[1]); + get_keyfile_hex(config, config_home, "styling", "comment", "0xd00000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[2]); + get_keyfile_hex(config, config_home, "styling", "comment2", "0x3f5fbf", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[3]); + get_keyfile_hex(config, config_home, "styling", "commentline", "0xd00000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[4]); + get_keyfile_hex(config, config_home, "styling", "preprocessor", "0x007f7f", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[5]); + get_keyfile_hex(config, config_home, "styling", "preprocessor2", "0x007f7f", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[6]); + get_keyfile_hex(config, config_home, "styling", "number", "0x007F00", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[7]); + get_keyfile_hex(config, config_home, "styling", "hexnumber", "0x007F00", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[8]); + get_keyfile_hex(config, config_home, "styling", "word", "0x111199", "0xffffff", "true", &style_sets[GEANY_FILETYPES_PASCAL].styling[9]); + get_keyfile_hex(config, config_home, "styling", "string", "0xff901e", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[10]); + get_keyfile_hex(config, config_home, "styling", "stringeol", "0x000000", "0xe0c0e0", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[11]); + get_keyfile_hex(config, config_home, "styling", "character", "0x404000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[12]); + get_keyfile_hex(config, config_home, "styling", "operator", "0x301010", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[13]); + get_keyfile_hex(config, config_home, "styling", "asm", "0x804080", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PASCAL].styling[14]); style_sets[GEANY_FILETYPES_PASCAL].keywords = g_new(gchar*, 2); - get_keyfile_keywords(config, config_home, "keywords", "primary", GEANY_FILETYPES_PASCAL, 0, "word integer char string byte real \ - for to do until repeat program if uses then else case var begin end \ - asm unit interface implementation procedure function object try class"); + get_keyfile_keywords(config, config_home, "keywords", "primary", GEANY_FILETYPES_PASCAL, 0, + "asm begin byte case char class do else end for function if implementation integer \ + interface object procedure program real repeat string then to try unit until uses var word"); style_sets[GEANY_FILETYPES_PASCAL].keywords[1] = NULL; get_keyfile_wordchars(config, config_home, @@ -1022,18 +1025,23 @@ static void styleset_pascal(ScintillaObject *sci) SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_PASCAL].keywords[0]); set_sci_style(sci, STYLE_DEFAULT, GEANY_FILETYPES_PASCAL, 0); - set_sci_style(sci, SCE_C_DEFAULT, GEANY_FILETYPES_PASCAL, 0); - set_sci_style(sci, SCE_C_COMMENT, GEANY_FILETYPES_PASCAL, 1); - set_sci_style(sci, SCE_C_NUMBER, GEANY_FILETYPES_PASCAL, 2); - set_sci_style(sci, SCE_C_WORD, GEANY_FILETYPES_PASCAL, 3); - set_sci_style(sci, SCE_C_STRING, GEANY_FILETYPES_PASCAL, 4); - set_sci_style(sci, SCE_C_CHARACTER, GEANY_FILETYPES_PASCAL, 5); - set_sci_style(sci, SCE_C_PREPROCESSOR, GEANY_FILETYPES_PASCAL, 6); - set_sci_style(sci, SCE_C_OPERATOR, GEANY_FILETYPES_PASCAL, 7); - set_sci_style(sci, SCE_C_IDENTIFIER, GEANY_FILETYPES_PASCAL, 8); - set_sci_style(sci, SCE_C_REGEX, GEANY_FILETYPES_PASCAL, 9); - set_sci_style(sci, SCE_C_COMMENTLINE, GEANY_FILETYPES_PASCAL, 10); - set_sci_style(sci, SCE_C_COMMENTDOC, GEANY_FILETYPES_PASCAL, 11); + set_sci_style(sci, SCE_PAS_DEFAULT, GEANY_FILETYPES_PASCAL, 0); + set_sci_style(sci, SCE_PAS_IDENTIFIER, GEANY_FILETYPES_PASCAL, 1); + set_sci_style(sci, SCE_PAS_COMMENT, GEANY_FILETYPES_PASCAL, 2); + set_sci_style(sci, SCE_PAS_COMMENT2, GEANY_FILETYPES_PASCAL, 3); + set_sci_style(sci, SCE_PAS_COMMENTLINE, GEANY_FILETYPES_PASCAL, 4); + set_sci_style(sci, SCE_PAS_PREPROCESSOR, GEANY_FILETYPES_PASCAL, 5); + set_sci_style(sci, SCE_PAS_PREPROCESSOR2, GEANY_FILETYPES_PASCAL, 6); + set_sci_style(sci, SCE_PAS_NUMBER, GEANY_FILETYPES_PASCAL, 7); + set_sci_style(sci, SCE_PAS_HEXNUMBER, GEANY_FILETYPES_PASCAL, 8); + set_sci_style(sci, SCE_PAS_WORD, GEANY_FILETYPES_PASCAL, 9); + set_sci_style(sci, SCE_PAS_STRING, GEANY_FILETYPES_PASCAL, 10); + set_sci_style(sci, SCE_PAS_STRINGEOL, GEANY_FILETYPES_PASCAL, 11); + set_sci_style(sci, SCE_PAS_CHARACTER, GEANY_FILETYPES_PASCAL, 12); + set_sci_style(sci, SCE_PAS_OPERATOR, GEANY_FILETYPES_PASCAL, 13); + set_sci_style(sci, SCE_PAS_ASM, GEANY_FILETYPES_PASCAL, 14); + + SSM(sci, SCI_SETPROPERTY, (uptr_t) "lexer.pascal.smart.highlighting", (sptr_t) "1"); }