Revision: 3716 http://geany.svn.sourceforge.net/geany/?rev=3716&view=rev Author: eht16 Date: 2009-04-21 20:52:19 +0000 (Tue, 21 Apr 2009)
Log Message: ----------- Add a trivial symbol parser for NSIS files.
Modified Paths: -------------- trunk/ChangeLog trunk/src/filetypes.c trunk/src/symbols.c trunk/tagmanager/Makefile.am trunk/tagmanager/makefile.win32 trunk/tagmanager/parsers.h trunk/wscript
Added Paths: ----------- trunk/tagmanager/nsis.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-21 20:51:53 UTC (rev 3715) +++ trunk/ChangeLog 2009-04-21 20:52:19 UTC (rev 3716) @@ -4,6 +4,9 @@ src/prefs.c: Replace our own GEANY_KEYS_MODIFIER_MASK by gtk_accelerator_get_default_mod_mask() which gives the same result. + * src/filetypes.c, src/symbols.c, tagmanager/Makefile.am, + tagmanager/makefile.win32, tagmanager/parsers.h, wscript: + Add a trivial symbol parser for NSIS files.
2009-04-19 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/filetypes.c =================================================================== --- trunk/src/filetypes.c 2009-04-21 20:51:53 UTC (rev 3715) +++ trunk/src/filetypes.c 2009-04-21 20:52:19 UTC (rev 3716) @@ -558,7 +558,7 @@
#define NSIS ft = filetypes[GEANY_FILETYPES_NSIS]; - ft->lang = -2; + ft->lang = 35; ft->name = g_strdup("NSIS"); ft->title = g_strdup_printf(_("%s source file"), "NSIS"); ft->extension = g_strdup("nsis");
Modified: trunk/src/symbols.c =================================================================== --- trunk/src/symbols.c 2009-04-21 20:51:53 UTC (rev 3715) +++ trunk/src/symbols.c 2009-04-21 20:52:19 UTC (rev 3716) @@ -602,6 +602,13 @@ &tv_iters.tag_macro, _("Keys"), "classviewer-var", NULL); break; + case GEANY_FILETYPES_NSIS: + tag_list_add_groups(tag_store, + &tv_iters.tag_namespace, _("Sections"), "classviewer-other", + &tv_iters.tag_function, _("Functions"), "classviewer-method", + &(tv_iters.tag_variable), _("Variables"), "classviewer-var", + NULL); + break; case GEANY_FILETYPES_LATEX: { tag_list_add_groups(tag_store,
Modified: trunk/tagmanager/Makefile.am =================================================================== --- trunk/tagmanager/Makefile.am 2009-04-21 20:51:53 UTC (rev 3715) +++ trunk/tagmanager/Makefile.am 2009-04-21 20:52:19 UTC (rev 3716) @@ -61,6 +61,7 @@ sh.c\ vhdl.c\ actionscript.c\ + nsis.c\ ctags.c\ entry.c\ get.c\
Modified: trunk/tagmanager/makefile.win32 =================================================================== --- trunk/tagmanager/makefile.win32 2009-04-21 20:51:53 UTC (rev 3715) +++ trunk/tagmanager/makefile.win32 2009-04-21 20:52:19 UTC (rev 3716) @@ -40,7 +40,7 @@ -$(RM) deps.mak *.o $(COMPLIB)
$(COMPLIB): args.o c.o fortran.o make.o conf.o pascal.o perl.o php.o diff.o vhdl.o lua.o js.o \ -actionscript.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 options.o \ parse.o basic.o read.o sort.o strlist.o latex.o matlab.o docbook.o tcl.o ruby.o asm.o sql.o css.o \ vstring.o regex.o tm_workspace.o tm_work_object.o tm_source_file.o tm_project.o tm_tag.o \
Added: trunk/tagmanager/nsis.c =================================================================== --- trunk/tagmanager/nsis.c (rev 0) +++ trunk/tagmanager/nsis.c 2009-04-21 20:52:19 UTC (rev 3716) @@ -0,0 +1,149 @@ +/* +* $Id$ +* +* Copyright (c) 2000-2002, Darren Hiebert +* Copyright (c) 2009, Enrico Tröger +* +* 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 NSIS scripts (based on sh.c). +*/ + +/* +* INCLUDE FILES +*/ +#include "general.h" /* must always come first */ + +#include <string.h> + +#include "parse.h" +#include "read.h" +#include "main.h" +#include "vstring.h" + +/* +* DATA DEFINITIONS +*/ +typedef enum { + K_SECTION, + K_FUNCTION, + K_VARIABLE +} NsisKind; + +static kindOption NsisKinds [] = { + { TRUE, 'n', "namespace", "sections"}, + { TRUE, 'f', "function", "functions"}, + { TRUE, 'v', "variable", "variables"} +}; + +/* +* FUNCTION DEFINITIONS +*/ + +static void findNsisTags (void) +{ + vString *name = vStringNew (); + const unsigned char *line; + + while ((line = fileReadLine ()) != NULL) + { + const unsigned char* cp = line; + + while (isspace (*cp)) + cp++; + + if (*cp == '#' || *cp == ';') + continue; + + /* functions */ + if (strncasecmp ((const char*) cp, "function", (size_t) 8) == 0 && + isspace ((int) cp [8])) + { + cp += 8; + /* skip all whitespace */ + while (isspace ((int) *cp)) + ++cp; + while (isalnum ((int) *cp) || *cp == '_' || *cp == '-' || *cp == '.' || *cp == '!') + { + vStringPut (name, (int) *cp); + ++cp; + } + vStringTerminate (name); + makeSimpleTag (name, NsisKinds, K_FUNCTION); + vStringClear (name); + } + /* variables */ + else if (strncasecmp ((const char*) cp, "var", (size_t) 3) == 0 && + isspace ((int) cp [3])) + { + cp += 3; + /* skip all whitespace */ + while (isspace ((int) *cp)) + ++cp; + /* skip any flags */ + while (*cp == '/') + { + ++cp; + while (! isspace ((int) *cp)) + ++cp; + while (isspace ((int) *cp)) + ++cp; + } + while (isalnum ((int) *cp) || *cp == '_') + { + vStringPut (name, (int) *cp); + ++cp; + } + vStringTerminate (name); + makeSimpleTag (name, NsisKinds, K_VARIABLE); + vStringClear (name); + } + /* sections */ + else if (strncasecmp ((const char*) cp, "section", (size_t) 7) == 0 && + isspace ((int) cp [7])) + { + boolean in_quotes = FALSE; + cp += 7; + /* skip all whitespace */ + while (isspace ((int) *cp)) + ++cp; + while (isalnum ((int) *cp) || isspace ((int) *cp) || + *cp == '_' || *cp == '-' || *cp == '.' || *cp == '!' || *cp == '"') + { + if (*cp == '"') + { + if (in_quotes) + break; + else + { + in_quotes = TRUE; + ++cp; + continue; + } + } + vStringPut (name, (int) *cp); + ++cp; + } + vStringTerminate (name); + makeSimpleTag (name, NsisKinds, K_SECTION); + vStringClear (name); + } + } + vStringDelete (name); +} + +extern parserDefinition* NsisParser (void) +{ + static const char *const extensions [] = { + "nsi", "nsh", NULL + }; + parserDefinition* def = parserNew ("NSIS"); + def->kinds = NsisKinds; + def->kindCount = KIND_COUNT (NsisKinds); + def->extensions = extensions; + def->parser = findNsisTags; + return def; +} + +/* vi:set tabstop=8 shiftwidth=4: */
Property changes on: trunk/tagmanager/nsis.c ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native
Modified: trunk/tagmanager/parsers.h =================================================================== --- trunk/tagmanager/parsers.h 2009-04-21 20:51:53 UTC (rev 3715) +++ trunk/tagmanager/parsers.h 2009-04-21 20:52:19 UTC (rev 3716) @@ -49,7 +49,8 @@ GLSLParser, \ MatlabParser, \ ValaParser, \ - ActionScriptParser + ActionScriptParser, \ + NsisParser
/* langType of each parser @@ -88,6 +89,7 @@ 32 MatlabParser 33 ValaParser 34 ActionScriptParser +35 NsisParser */ #endif /* _PARSERS_H */
Modified: trunk/wscript =================================================================== --- trunk/wscript 2009-04-21 20:51:53 UTC (rev 3715) +++ trunk/wscript 2009-04-21 20:52:19 UTC (rev 3716) @@ -58,8 +58,8 @@ 'tagmanager/docbook.c', 'tagmanager/entry.c', 'tagmanager/fortran.c', 'tagmanager/get.c', 'tagmanager/haskell.c', 'tagmanager/haxe.c', 'tagmanager/html.c', 'tagmanager/js.c', 'tagmanager/keyword.c', 'tagmanager/latex.c', 'tagmanager/lregex.c', 'tagmanager/lua.c', - 'tagmanager/make.c', 'tagmanager/matlab.c', 'tagmanager/options.c', 'tagmanager/parse.c', - 'tagmanager/pascal.c', + 'tagmanager/make.c', 'tagmanager/matlab.c', 'tagmanager/nsis.c', 'tagmanager/options.c', + 'tagmanager/parse.c', 'tagmanager/pascal.c', 'tagmanager/perl.c', 'tagmanager/php.c', 'tagmanager/python.c', 'tagmanager/read.c', 'tagmanager/rest.c', 'tagmanager/ruby.c', 'tagmanager/sh.c', 'tagmanager/sort.c', 'tagmanager/sql.c', 'tagmanager/strlist.c', 'tagmanager/tcl.c', 'tagmanager/tm_file_entry.c',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.