Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Thu, 28 Jul 2016 21:56:05 UTC Commit: 001c7f65e485a223530e23146604d84fa867a9aa https://github.com/geany/geany/commit/001c7f65e485a223530e23146604d84fa867a9...
Log Message: ----------- Move keywordTable definition to parse.h and use it for all parsers
Modified Paths: -------------- ctags/main/parse.h ctags/parsers/asm.c ctags/parsers/fortran.c ctags/parsers/go.c ctags/parsers/jscript.c ctags/parsers/objc.c ctags/parsers/php.c ctags/parsers/sql.c ctags/parsers/verilog.c ctags/parsers/vhdl.c
Modified: ctags/main/parse.h 5 lines changed, 5 insertions(+), 0 deletions(-) =================================================================== @@ -46,6 +46,11 @@ typedef struct sKindOption { } kindOption;
typedef struct { + const char *name; + const int id; +} keywordTable; + +typedef struct { /* defined by parser */ char* name; /* name of language */ kindOption* kinds; /* tag kinds handled by parser */
Modified: ctags/parsers/asm.c 11 lines changed, 3 insertions(+), 8 deletions(-) =================================================================== @@ -52,11 +52,6 @@ typedef enum { } opKeyword;
typedef struct { - const char *operator; - opKeyword keyword; -} asmKeyword; - -typedef struct { opKeyword keyword; AsmKind kind; } opKind; @@ -73,7 +68,7 @@ static kindOption AsmKinds [] = { { TRUE, 't', "type", "types (structs and records)" } };
-static const asmKeyword AsmKeywords [] = { +static const keywordTable AsmKeywords [] = { { "align", OP_ALIGN }, { "endmacro", OP_ENDMACRO }, { "endm", OP_ENDM }, @@ -121,8 +116,8 @@ static void buildAsmKeywordHash (void) size_t i; for (i = 0 ; i < count ; ++i) { - const asmKeyword* const p = AsmKeywords + i; - addKeyword (p->operator, Lang_asm, (int) p->keyword); + const keywordTable* const p = AsmKeywords + i; + addKeyword (p->name, Lang_asm, (int) p->id); } }
Modified: ctags/parsers/fortran.c 12 lines changed, 2 insertions(+), 10 deletions(-) =================================================================== @@ -144,14 +144,6 @@ typedef enum eKeywordId { KEYWORD_while } keywordId;
-/* Used to determine whether keyword is valid for the token language and - * what its ID is. - */ -typedef struct sKeywordDesc { - const char *name; - keywordId id; -} keywordDesc; - typedef enum eTokenType { TOKEN_UNDEFINED, TOKEN_COMMA, @@ -244,7 +236,7 @@ static kindOption FortranKinds [TAG_COUNT] = { * http://h18009.www1.hp.com/fortran/docs/lrm/dflrm.htm */
-static const keywordDesc FortranKeywordTable [] = { +static const keywordTable FortranKeywordTable [] = { /* keyword keyword ID */ { "allocatable", KEYWORD_allocatable }, { "assignment", KEYWORD_assignment }, @@ -431,7 +423,7 @@ static void buildFortranKeywordHash (const langType language) size_t i; for (i = 0 ; i < count ; ++i) { - const keywordDesc* const p = &FortranKeywordTable [i]; + const keywordTable* const p = &FortranKeywordTable [i]; addKeyword (p->name, language, (int) p->id); } }
Modified: ctags/parsers/go.c 12 lines changed, 2 insertions(+), 10 deletions(-) =================================================================== @@ -41,14 +41,6 @@ typedef enum eKeywordId { KEYWORD_chan } keywordId;
-/* Used to determine whether keyword is valid for the current language and - * what its ID is. - */ -typedef struct sKeywordDesc { - const char *name; - keywordId id; -} keywordDesc; - typedef enum eTokenType { TOKEN_NONE = -1, // Token not important for top-level Go parsing @@ -109,7 +101,7 @@ static kindOption GoKinds[] = { {TRUE, 'm', "member", "struct members"} };
-static keywordDesc GoKeywordTable[] = { +static const keywordTable GoKeywordTable[] = { {"package", KEYWORD_package}, {"import", KEYWORD_import}, {"const", KEYWORD_const}, @@ -147,7 +139,7 @@ static void initialize (const langType language) Lang_go = language; for (i = 0; i < count; ++i) { - const keywordDesc *const p = &GoKeywordTable[i]; + const keywordTable *const p = &GoKeywordTable[i]; addKeyword (p->name, language, (int) p->id); } }
Modified: ctags/parsers/jscript.c 12 lines changed, 2 insertions(+), 10 deletions(-) =================================================================== @@ -76,14 +76,6 @@ typedef enum eKeywordId { KEYWORD_return } keywordId;
-/* Used to determine whether keyword is valid for the token language and - * what its ID is. - */ -typedef struct sKeywordDesc { - const char *name; - keywordId id; -} keywordDesc; - typedef enum eTokenType { TOKEN_UNDEFINED, TOKEN_EOF, @@ -147,7 +139,7 @@ static kindOption JsKinds [] = { { TRUE, 'v', "variable", "global variables" } };
-static const keywordDesc JsKeywordTable [] = { +static const keywordTable JsKeywordTable [] = { /* keyword keyword ID */ { "function", KEYWORD_function }, { "Function", KEYWORD_capital_function }, @@ -195,7 +187,7 @@ static void buildJsKeywordHash (void) size_t i; for (i = 0 ; i < count ; ++i) { - const keywordDesc* const p = &JsKeywordTable [i]; + const keywordTable* const p = &JsKeywordTable [i]; addKeyword (p->name, Lang_js, (int) p->id); } }
Modified: ctags/parsers/objc.c 10 lines changed, 2 insertions(+), 8 deletions(-) =================================================================== @@ -111,13 +111,7 @@ typedef enum {
typedef objcKeyword objcToken;
-typedef struct sOBjcKeywordDesc { - const char *name; - objcKeyword id; -} objcKeywordDesc; - - -static const objcKeywordDesc objcKeywordTable[] = { +static const keywordTable objcKeywordTable[] = { {"typedef", ObjcTYPEDEF}, {"struct", ObjcSTRUCT}, {"enum", ObjcENUM}, @@ -152,7 +146,7 @@ typedef struct _lexingState {
static void initKeywordHash (void) { - const size_t count = sizeof (objcKeywordTable) / sizeof (objcKeywordDesc); + const size_t count = sizeof (objcKeywordTable) / sizeof (keywordTable); size_t i;
for (i = 0; i < count; ++i)
Modified: ctags/parsers/php.c 9 lines changed, 2 insertions(+), 7 deletions(-) =================================================================== @@ -125,12 +125,7 @@ static kindOption PhpKinds[COUNT_KIND] = { { TRUE, 'v', "variable", "variables" } };
-typedef struct { - const char *name; - keywordId id; -} keywordDesc; - -static const keywordDesc PhpKeywordTable[] = { +static const keywordTable PhpKeywordTable[] = { /* keyword keyword ID */ { "abstract", KEYWORD_abstract }, { "and", KEYWORD_and }, @@ -249,7 +244,7 @@ static void buildPhpKeywordHash (const langType language) size_t i; for (i = 0; i < count ; i++) { - const keywordDesc* const p = &PhpKeywordTable[i]; + const keywordTable* const p = &PhpKeywordTable[i]; addKeyword (p->name, language, (int) p->id); } }
Modified: ctags/parsers/sql.c 13 lines changed, 2 insertions(+), 11 deletions(-) =================================================================== @@ -130,15 +130,6 @@ typedef enum eKeywordId { KEYWORD_go } keywordId;
-/* - * Used to determine whether keyword is valid for the token language and - * what its ID is. - */ -typedef struct sKeywordDesc { - const char *name; - keywordId id; -} keywordDesc; - typedef enum eTokenType { TOKEN_UNDEFINED, TOKEN_BLOCK_LABEL_BEGIN, @@ -236,7 +227,7 @@ static kindOption SqlKinds [] = { { TRUE, 'z', "mlprop", "MobiLink Properties " } };
-static const keywordDesc SqlKeywordTable [] = { +static const keywordTable SqlKeywordTable [] = { /* keyword keyword ID */ { "as", KEYWORD_is }, { "is", KEYWORD_is }, @@ -412,7 +403,7 @@ static void buildSqlKeywordHash (void) size_t i; for (i = 0 ; i < count ; ++i) { - const keywordDesc* const p = &SqlKeywordTable [i]; + const keywordTable* const p = &SqlKeywordTable [i]; addKeyword (p->name, Lang_sql, (int) p->id); } }
Modified: ctags/parsers/verilog.c 11 lines changed, 3 insertions(+), 8 deletions(-) =================================================================== @@ -48,11 +48,6 @@ typedef enum { K_TASK } verilogKind;
-typedef struct { - const char *keyword; - verilogKind kind; -} keywordAssoc; - /* * DATA DEFINITIONS */ @@ -71,7 +66,7 @@ static kindOption VerilogKinds [] = { { TRUE, 't', "task", "tasks" } };
-static keywordAssoc VerilogKeywordTable [] = { +static keywordTable VerilogKeywordTable [] = { { "`define", K_CONSTANT }, { "event", K_EVENT }, { "function", K_FUNCTION }, @@ -112,8 +107,8 @@ static void initialize (const langType language) Lang_verilog = language; for (i = 0 ; i < count ; ++i) { - const keywordAssoc* const p = &VerilogKeywordTable [i]; - addKeyword (p->keyword, language, (int) p->kind); + const keywordTable* const p = &VerilogKeywordTable [i]; + addKeyword (p->name, language, (int) p->id); } }
Modified: ctags/parsers/vhdl.c 11 lines changed, 3 insertions(+), 8 deletions(-) =================================================================== @@ -50,11 +50,6 @@ typedef enum { K_ALIAS } vhdlKind;
-typedef struct { - const char *keyword; - vhdlKind kind; -} keywordAssoc; - /* * DATA DEFINITIONS */ @@ -84,7 +79,7 @@ static kindOption VhdlKinds [] = { { TRUE, 'A', "typedef", "alias" } };
-static keywordAssoc VhdlKeywordTable [] = { +static keywordTable VhdlKeywordTable [] = { { "constant", K_CONSTANT }, { "variable", K_VARIABLE }, { "type", K_TYPE }, @@ -117,8 +112,8 @@ static void initialize (const langType language) Lang_vhdl = language; for (i = 0 ; i < count ; ++i) { - const keywordAssoc* const p = &VhdlKeywordTable [i]; - addKeyword (p->keyword, language, (int) p->kind); + const keywordTable* const p = &VhdlKeywordTable [i]; + addKeyword (p->name, language, (int) p->id); } }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).