Kaydet (Commit) 010d6581 authored tarafından Enrico Tröger's avatar Enrico Tröger

Added new filetypes Diff and Ferite.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@765 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst a8a33cd9
2006-08-27 Enrico Tröger <enrico.troeger@uvena.de>
* tagmanager/parsers.h, tagmanager/c.c, data/filetype_extensions.conf,
data/filetypes.diff, data/filetypes.ferite, src/highlighting.c,
src/filetypes.c, src/msgwindow.c:
Added new filetypes Diff and Ferite.
2006-08-26 Enrico Tröger <enrico.troeger@uvena.de>
* src/geany.h, src/main.c, src/utils.c:
......
......@@ -9,6 +9,7 @@ Java=*.java;
Pascal=*.pas;*.pp;*.inc;*.dpr;*.dpk;
ASM=*.asm;
Fortran=*.f;*.f77;*.f90;*.f95;*.for;*.ftn;
Ferite=*.fe;
CAML=*.ml;*.mli;
Perl=*.pl;*.perl;*.pm;
PHP=*.php;*.php3;*.php4;*.php5;*.html;*.htm;
......@@ -24,4 +25,5 @@ SQL=*.sql;
LaTeX=*.tex;*.sty;*.idx;
O-Matrix=*.oms;
Conf=*.conf;*.ini;config;*rc;*.cfg;
Diff=*.diff;*.patch;
None=*;
# For complete documentation of this file, please see Geany's main documentation
[styling]
# foreground;background;bold;italic
default=0x000000;0xffffff;false;false
comment=0x808080;0xffffff;false;false
command=0x7f7f00;0xffffff;false;false
header=0x7f0000;0xffffff;false;false
position=0x00007f;0xffffff;false;false
deleted=0xff2727;0xffffff;false;false
added=0x34b034;0xffffff;false;false
[settings]
# the following characters are these which a "word" can contains, see documentation
wordchars=_#&abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
# only the text before the first --- is a comment
comment_open=
comment_close=
# For complete documentation of this file, please see Geany's main documentation
[styling]
# foreground;background;bold;italic
default=0x000000;0xffffff;false;false
comment=0xff0000;0xffffff;false;false
commentline=0xff0000;0xffffff;false;false
commentdoc=0xff0000;0xffffff;false;false
number=0x007f00;0xffffff;false;false
word=0x00007f;0xffffff;true;false
word2=0x991111;0xffffff;true;false
string=0xff901e;0xffffff;false;false
character=0xff901e;0xffffff;false;false
uuid=0x404080;0xffffff;false;false
preprocessor=0x007F7F;0xffffff;false;false
operator=0x301010;0xffffff;false;false
identifier=0x000000;0xffffff;false;false
stringeol=0x000000;0xe0c0e0;false;false
verbatim=0x101030;0xffffff;false;false
regex=0x105090;0xffffff;false;false
commentlinedoc=0xff0000;0xffffff;true;false
commentdockeyword=0xff0000;0xffffff;true;true
globalclass=0x1111bb;0xffffff;true;false
[keywords]
# all items must be in one line
primary=false null self super true abstract alias arguments attribute_missing break case class closure conformsToProtocol constructor default deliver destructor diliver do else extends final fix for function if iferr implements include instanceof method_missing modifies namespace new private protected protocol public recipient rename return static switch uses using while
types=string number array object void
docComment=@brief @class @declaration @description @end @example @extends @function @group @implements @modifies @module @namespace @param @protocol @return @return @static @type @variable @warning
[settings]
# 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=
# this is an alternative way, so multiline comments are used
#comment_open=/*
#comment_close=*/
# set to false if a comment character/string should start at column 0 of a line, true uses any
# indention of the line, e.g. setting to true causes the following on pressing CTRL+d
#command_example();
# setting to false would generate this
# command_example();
# This setting works only for single line comments
comment_use_indent=true
[build_settings]
# %f will be replaced by the complete filename
# %e will be replaced by the filename without extension
# (use only one of it at one time)
compiler=ferite -c "%f"
run_cmd=ferite "%f"
......@@ -58,8 +58,10 @@ enum
FILETYPE_UID_TCL, // 19
FILETYPE_UID_ALL, // 20
FILETYPE_UID_D, // 21
FILETYPE_UID_FORTRAN // 22
//FILETYPE_UID_HTML, // 23
FILETYPE_UID_FORTRAN, // 22
FILETYPE_UID_DIFF, // 23
FILETYPE_UID_FERITE // 24
//FILETYPE_UID_HTML, // 25
};
......@@ -98,6 +100,8 @@ filetype *filetypes_get_from_uid(gint uid)
case FILETYPE_UID_ALL: return filetypes[GEANY_FILETYPES_ALL];
case FILETYPE_UID_D: return filetypes[GEANY_FILETYPES_D];
case FILETYPE_UID_FORTRAN: return filetypes[GEANY_FILETYPES_FORTRAN];
case FILETYPE_UID_DIFF: return filetypes[GEANY_FILETYPES_DIFF];
case FILETYPE_UID_FERITE: return filetypes[GEANY_FILETYPES_FERITE];
//case FILETYPE_UID_HTML: return filetypes[GEANY_FILETYPES_HTML];
default: return NULL;
}
......@@ -397,6 +401,25 @@ void filetypes_init_types(void)
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_TCL]);
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_TCL]->title, filetypes[GEANY_FILETYPES_TCL]);
#define FERITE
filetypes[GEANY_FILETYPES_FERITE] = g_new0(filetype, 1);
filetypes[GEANY_FILETYPES_FERITE]->id = GEANY_FILETYPES_FERITE;
filetypes[GEANY_FILETYPES_FERITE]->uid = FILETYPE_UID_FERITE;
filetypes[GEANY_FILETYPES_FERITE]->item = NULL;
filetypes[GEANY_FILETYPES_FERITE]->lang = 19;
filetypes[GEANY_FILETYPES_FERITE]->name = g_strdup("Ferite");
filetypes[GEANY_FILETYPES_FERITE]->has_tags = TRUE;
filetypes[GEANY_FILETYPES_FERITE]->title = g_strdup(_("Ferite source file"));
filetypes[GEANY_FILETYPES_FERITE]->extension = g_strdup("fe");
filetypes[GEANY_FILETYPES_FERITE]->pattern = g_new0(gchar*, 2);
filetypes[GEANY_FILETYPES_FERITE]->pattern[0] = g_strdup("*.fe");
filetypes[GEANY_FILETYPES_FERITE]->pattern[1] = NULL;
filetypes[GEANY_FILETYPES_FERITE]->style_func_ptr = styleset_ferite;
filetypes[GEANY_FILETYPES_FERITE]->comment_open = g_strdup("/*");
filetypes[GEANY_FILETYPES_FERITE]->comment_close = g_strdup("*/");
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_FERITE]);
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_FERITE]->title, filetypes[GEANY_FILETYPES_FERITE]);
#define SH
filetypes[GEANY_FILETYPES_SH] = g_new0(filetype, 1);
filetypes[GEANY_FILETYPES_SH]->id = GEANY_FILETYPES_SH;
......@@ -559,6 +582,26 @@ void filetypes_init_types(void)
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_OMS]);
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_OMS]->title, filetypes[GEANY_FILETYPES_OMS]);
#define DIFF
filetypes[GEANY_FILETYPES_DIFF] = g_new0(filetype, 1);
filetypes[GEANY_FILETYPES_DIFF]->id = GEANY_FILETYPES_DIFF;
filetypes[GEANY_FILETYPES_DIFF]->uid = FILETYPE_UID_DIFF;
filetypes[GEANY_FILETYPES_DIFF]->item = NULL;
filetypes[GEANY_FILETYPES_DIFF]->lang = -2;
filetypes[GEANY_FILETYPES_DIFF]->name = g_strdup("Diff");
filetypes[GEANY_FILETYPES_DIFF]->has_tags = FALSE;
filetypes[GEANY_FILETYPES_DIFF]->title = g_strdup(_("Diff file"));
filetypes[GEANY_FILETYPES_DIFF]->extension = g_strdup("diff");
filetypes[GEANY_FILETYPES_DIFF]->pattern = g_new0(gchar*, 3);
filetypes[GEANY_FILETYPES_DIFF]->pattern[0] = g_strdup("*.diff");
filetypes[GEANY_FILETYPES_DIFF]->pattern[1] = g_strdup("*.patch");
filetypes[GEANY_FILETYPES_DIFF]->pattern[2] = NULL;
filetypes[GEANY_FILETYPES_DIFF]->style_func_ptr = styleset_diff;
filetypes[GEANY_FILETYPES_DIFF]->comment_open = g_strdup("#");
filetypes[GEANY_FILETYPES_DIFF]->comment_close = NULL;
filetypes_init_build_programs(filetypes[GEANY_FILETYPES_DIFF]);
filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_DIFF]->title, filetypes[GEANY_FILETYPES_DIFF]);
#define CONF
filetypes[GEANY_FILETYPES_CONF] = g_new0(filetype, 1);
filetypes[GEANY_FILETYPES_CONF]->id = GEANY_FILETYPES_CONF;
......
......@@ -47,6 +47,7 @@ enum
GEANY_FILETYPES_PYTHON,
GEANY_FILETYPES_RUBY,
GEANY_FILETYPES_TCL,
GEANY_FILETYPES_FERITE,
GEANY_FILETYPES_SH,
GEANY_FILETYPES_MAKE,
GEANY_FILETYPES_XML,
......@@ -58,6 +59,7 @@ enum
GEANY_FILETYPES_SQL,
GEANY_FILETYPES_LATEX,
GEANY_FILETYPES_OMS,
GEANY_FILETYPES_DIFF,
GEANY_FILETYPES_CONF,
GEANY_FILETYPES_ALL,
GEANY_MAX_FILE_TYPES
......
This diff is collapsed.
......@@ -92,4 +92,8 @@ void styleset_d(ScintillaObject *sci);
void styleset_fortran(ScintillaObject *sci);
void styleset_diff(ScintillaObject *sci);
void styleset_ferite(ScintillaObject *sci);
#endif
......@@ -415,6 +415,16 @@ void msgwin_parse_compiler_error_line(const gchar *string, gchar **filename, gin
field_idx_file = 2;
break;
}
case GEANY_FILETYPES_FERITE:
{
// Error: Parse Error: on line 5 in "/misc/tmp/testfiles_geany/hello.fe"
pattern = " \"";
field_min_len = 10;
field_idx_line = 5;
field_idx_file = 8;
break;
}
default: return;
}
......@@ -441,8 +451,11 @@ void msgwin_parse_compiler_error_line(const gchar *string, gchar **filename, gin
if (strncmp(fields[field_idx_file], "./", 2) == 0) skip_dot_slash = 2;
// get the build directory to get the path to look for other files
if (! utils_is_absolute_path(fields[field_idx_file]))
*filename = g_strconcat(build_info.dir, G_DIR_SEPARATOR_S,
fields[field_idx_file] + skip_dot_slash, NULL);
else
*filename = g_strdup(fields[field_idx_file]);
g_strfreev(fields);
}
......
......@@ -76,7 +76,7 @@ typedef enum eKeywordId {
KEYWORD_SYNCHRONIZED,
KEYWORD_TEMPLATE, KEYWORD_THROW, KEYWORD_THROWS, KEYWORD_TRANSIENT,
KEYWORD_TRY, KEYWORD_TYPEDEF, KEYWORD_TYPENAME,
KEYWORD_UNION, KEYWORD_UNSIGNED, KEYWORD_USING,
KEYWORD_UNION, KEYWORD_UNSIGNED, KEYWORD_USES, KEYWORD_USING,
KEYWORD_VIRTUAL, KEYWORD_VOID, KEYWORD_VOLATILE,
KEYWORD_WCHAR_T
} keywordId;
......@@ -234,6 +234,7 @@ static langType Lang_c;
static langType Lang_cpp;
static langType Lang_java;
static langType Lang_d;
static langType Lang_ferite;
/* Used to index into the CKinds table. */
typedef enum {
......@@ -326,6 +327,7 @@ static const keywordDesc KeywordTable [] = {
{ "typename", KEYWORD_TYPENAME, { 0, 1, 0 } },
{ "union", KEYWORD_UNION, { 1, 1, 0 } },
{ "unsigned", KEYWORD_UNSIGNED, { 1, 1, 0 } },
{ "uses", KEYWORD_USES, { 0, 1, 0 } },
{ "using", KEYWORD_USING, { 0, 1, 0 } },
{ "virtual", KEYWORD_VIRTUAL, { 0, 1, 0 } },
{ "void", KEYWORD_VOID, { 1, 1, 1 } },
......@@ -820,7 +822,9 @@ static tagType declToTagType (const declType declaration)
static const char* accessField (const statementInfo *const st)
{
const char* result = NULL;
if ((isLanguage (Lang_cpp) || isLanguage (Lang_d)) && st->scope == SCOPE_FRIEND)
if ((isLanguage (Lang_cpp) || isLanguage (Lang_d) || isLanguage (Lang_ferite)) &&
st->scope == SCOPE_FRIEND)
result = "friend";
else if (st->member.access != ACCESS_UNDEFINED)
result = accessString (st->member.access);
......@@ -867,7 +871,8 @@ static void addOtherFields (tagEntryInfo* const tag, const tagType type,
vStringValue (st->parentClasses);
}
if (st->implementation != IMP_DEFAULT &&
(isLanguage (Lang_cpp) || isLanguage (Lang_java) || isLanguage (Lang_d)))
(isLanguage (Lang_cpp) || isLanguage (Lang_java) ||
isLanguage (Lang_d) || isLanguage (Lang_ferite)))
{
tag->extensionFields.implementation =
implementationString (st->implementation);
......@@ -901,7 +906,8 @@ static void addOtherFields (tagEntryInfo* const tag, const tagType type,
static void addContextSeparator (vString *const scope)
{
if (isLanguage (Lang_c) || isLanguage (Lang_cpp) || isLanguage (Lang_d))
if (isLanguage (Lang_c) || isLanguage (Lang_cpp) ||
isLanguage (Lang_d) || isLanguage (Lang_ferite))
vStringCatS (scope, "::");
else if (isLanguage (Lang_java))
vStringCatS (scope, ".");
......@@ -1004,9 +1010,17 @@ static void makeTag (const tokenInfo *const token,
if (isType (token, TOKEN_NAME) && vStringLength (token->name) > 0 /* &&
includeTag (type, isFileScope) */)
{
vString *scope = vStringNew ();
vString *scope;
tagEntryInfo e;
// take only functions which are introduced by "function ..."
if (type == TAG_FUNCTION && isLanguage (Lang_ferite) &&
strncmp("function", st->firstToken->name->buffer, 8) != 0)
{
return;
}
scope = vStringNew ();
initTagEntry (&e, vStringValue (token->name));
e.lineNumber = token->lineNumber;
......@@ -1427,7 +1441,7 @@ static void setAccess (statementInfo *const st, const accessType access)
{
if (isMember (st))
{
if (isLanguage (Lang_cpp) || isLanguage (Lang_d))
if (isLanguage (Lang_cpp) || isLanguage (Lang_d) || isLanguage (Lang_ferite))
{
int c = skipToNonWhite ();
......@@ -1982,7 +1996,8 @@ static void addContext (statementInfo *const st, const tokenInfo* const token)
{
if (vStringLength (st->context->name) > 0)
{
if (isLanguage (Lang_c) || isLanguage (Lang_cpp) || isLanguage (Lang_d))
if (isLanguage (Lang_c) || isLanguage (Lang_cpp) ||
isLanguage (Lang_d) || isLanguage (Lang_ferite))
vStringCatS (st->context->name, "::");
else if (isLanguage (Lang_java))
vStringCatS (st->context->name, ".");
......@@ -2005,7 +2020,7 @@ static void processColon (statementInfo *const st)
else
{
cppUngetc (c);
if ((isLanguage (Lang_cpp) || isLanguage (Lang_d)) && (
if ((isLanguage (Lang_cpp) || isLanguage (Lang_d) || isLanguage (Lang_ferite)) && (
st->declaration == DECL_CLASS || st->declaration == DECL_STRUCT))
{
readParents (st, ':');
......@@ -2407,7 +2422,13 @@ static void initializeJavaParser (const langType language)
static void initializeDParser (const langType language)
{
Lang_d = language;
buildKeywordHash (language, 17);
buildKeywordHash (language, 1);
}
static void initializeFeriteParser (const langType language)
{
Lang_ferite = language;
buildKeywordHash (language, 1);
}
extern parserDefinition* CParser (void)
......@@ -2425,8 +2446,7 @@ extern parserDefinition* CParser (void)
extern parserDefinition* CppParser (void)
{
static const char *const extensions [] = {
"c++", "cc", "cp", "cpp", "cxx", "h", "h++", "hh", "hp", "hpp", "hxx",
"i",
"c++", "cc", "cp", "cpp", "cxx", "h", "h++", "hh", "hp", "hpp", "hxx", "i",
#ifndef CASE_INSENSITIVE_FILENAMES
"C", "H",
#endif
......@@ -2465,5 +2485,16 @@ extern parserDefinition* DParser (void)
return def;
}
extern parserDefinition* FeriteParser (void)
{
static const char *const extensions [] = { "fe", NULL };
parserDefinition* def = parserNew ("Ferite");
def->kinds = CKinds;
def->kindCount = KIND_COUNT (CKinds);
def->extensions = extensions;
def->parser2 = findCTags;
def->initialize = initializeFeriteParser;
return def;
}
/* vi:set tabstop=8 shiftwidth=4: */
......@@ -33,7 +33,8 @@
TclParser, \
ShParser, \
DParser, \
FortranParser
FortranParser, \
FeriteParser
/*
langType of each parser
......@@ -56,6 +57,7 @@ langType of each parser
16 ShParser
17 DParser
18 FortranParser
19 FeriteParser
*/
#endif /* _PARSERS_H */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment