Kaydet (Commit) 8942bc81 authored tarafından Colomban Wendling's avatar Colomban Wendling

Add Objective-C support

Based on a patch from Elias Pschernig, thanks.
Parser was taken from upstream CTags.

Closes patch#3325139.
üst e53d5b82
......@@ -38,6 +38,7 @@ Make=*.mak;*.mk;GNUmakefile;makefile;Makefile;makefile.*;Makefile.*;
Markdown=*.mdml;*.markdown;*.md;*.mkd;
Matlab/Octave=*.m;
NSIS=*.nsi;*.nsh;
Objective-C=*.m;*.h;
Pascal=*.pas;*.pp;*.inc;*.dpr;*.dpk;
Perl=*.pl;*.perl;*.pm;*.agi;*.pod;
PHP=*.php;*.php3;*.php4;*.php5;*.phtml;
......
# For complete documentation of this file, please see Geany's main documentation
[styling=C]
[keywords]
# all items must be in one line
primary=asm auto break case char const continue default do double else enum extern float for goto if inline int long register restrict return short signed sizeof static struct switch typedef union unsigned void volatile while FALSE NULL TRUE
secondary=@class @defs @dynamic @encode @end @implementation @interface @optional @package @public @private @property @protocol @protected @required @selector @synthesize @synchronized
# these are some doxygen keywords (incomplete)
docComment=attention author brief bug class code date def enum example exception file fn namespace note param remarks return see since struct throw todo typedef var version warning union
[lexer_properties=C]
[settings]
# default extension used when saving files
extension=m
# the following characters are these which a "word" can contains, see documentation
#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
# single comments, like # in this file
comment_single=//
# multiline comments
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=true
# context action command (please see Geany's main documentation for details)
context_action_cmd=
[indentation]
#width=4
# 0 is spaces, 1 is tabs, 2 is tab & spaces
#type=1
[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=gcc -Wall -c "%f"
linker=gcc -Wall -o "%e" "%f" -lobjc
run_cmd="./%e"
......@@ -2279,6 +2279,7 @@ void document_update_tags(GeanyDocument *doc)
case GEANY_FILETYPES_CS:
case GEANY_FILETYPES_D:
case GEANY_FILETYPES_JAVA:
case GEANY_FILETYPES_OBJECTIVEC:
case GEANY_FILETYPES_VALA:
{
......
......@@ -118,6 +118,14 @@ static void init_builtin_filetypes(void)
ft->mime_type = g_strdup("text/x-c++src");
ft->group = GEANY_FILETYPE_GROUP_COMPILED;
#define OBJECTIVEC
ft = filetypes[GEANY_FILETYPES_OBJECTIVEC];
ft->lang = 42;
ft->name = g_strdup("Objective-C");
filetype_make_title(ft, TITLE_SOURCE_FILE);
ft->mime_type = g_strdup("text/x-objc");
ft->group = GEANY_FILETYPE_GROUP_COMPILED;
#define CS
ft = filetypes[GEANY_FILETYPES_CS];
ft->lang = 25;
......@@ -1430,6 +1438,8 @@ static gchar *filetypes_get_conf_extension(const GeanyFiletype *ft)
case GEANY_FILETYPES_NONE: result = g_strdup("common"); break;
/* name is Matlab/Octave */
case GEANY_FILETYPES_MATLAB: result = g_strdup("matlab"); break;
/* name is Objective-C, and we don't want the hyphen */
case GEANY_FILETYPES_OBJECTIVEC: result = g_strdup("objectivec"); break;
default:
result = g_ascii_strdown(ft->name, -1);
break;
......
......@@ -87,6 +87,7 @@ typedef enum
GEANY_FILETYPES_LISP,
GEANY_FILETYPES_ERLANG,
GEANY_FILETYPES_COBOL,
GEANY_FILETYPES_OBJECTIVEC,
/* ^ append items here */
GEANY_MAX_BUILT_IN_FILETYPES /* Don't use this, use filetypes_array->len instead */
}
......
......@@ -977,6 +977,7 @@ void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *co
init_styleset_case(MATLAB);
init_styleset_case(MARKDOWN);
init_styleset_case(NSIS);
init_styleset_case(OBJECTIVEC);
init_styleset_case(PASCAL);
init_styleset_case(PERL);
init_styleset_case(PHP);
......@@ -1055,6 +1056,7 @@ void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft)
styleset_case(MARKDOWN);
styleset_case(MATLAB);
styleset_case(NSIS);
styleset_case(OBJECTIVEC);
styleset_case(PASCAL);
styleset_case(PERL);
styleset_case(PHP);
......
......@@ -989,6 +989,20 @@ static const HLKeyword highlighting_keywords_NSIS[] =
#define highlighting_properties_NSIS EMPTY_PROPERTIES
/* Objective-C */
#define highlighting_lexer_OBJECTIVEC highlighting_lexer_C
#define highlighting_styles_OBJECTIVEC highlighting_styles_C
static const HLKeyword highlighting_keywords_OBJECTIVEC[] =
{
{ 0, "primary" },
/* SCI_SETKEYWORDS = 1 - secondary + global tags file types, see below */
{ 1, "secondary", TRUE },
{ 2, "docComment" }
/* SCI_SETKEYWORDS = 3 is for current session types - see editor_lexer_get_type_keyword_idx() */
};
#define highlighting_properties_OBJECTIVEC highlighting_properties_C
/* Pascal */
#define highlighting_lexer_PASCAL SCLEX_PASCAL
static const HLStyle highlighting_styles_PASCAL[] =
......
......@@ -53,6 +53,7 @@ libtagmanager_a_SOURCES =\
lregex.c\
matlab.c\
markdown.c\
objc.c\
pascal.c\
perl.c\
rest.c\
......
......@@ -40,7 +40,7 @@ clean:
-$(RM) deps.mak *.o $(COMPLIB)
$(COMPLIB): abc.o args.o c.o cobol.o 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 \
actionscript.o nsis.o objc.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 \
parse.o basic.o read.o sort.o strlist.o latex.o markdown.o matlab.o docbook.o tcl.o ruby.o asm.o sql.o txt2tags.o css.o \
......
This diff is collapsed.
......@@ -56,7 +56,8 @@
AbcParser, \
VerilogParser, \
RParser, \
CobolParser
CobolParser, \
ObjcParser
/*
langType of each parser
0 CParser
......@@ -101,6 +102,7 @@ langType of each parser
39 Verilog
40 RParser
41 CobolParser
42 ObjcParser
*/
#endif /* _PARSERS_H */
......
......@@ -66,7 +66,7 @@ tagmanager_sources = set([
'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/markdown.c', 'tagmanager/matlab.c', 'tagmanager/nsis.c',
'tagmanager/nestlevel.c', 'tagmanager/options.c',
'tagmanager/nestlevel.c', 'tagmanager/objc.c', 'tagmanager/options.c',
'tagmanager/parse.c', 'tagmanager/pascal.c', 'tagmanager/r.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',
......
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