Revision: 5533 http://geany.svn.sourceforge.net/geany/?rev=5533&view=rev Author: eht16 Date: 2011-01-30 15:03:51 +0000 (Sun, 30 Jan 2011)
Log Message: ----------- Add filetype Cobol (based on a patch by Seth Keiper).
Modified Paths: -------------- trunk/ChangeLog trunk/data/filetype_extensions.conf trunk/scintilla/Makefile.am trunk/scintilla/makefile.win32 trunk/scintilla/src/Catalogue.cxx trunk/src/editor.c trunk/src/filetypes.c trunk/src/filetypes.h trunk/src/highlighting.c trunk/src/plugindata.h trunk/src/symbols.c trunk/tagmanager/Makefile.am trunk/tagmanager/makefile.win32 trunk/tagmanager/parsers.h trunk/wscript
Added Paths: ----------- trunk/data/filetypes.cobol trunk/scintilla/lexers/LexCOBOL.cxx trunk/tagmanager/cobol.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-01-30 13:48:21 UTC (rev 5532) +++ trunk/ChangeLog 2011-01-30 15:03:51 UTC (rev 5533) @@ -3,6 +3,13 @@ * src/editor.c: Ensure the editor widget has the focus when the editor menu is called. + * scintilla/lexers/LexCOBOL.cxx, scintilla/src/Catalogue.cxx, + scintilla/Makefile.am, scintilla/makefile.win32, src/highlighting.c, + src/plugindata.h, src/filetypes.c, src/filetypes.h, src/editor.c, + src/symbols.c, tagmanager/parsers.h, tagmanager/makefile.win32, + tagmanager/cobol.c, tagmanager/Makefile.am, data/filetypes.cobol, + data/filetype_extensions.conf, wscript: + Add filetype Cobol (based on a patch by Seth Keiper).
2011-01-20 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/data/filetype_extensions.conf =================================================================== --- trunk/data/filetype_extensions.conf 2011-01-30 13:48:21 UTC (rev 5532) +++ trunk/data/filetype_extensions.conf 2011-01-30 15:03:51 UTC (rev 5533) @@ -11,6 +11,7 @@ C++=*.cpp;*.cxx;*.c++;*.cc;*.h;*.hpp;*.hxx;*.h++;*.hh;*.C;*.H; C#=*.cs; CMake=CMakeLists.txt;*.cmake;*.ctest; +COBOL=*.cob;*.cpy;*.cbl;*.cobol; Conf=*.conf;*.ini;config;*rc;*.cfg;*.desktop; CSS=*.css; D=*.d;*.di;
Added: trunk/data/filetypes.cobol =================================================================== --- trunk/data/filetypes.cobol (rev 0) +++ trunk/data/filetypes.cobol 2011-01-30 15:03:51 UTC (rev 5533) @@ -0,0 +1,41 @@ +# For complete documentation of this file, please see Geany's main documentation +[styling] +# foreground;background;bold;italic +default=default +comment=comment +commentline=comment +commentdoc=commentdoc +number=number +word=keyword +word2=keyword2 +string=string +character=string +operator=operator +identifier=default +quotedidentifier=default + +[keywords] +# all items must be in one line +keywords=accept access add address advancing after alphabet alphabetic alphabetic-lower alphabetic-upper alphanumeric alphanumeric-edited als alternate and any are area areas ascending assign at author before binary blank block bottom by cancel cbll cd cf ch character characters class clock-units close cobol code code-set collating column comma common communications computational compute configuration content continue control converting corr corresponding count currency data date date-compiled date-written day day-of-week de debug-contents debug-item debug-line debug-name debug-sub-1 debug-sub-2 debug-sub-3 debugging decimal-point delaratives delete delimited delimiter depending descending destination detail disable display divide division down duplicates dynamic egi else emi enable end-add end-compute end-delete end-divide end-evaluate end-if end-multiply end-of-page end-perform end-read end-receive end-return end-rewrite end-search end-start end-string end-subtract end-unstring end-write environment equal error esi evaluate every exception extend external false fd file file-control filler final first footing for from generate giving global greater group heading high-value high-values i-o i-o-control identification in index indexed indicate initial initialize initiate input input-output inspect installation into is just justified key label last leading left length lock memory merge message mode modules move multiple multiply native negative next no not number numeric numeric-edited object-computer occurs of off omitted on open optional or order organization other output overflow packed-decimal padding page page-counter perform pf ph pic picture plus position positive printing procedure procedures procedd program program-id purge queue quotes random rd read receive record records redefines reel reference references relative release remainder removal replace replacing report reporting reports rerun reserve reset return returning reversed rewind rewrite rf rh right rounded same sd search section security segment segment-limited select send sentence separate sequence sequential set sign size sort sort-merge source source-computer special-names standard standard-1 standard-2 start status string sub-queue-1 sub-queue-2 sub-queue-3 subtract sum suppress symbolic sync synchronized table tallying tape terminal terminate test text than then through thru time times to top trailing true type unit unstring until up upon usage use using value values varying when with words working-storage write + +[settings] +# default extension used when saving files +extension=cob + +# the following characters are these which a "word" can contains, see documentation +#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 + +# if only single comment char is supported like # in this file, leave comment_close blank +comment_open=*> +comment_close= + +# set to false if a comment character/string should start at column 0 of a line, true uses any +# indentation of the line, e.g. setting to true causes the following on pressing CTRL+d + #command_example(); +# setting to false would generate this +# command_example(); +# This setting works only for single line comments +comment_use_indent=false + +# context action command (please see Geany's main documentation for details) +context_action_cmd=
Property changes on: trunk/data/filetypes.cobol ___________________________________________________________________ Added: keywords + Author Date Id Revision Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native
Modified: trunk/scintilla/Makefile.am =================================================================== --- trunk/scintilla/Makefile.am 2011-01-30 13:48:21 UTC (rev 5532) +++ trunk/scintilla/Makefile.am 2011-01-30 15:03:51 UTC (rev 5533) @@ -10,6 +10,7 @@ lexers/LexAsm.cxx \ lexers/LexBash.cxx \ lexers/LexBasic.cxx \ +lexers/LexCOBOL.cxx \ lexers/LexCPP.cxx \ lexers/LexCSS.cxx \ lexers/LexCaml.cxx \
Added: trunk/scintilla/lexers/LexCOBOL.cxx =================================================================== --- trunk/scintilla/lexers/LexCOBOL.cxx (rev 0) +++ trunk/scintilla/lexers/LexCOBOL.cxx 2011-01-30 15:03:51 UTC (rev 5533) @@ -0,0 +1,372 @@ +// Scintilla source code edit control +/** @file LexCOBOL.cxx + ** Lexer for COBOL + ** Based on LexPascal.cxx + ** Written by Laurent le Tynevez + ** Updated by Simon Steele s.steele@pnotepad.org September 2002 + ** Updated by Mathias Rauen scite@madshi.net May 2003 (Delphi adjustments) + ** Updated by Rod Falck, Aug 2006 Converted to COBOL + **/ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <stdarg.h> +#include <assert.h> +#include <ctype.h> + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +#define IN_DIVISION 0x01 +#define IN_DECLARATIVES 0x02 +#define IN_SECTION 0x04 +#define IN_PARAGRAPH 0x08 +#define IN_FLAGS 0xF +#define NOT_HEADER 0x10 + +inline bool isCOBOLoperator(char ch) + { + return isoperator(ch); + } + +inline bool isCOBOLwordchar(char ch) + { + return isascii(ch) && (isalnum(ch) || ch == '-'); + + } + +inline bool isCOBOLwordstart(char ch) + { + return isascii(ch) && isalnum(ch); + } + +static int CountBits(int nBits) + { + int count = 0; + for (int i = 0; i < 32; ++i) + { + count += nBits & 1; + nBits >>= 1; + } + return count; + } + +static void getRange(unsigned int start, + unsigned int end, + Accessor &styler, + char *s, + unsigned int len) { + unsigned int i = 0; + while ((i < end - start + 1) && (i < len-1)) { + s[i] = static_cast<char>(tolower(styler[start + i])); + i++; + } + s[i] = '\0'; +} + +static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr) { + styler.ColourTo(end, attr); +} + + +static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) { + int ret = 0; + + WordList& a_keywords = *keywordlists[0]; + WordList& b_keywords = *keywordlists[1]; + WordList& c_keywords = *keywordlists[2]; + + char s[100]; + getRange(start, end, styler, s, sizeof(s)); + + char chAttr = SCE_C_IDENTIFIER; + if (isdigit(s[0]) || (s[0] == '.') || (s[0] == 'v')) { + chAttr = SCE_C_NUMBER; + char *p = s + 1; + while (*p) { + if ((!isdigit(*p) && (*p) != 'v') && isCOBOLwordchar(*p)) { + chAttr = SCE_C_IDENTIFIER; + break; + } + ++p; + } + } + else { + if (a_keywords.InList(s)) { + chAttr = SCE_C_WORD; + } + else if (b_keywords.InList(s)) { + chAttr = SCE_C_WORD2; + } + else if (c_keywords.InList(s)) { + chAttr = SCE_C_UUID; + } + } + if (*bAarea) { + if (strcmp(s, "division") == 0) { + ret = IN_DIVISION; + // we've determined the containment, anything else is just ignored for those purposes + *bAarea = false; + } else if (strcmp(s, "declaratives") == 0) { + ret = IN_DIVISION | IN_DECLARATIVES; + if (nContainment & IN_DECLARATIVES) + ret |= NOT_HEADER | IN_SECTION; + // we've determined the containment, anything else is just ignored for those purposes + *bAarea = false; + } else if (strcmp(s, "section") == 0) { + ret = (nContainment &~ IN_PARAGRAPH) | IN_SECTION; + // we've determined the containment, anything else is just ignored for those purposes + *bAarea = false; + } else if (strcmp(s, "end") == 0 && (nContainment & IN_DECLARATIVES)) { + ret = IN_DIVISION | IN_DECLARATIVES | IN_SECTION | NOT_HEADER; + } else { + ret = nContainment | IN_PARAGRAPH; + } + } + ColourTo(styler, end, chAttr); + return ret; +} + +static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], + Accessor &styler) { + + styler.StartAt(startPos); + + int state = initStyle; + if (state == SCE_C_CHARACTER) // Does not leak onto next line + state = SCE_C_DEFAULT; + char chPrev = ' '; + char chNext = styler[startPos]; + unsigned int lengthDoc = startPos + length; + + int nContainment; + + int currentLine = styler.GetLine(startPos); + if (currentLine > 0) { + styler.SetLineState(currentLine, styler.GetLineState(currentLine-1)); + nContainment = styler.GetLineState(currentLine); + nContainment &= ~NOT_HEADER; + } else { + styler.SetLineState(currentLine, 0); + nContainment = 0; + } + + styler.StartSegment(startPos); + bool bNewLine = true; + bool bAarea = !isspacechar(chNext); + int column = 0; + for (unsigned int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + + chNext = styler.SafeGetCharAt(i + 1); + + ++column; + + if (bNewLine) { + column = 0; + } + if (column <= 1 && !bAarea) { + bAarea = !isspacechar(ch); + } + bool bSetNewLine = false; + if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { + // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix) + // Avoid triggering two times on Dos/Win + // End of line + if (state == SCE_C_CHARACTER) { + ColourTo(styler, i, state); + state = SCE_C_DEFAULT; + } + styler.SetLineState(currentLine, nContainment); + currentLine++; + bSetNewLine = true; + if (nContainment & NOT_HEADER) + nContainment &= ~(NOT_HEADER | IN_DECLARATIVES | IN_SECTION); + } + + if (styler.IsLeadByte(ch)) { + chNext = styler.SafeGetCharAt(i + 2); + chPrev = ' '; + i += 1; + continue; + } + + if (state == SCE_C_DEFAULT) { + if (isCOBOLwordstart(ch) || (ch == '$' && isascii(chNext) && isalpha(chNext))) { + ColourTo(styler, i-1, state); + state = SCE_C_IDENTIFIER; + } else if (column == 0 && ch == '*' && chNext != '*') { + ColourTo(styler, i-1, state); + state = SCE_C_COMMENTLINE; + } else if (column == 0 && ch == '/' && chNext != '*') { + ColourTo(styler, i-1, state); + state = SCE_C_COMMENTLINE; + } else if (column == 0 && ch == '*' && chNext == '*') { + ColourTo(styler, i-1, state); + state = SCE_C_COMMENTDOC; + } else if (column == 0 && ch == '/' && chNext == '*') { + ColourTo(styler, i-1, state); + state = SCE_C_COMMENTDOC; + } else if (ch == '"') { + ColourTo(styler, i-1, state); + state = SCE_C_STRING; + } else if (ch == ''') { + ColourTo(styler, i-1, state); + state = SCE_C_CHARACTER; + } else if (ch == '?' && column == 0) { + ColourTo(styler, i-1, state); + state = SCE_C_PREPROCESSOR; + } else if (isCOBOLoperator(ch)) { + ColourTo(styler, i-1, state); + ColourTo(styler, i, SCE_C_OPERATOR); + } + } else if (state == SCE_C_IDENTIFIER) { + if (!isCOBOLwordchar(ch)) { + int lStateChange = classifyWordCOBOL(styler.GetStartSegment(), i - 1, keywordlists, styler, nContainment, &bAarea); + + if(lStateChange != 0) { + styler.SetLineState(currentLine, lStateChange); + nContainment = lStateChange; + } + + state = SCE_C_DEFAULT; + chNext = styler.SafeGetCharAt(i + 1); + if (ch == '"') { + state = SCE_C_STRING; + } else if (ch == ''') { + state = SCE_C_CHARACTER; + } else if (isCOBOLoperator(ch)) { + ColourTo(styler, i, SCE_C_OPERATOR); + } + } + } else { + if (state == SCE_C_PREPROCESSOR) { + if ((ch == '\r' || ch == '\n') && !(chPrev == '\' || chPrev == '\r')) { + ColourTo(styler, i-1, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_COMMENT) { + if (ch == '\r' || ch == '\n') { + ColourTo(styler, i, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_COMMENTDOC) { + if (ch == '\r' || ch == '\n') { + if (((i > styler.GetStartSegment() + 2) || ( + (initStyle == SCE_C_COMMENTDOC) && + (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) { + ColourTo(styler, i, state); + state = SCE_C_DEFAULT; + } + } + } else if (state == SCE_C_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + ColourTo(styler, i-1, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_STRING) { + if (ch == '"') { + ColourTo(styler, i, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_CHARACTER) { + if (ch == ''') { + ColourTo(styler, i, state); + state = SCE_C_DEFAULT; + } + } + } + chPrev = ch; + bNewLine = bSetNewLine; + if (bNewLine) + { + bAarea = false; + } + } + ColourTo(styler, lengthDoc - 1, state); +} + +static void FoldCOBOLDoc(unsigned int startPos, int length, int, WordList *[], + Accessor &styler) { + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + unsigned int endPos = startPos + length; + int visibleChars = 0; + int lineCurrent = styler.GetLine(startPos); + int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK : 0xFFF; + char chNext = styler[startPos]; + + bool bNewLine = true; + bool bAarea = !isspacechar(chNext); + int column = 0; + bool bComment = false; + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + ++column; + + if (bNewLine) { + column = 0; + bComment = (ch == '*' || ch == '/' || ch == '?'); + } + if (column <= 1 && !bAarea) { + bAarea = !isspacechar(ch); + } + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + if (atEOL) { + int nContainment = styler.GetLineState(lineCurrent); + int lev = CountBits(nContainment & IN_FLAGS) | SC_FOLDLEVELBASE; + if (bAarea && !bComment) + --lev; + if (visibleChars == 0 && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if ((bAarea) && (visibleChars > 0) && !(nContainment & NOT_HEADER) && !bComment) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + if ((lev & SC_FOLDLEVELNUMBERMASK) <= (levelPrev & SC_FOLDLEVELNUMBERMASK)) { + // this level is at the same level or less than the previous line + // therefore these is nothing for the previous header to collapse, so remove the header + styler.SetLevel(lineCurrent - 1, levelPrev & ~SC_FOLDLEVELHEADERFLAG); + } + levelPrev = lev; + visibleChars = 0; + bAarea = false; + bNewLine = true; + lineCurrent++; + } else { + bNewLine = false; + } + + + if (!isspacechar(ch)) + visibleChars++; + } + + // Fill in the real level of the next line, keeping the current flags as they will be filled in later + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + styler.SetLevel(lineCurrent, levelPrev | flagsNext); +} + +static const char * const COBOLWordListDesc[] = { + "A Keywords", + "B Keywords", + "Extended Keywords", + 0 +}; + +LexerModule lmCOBOL(SCLEX_COBOL, ColouriseCOBOLDoc, "COBOL", FoldCOBOLDoc, COBOLWordListDesc);
Property changes on: trunk/scintilla/lexers/LexCOBOL.cxx ___________________________________________________________________ Added: svn:mime-type + text/x-c++src Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native
Modified: trunk/scintilla/makefile.win32 =================================================================== --- trunk/scintilla/makefile.win32 2011-01-30 13:48:21 UTC (rev 5532) +++ trunk/scintilla/makefile.win32 2011-01-30 15:03:51 UTC (rev 5533) @@ -62,6 +62,7 @@ LexAda.o \ LexAsm.o \ LexBash.o \ +LexCOBOL.o \ LexCSS.o \ LexCPP.o \ LexHTML.o \
Modified: trunk/scintilla/src/Catalogue.cxx =================================================================== --- trunk/scintilla/src/Catalogue.cxx 2011-01-30 13:48:21 UTC (rev 5532) +++ trunk/scintilla/src/Catalogue.cxx 2011-01-30 15:03:51 UTC (rev 5533) @@ -86,6 +86,7 @@ LINK_LEXER(lmBash); LINK_LEXER(lmCaml); LINK_LEXER(lmCmake); + LINK_LEXER(lmCOBOL); LINK_LEXER(lmCPP); LINK_LEXER(lmCss); LINK_LEXER(lmD);
Modified: trunk/src/editor.c =================================================================== --- trunk/src/editor.c 2011-01-30 13:48:21 UTC (rev 5532) +++ trunk/src/editor.c 2011-01-30 15:03:51 UTC (rev 5533) @@ -3364,6 +3364,7 @@ { switch (lexer) { + case SCLEX_COBOL: case SCLEX_CPP: return (style == SCE_C_COMMENT || style == SCE_C_COMMENTDOC); @@ -4842,6 +4843,7 @@ case SCLEX_MAKEFILE: case SCLEX_ASM: case SCLEX_SQL: + case SCLEX_COBOL: case SCLEX_PROPERTIES: case SCLEX_FORTRAN: /* Is this the best option for Fortran? */ case SCLEX_CAML:
Modified: trunk/src/filetypes.c =================================================================== --- trunk/src/filetypes.c 2011-01-30 13:48:21 UTC (rev 5532) +++ trunk/src/filetypes.c 2011-01-30 15:03:51 UTC (rev 5533) @@ -347,6 +347,13 @@ ft->mime_type = g_strdup("text/x-sql"); ft->group = GEANY_FILETYPE_GROUP_MISC;
+#define COBOL + ft = filetypes[GEANY_FILETYPES_COBOL]; + ft->lang = 41; + ft->name = g_strdup("COBOL"); + filetype_make_title(ft, TITLE_FILE); + ft->group = GEANY_FILETYPE_GROUP_MISC; + #define LATEX ft = filetypes[GEANY_FILETYPES_LATEX]; ft->lang = 8;
Modified: trunk/src/filetypes.h =================================================================== --- trunk/src/filetypes.h 2011-01-30 13:48:21 UTC (rev 5532) +++ trunk/src/filetypes.h 2011-01-30 15:03:51 UTC (rev 5533) @@ -88,6 +88,7 @@ GEANY_FILETYPES_FORTH, GEANY_FILETYPES_LISP, GEANY_FILETYPES_ERLANG, + GEANY_FILETYPES_COBOL, /* ^ append items here */ GEANY_MAX_BUILT_IN_FILETYPES /* Don't use this, use filetypes_array->len instead */ }
Modified: trunk/src/highlighting.c =================================================================== --- trunk/src/highlighting.c 2011-01-30 13:48:21 UTC (rev 5532) +++ trunk/src/highlighting.c 2011-01-30 15:03:51 UTC (rev 5533) @@ -909,7 +909,7 @@ }
-static void styleset_c_like(ScintillaObject *sci, gint ft_id) +static void styleset_c_like(ScintillaObject *sci, gint ft_id, gint lexer) { gint styles[] = { SCE_C_DEFAULT, @@ -935,7 +935,7 @@ SCE_C_GLOBALCLASS };
- apply_filetype_properties(sci, SCLEX_CPP, ft_id); + 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 */ @@ -957,7 +957,7 @@
static void styleset_c(ScintillaObject *sci, gint ft_id) { - styleset_c_like(sci, 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 */ @@ -1528,7 +1528,7 @@
static void styleset_java(ScintillaObject *sci, gint ft_id) { - styleset_c_like(sci, 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 */ @@ -1740,6 +1740,28 @@ }
+static void styleset_cobol_init(gint 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, gint 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(gint ft_id, GKeyFile *config, GKeyFile *config_home) { new_styleset(ft_id, 12); @@ -2904,7 +2926,7 @@
static void styleset_ferite(ScintillaObject *sci, gint ft_id) { - styleset_c_like(sci, 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]); @@ -3082,7 +3104,7 @@
static void styleset_js(ScintillaObject *sci, gint ft_id) { - styleset_c_like(sci, 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]); @@ -3243,7 +3265,7 @@
static void styleset_actionscript(ScintillaObject *sci, gint ft_id) { - styleset_c_like(sci, 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]); @@ -3265,7 +3287,7 @@
static void styleset_haxe(ScintillaObject *sci, gint ft_id) { - styleset_c_like(sci, 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]); @@ -3405,6 +3427,7 @@ 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); @@ -3477,6 +3500,7 @@ 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); @@ -3832,6 +3856,7 @@ { switch (lexer) { + case SCLEX_COBOL: case SCLEX_CPP: return (style == SCE_C_COMMENT || style == SCE_C_COMMENTLINE ||
Modified: trunk/src/plugindata.h =================================================================== --- trunk/src/plugindata.h 2011-01-30 13:48:21 UTC (rev 5532) +++ trunk/src/plugindata.h 2011-01-30 15:03:51 UTC (rev 5533) @@ -54,7 +54,7 @@ * @warning You should not test for values below 200 as previously * @c GEANY_API_VERSION was defined as an enum value, not a macro. */ -#define GEANY_API_VERSION 201 +#define GEANY_API_VERSION 202
/** The Application Binary Interface (ABI) version, incremented whenever * existing fields in the plugin data types have to be changed or reordered.
Modified: trunk/src/symbols.c =================================================================== --- trunk/src/symbols.c 2011-01-30 13:48:21 UTC (rev 5532) +++ trunk/src/symbols.c 2011-01-30 15:03:51 UTC (rev 5533) @@ -626,6 +626,16 @@ &tv_iters.tag_function, _("Functions"), "classviewer-method", NULL); break; + case GEANY_FILETYPES_COBOL: + tag_list_add_groups(tag_store, + &tv_iters.tag_class, _("Program"), "classviewer-class", + &tv_iters.tag_function, _("File"), "classviewer-method", + &tv_iters.tag_namespace, _("Sections"), "classviewer-namespace", + &tv_iters.tag_macro, _("Paragraph"), "classviewer-other", + &tv_iters.tag_struct, _("Group"), "classviewer-struct", + &tv_iters.tag_variable, _("Data"), "classviewer-var", + NULL); + break; case GEANY_FILETYPES_CONF: tag_list_add_groups(tag_store, &tv_iters.tag_namespace, _("Sections"), "classviewer-other",
Modified: trunk/tagmanager/Makefile.am =================================================================== --- trunk/tagmanager/Makefile.am 2011-01-30 13:48:21 UTC (rev 5532) +++ trunk/tagmanager/Makefile.am 2011-01-30 15:03:51 UTC (rev 5533) @@ -36,6 +36,7 @@ abc.c\ basic.c\ c.c\ + cobol.c\ conf.c\ css.c\ diff.c\
Added: trunk/tagmanager/cobol.c =================================================================== --- trunk/tagmanager/cobol.c (rev 0) +++ trunk/tagmanager/cobol.c 2011-01-30 15:03:51 UTC (rev 5533) @@ -0,0 +1,50 @@ +/* +* $Id$ +* +* Copyright (c) 2000-2003, Darren Hiebert +* +* This source code is released for free distribution under the terms of the +* GNU General Public License. +* +* This module contains functions for generating tags for COBOL language +* files. +*/ + +/* +* INCLUDE FILES +*/ +#include "general.h" /* must always come first */ +#include "parse.h" + +/* +* FUNCTION DEFINITIONS +*/ + +static void installCobolRegex (const langType language) +{ + addTagRegex (language, "^[ \t]*[0-9]+[ \t]+([A-Z0-9][A-Z0-9-]*)[ \t]+(BLANK|OCCURS|IS|JUST|PIC|REDEFINES|RENAMES|SIGN|SYNC|USAGE|VALUE)", + "\1", "d,variable,data items", "i"); + addTagRegex (language, "^[ \t]*[FSR]D[ \t]+([A-Z0-9][A-Z0-9-]*)\.", + "\1", "f,function,file descriptions (FD, SD, RD)", "i"); + addTagRegex (language, "^[ \t]*[0-9]+[ \t]+([A-Z0-9][A-Z0-9-]*)\.", + "\1", "g,struct,group items", "i"); + addTagRegex (language, "^[ \t]*([A-Z0-9][A-Z0-9-]*)\.", + "\1", "p,macro,paragraphs", "i"); + addTagRegex (language, "^[ \t]*PROGRAM-ID\.[ \t]+([A-Z0-9][A-Z0-9-]*)\.", + "\1", "P,class,program ids", "i"); + addTagRegex (language, "^[ \t]*([A-Z0-9][A-Z0-9-]*)[ \t]+SECTION\.", + "\1", "n,namespace,sections", "i"); +} + +extern parserDefinition* CobolParser () +{ + static const char *const extensions [] = { + "cbl", "cob", "cpy", "CBL", "COB", NULL }; + parserDefinition* def = parserNew ("Cobol"); + def->extensions = extensions; + def->initialize = installCobolRegex; + def->regex = TRUE; + return def; +} + +/* vi:set tabstop=4 shiftwidth=4: */
Property changes on: trunk/tagmanager/cobol.c ___________________________________________________________________ Added: svn:mime-type + text/x-csrc Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native
Modified: trunk/tagmanager/makefile.win32 =================================================================== --- trunk/tagmanager/makefile.win32 2011-01-30 13:48:21 UTC (rev 5532) +++ trunk/tagmanager/makefile.win32 2011-01-30 15:03:51 UTC (rev 5533) @@ -39,7 +39,7 @@ clean: -$(RM) deps.mak *.o $(COMPLIB)
-$(COMPLIB): abc.o args.o c.o fortran.o make.o conf.o pascal.o perl.o php.o diff.o vhdl.o verilog.o lua.o js.o \ +$(COMPLIB): abc.o args.o c.o cobol.c fortran.o make.o conf.o pascal.o perl.o php.o diff.o vhdl.o verilog.o lua.o js.o \ actionscript.o nsis.o \ haskell.o haxe.o html.o python.o lregex.o rest.o sh.o ctags.o entry.o get.o keyword.o nestlevel.o \ options.o \
Modified: trunk/tagmanager/parsers.h =================================================================== --- trunk/tagmanager/parsers.h 2011-01-30 13:48:21 UTC (rev 5532) +++ trunk/tagmanager/parsers.h 2011-01-30 15:03:51 UTC (rev 5533) @@ -55,7 +55,8 @@ Txt2tagsParser, \ AbcParser, \ VerilogParser, \ - RParser + RParser, \ + CobolParser /* langType of each parser 0 CParser @@ -99,6 +100,7 @@ 38 AbcParser 39 Verilog 40 RParser +41 CobolParser */ #endif /* _PARSERS_H */
Modified: trunk/wscript =================================================================== --- trunk/wscript 2011-01-30 13:48:21 UTC (rev 5532) +++ trunk/wscript 2011-01-30 15:03:51 UTC (rev 5533) @@ -61,7 +61,7 @@
tagmanager_sources = set([ 'tagmanager/args.c', 'tagmanager/abc.c', 'tagmanager/actionscript.c', 'tagmanager/asm.c', - 'tagmanager/basic.c', 'tagmanager/c.c', + 'tagmanager/basic.c', 'tagmanager/c.c', 'tagmanager/cobol.c', 'tagmanager/conf.c', 'tagmanager/css.c', 'tagmanager/ctags.c', 'tagmanager/diff.c', 'tagmanager/docbook.c', 'tagmanager/entry.c', 'tagmanager/fortran.c', 'tagmanager/get.c', 'tagmanager/haskell.c', 'tagmanager/haxe.c', 'tagmanager/html.c', 'tagmanager/js.c',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.