Kaydet (Commit) 6a85a50d authored tarafından Colomban Wendling's avatar Colomban Wendling

Replace bare CTags parser ID numbers with an enumeration

Avoid using magic numbers in the source for better readability and
easier maintenance.
üst 576be4ca
......@@ -402,8 +402,7 @@ update the ``[Groups]`` section in ``filetype_extensions.conf``.
* Add GEANY_FILETYPES_FOO to filetypes.h.
* Initialize GEANY_FILETYPES_FOO in init_builtin_filetypes() of
filetypes.c. You should use filetype_make_title() to avoid a
translation whenever possible.
filetypes.c.
* Update data/filetype_extensions.conf.
The remaining notes relate mostly to built-in filetypes.
......@@ -527,14 +526,16 @@ Method
* Add foo.c to SRCS in Makefile.am.
* Add foo.o to OBJS in makefile.win32.
* Add path/foo.c to geany_sources in wscript.
* Add Foo to parsers.h & fill in comment with parser number for foo.
* Add Foo to parsers.h
* Add TM_PARSER_FOO to tagmanager/src/tm_parser.h. The list here must follow
exactly the order in parsers.h.
In foo.c:
Edit FooKinds 3rd column to match a s_tag_type_names string in tm_tag.c.
(You may want to make the symbols.c change before doing this).
In filetypes.c, init_builtin_filetypes():
Set filetypes[GEANY_FILETYPES_FOO].lang = foo's parser number.
Set the 2nd argument of the FT_INIT() macro for this filetype to FOO.
In symbols.c:
Unless your parser uses C-like tag type kinds, update
......
This diff is collapsed.
......@@ -14,6 +14,7 @@
#define _PARSERS_H
/* Add the name of any new parser definition function here */
/* keep tagmanager/src/tm_parser.h in sync */
#define PARSER_LIST \
CParser, \
CppParser, \
......@@ -61,55 +62,7 @@
AsciidocParser, \
AbaqusParser, \
RustParser
/*
langType of each parser
0 CParser
1 CppParser
2 JavaParser
3 MakefileParser
4 PascalParser
5 PerlParser
6 PhpParser
7 PythonParser
8 LaTeXParser
9 AsmParser
10 ConfParser
11 SqlParser
12 DocBookParser
13 CssParser
14 RubyParser
15 TclParser
16 ShParser
17 DParser
18 FortranParser
19 FeriteParser
20 DiffParser
21 VhdlParser
22 LuaParser
23 JavaScriptParser
24 HaskellParser
25 CsharpParser
26 FreeBasicParser
27 HaxeParser
28 RestParser
29 HtmlParser
30 F77Parser
31 GLSLParser
32 MatlabParser
33 ValaParser
34 ActionScriptParser
35 NsisParser
36 MarkdownParser
37 Txt2tagsParser
38 AbcParser
39 Verilog
40 RParser
41 CobolParser
42 ObjcParser
43 AsciidocParser
44 AbaqusParser
45 Rust
*/
#endif /* _PARSERS_H */
/* vi:set tabstop=8 shiftwidth=4: */
......@@ -14,6 +14,7 @@ noinst_LIBRARIES = libtagmanager.a
tagmanager_includedir = $(includedir)/geany/tagmanager
tagmanager_include_HEADERS = \
tm_file_entry.h \
tm_parser.h \
tm_project.h \
tm_source_file.h \
tm_symbol.h \
......
/*
*
* Copyright (c) 2014, Colomban Wendling
*
* This source code is released for free distribution under the terms of the
* GNU General Public License.
*
*/
#ifndef TM_PARSER_H
#define TM_PARSER_H
#ifndef LIBCTAGS_DEFINED
/* from ctags/parse.h */
# define LANG_AUTO (-1)
# define LANG_IGNORE (-2)
#endif
/* keep in sync with ctags/parsers.h */
typedef enum
{
TM_PARSER_NONE = LANG_IGNORE,
TM_PARSER_AUTO = LANG_AUTO,
TM_PARSER_C = 0,
TM_PARSER_CPP,
TM_PARSER_JAVA,
TM_PARSER_MAKEFILE,
TM_PARSER_PASCAL,
TM_PARSER_PERL,
TM_PARSER_PHP,
TM_PARSER_PYTHON,
TM_PARSER_LATEX,
TM_PARSER_ASM,
TM_PARSER_CONF,
TM_PARSER_SQL,
TM_PARSER_DOCBOOK,
TM_PARSER_CSS,
TM_PARSER_RUBY,
TM_PARSER_TCL,
TM_PARSER_SH,
TM_PARSER_D,
TM_PARSER_FORTRAN,
TM_PARSER_FERITE,
TM_PARSER_DIFF,
TM_PARSER_VHDL,
TM_PARSER_LUA,
TM_PARSER_JAVASCRIPT,
TM_PARSER_HASKELL,
TM_PARSER_CSHARP,
TM_PARSER_FREEBASIC,
TM_PARSER_HAXE,
TM_PARSER_REST,
TM_PARSER_HTML,
TM_PARSER_F77,
TM_PARSER_GLSL,
TM_PARSER_MATLAB,
TM_PARSER_VALA,
TM_PARSER_ACTIONSCRIPT,
TM_PARSER_NSIS,
TM_PARSER_MARKDOWN,
TM_PARSER_TXT2TAGS,
TM_PARSER_ABC,
TM_PARSER_VERILOG,
TM_PARSER_R,
TM_PARSER_COBOL,
TM_PARSER_OBJC,
TM_PARSER_ASCIIDOC,
TM_PARSER_ABAQUS,
TM_PARSER_RUST,
TM_PARSER_COUNT
} TMParserType;
#endif /* TM_PARSER_H */
......@@ -17,6 +17,7 @@
#include "tm_work_object.h"
#include "tm_source_file.h"
#include "tm_project.h"
#include "tm_parser.h"
/*! \mainpage Introduction
\section Introduction
......
......@@ -514,7 +514,7 @@ def build(bld):
scintilla/include/Scintilla.iface scintilla/include/ScintillaWidget.h ''')
bld.install_files('${PREFIX}/include/geany/tagmanager', '''
tagmanager/src/tm_file_entry.h tagmanager/src/tm_project.h
tagmanager/src/tm_source_file.h
tagmanager/src/tm_source_file.h tagmanager/src/tm_parser.h
tagmanager/src/tm_symbol.h tagmanager/src/tm_tag.h
tagmanager/src/tm_tagmanager.h tagmanager/src/tm_work_object.h
tagmanager/src/tm_workspace.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