[geany/geany] 4fbd38: Pass kind information into initTagEntry()

Jiří Techet git-noreply at xxxxx
Sat Sep 10 07:26:13 UTC 2016


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Sun, 31 Jul 2016 22:43:18 UTC
Commit:      4fbd38f6904a9ba93b1961a10d9d977bb83d277c
             https://github.com/geany/geany/commit/4fbd38f6904a9ba93b1961a10d9d977bb83d277c

Log Message:
-----------
Pass kind information into initTagEntry()

The usage in lregex is hacky (casting const char * to char *) but it's
the quickest way to implement it right now (the question is whether
we shouldn't revert back to POSIX regex and simply use the uctags
implementation).


Modified Paths:
--------------
    ctags/main/entry.c
    ctags/main/entry.h
    ctags/main/kind.h
    ctags/main/lcpp.c
    ctags/main/lcpp.h
    ctags/main/lregex.c
    ctags/main/parse.c
    ctags/main/parse.h
    ctags/main/read.c
    ctags/main/read.h
    ctags/parsers/abc.c
    ctags/parsers/asciidoc.c
    ctags/parsers/c.c
    ctags/parsers/css.c
    ctags/parsers/erlang.c
    ctags/parsers/fortran.c
    ctags/parsers/go.c
    ctags/parsers/jscript.c
    ctags/parsers/json.c
    ctags/parsers/markdown.c
    ctags/parsers/objc.c
    ctags/parsers/pascal.c
    ctags/parsers/perl.c
    ctags/parsers/php.c
    ctags/parsers/powershell.c
    ctags/parsers/python.c
    ctags/parsers/r.c
    ctags/parsers/rest.c
    ctags/parsers/ruby.c
    ctags/parsers/rust.c
    ctags/parsers/sql.c
    ctags/parsers/txt2tags.c
    src/tagmanager/tm_source_file.c

Modified: ctags/main/entry.c
3 lines changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -400,7 +400,7 @@ extern void makeTagEntry (const tagEntryInfo *const tag)
 	}
 }
 
-extern void initTagEntry (tagEntryInfo *const e, const char *const name)
+extern void initTagEntry (tagEntryInfo *const e, const char *const name, const kindOption *kind)
 {
 	Assert (File.source.name != NULL);
 	memset (e, 0, sizeof (tagEntryInfo));
@@ -410,6 +410,7 @@ extern void initTagEntry (tagEntryInfo *const e, const char *const name)
 	e->filePosition     = getInputFilePosition ();
 	e->sourceFileName   = getSourceFileTagPath ();
 	e->name             = name;
+	e->kind             = kind;
 }
 
 /* vi:set tabstop=4 shiftwidth=4: */


Modified: ctags/main/entry.h
5 lines changed, 2 insertions(+), 3 deletions(-)
===================================================================
@@ -62,8 +62,7 @@ typedef struct sTagEntryInfo {
 	boolean     truncateLine;   /* truncate tag line at end of tag name? */
 	const char *sourceFileName; /* name of source file */
 	const char *name;           /* name of the tag */
-	const char *kindName;       /* kind of tag */
-	char        kind;           /* single character representation of kind */
+	const kindOption *kind;     /* kind descriptor */
 	struct {
 		const char* access;
 		const char* fileScope;
@@ -95,7 +94,7 @@ extern void closeTagFile (const boolean resize);
 extern void beginEtagsFile (void);
 extern void endEtagsFile (const char *const name);
 extern void makeTagEntry (const tagEntryInfo *const tag);
-extern void initTagEntry (tagEntryInfo *const e, const char *const name);
+extern void initTagEntry (tagEntryInfo *const e, const char *const name, const kindOption *kind);
 
 #endif  /* _ENTRY_H */
 


Modified: ctags/main/kind.h
5 lines changed, 5 insertions(+), 0 deletions(-)
===================================================================
@@ -10,6 +10,11 @@
 
 #include "general.h"
 
+#define KIND_NULL    '\0'
+
+#define KIND_FILE_DEFAULT 'F'
+#define KIND_FILE_DEFAULT_LONG "file"
+
 typedef struct sKindOption {
 	boolean enabled;          /* are tags for kind enabled? */
 	char  letter;               /* kind letter */


Modified: ctags/main/lcpp.c
10 lines changed, 6 insertions(+), 4 deletions(-)
===================================================================
@@ -65,6 +65,7 @@ typedef struct sCppState {
 	boolean resolveRequired;     /* must resolve if/else/elif/endif branch */
 	boolean hasAtLiteralStrings; /* supports @"c:\" strings */
 	boolean hasCxxRawLiteralStrings; /* supports R"xxx(...)xxx" strings */
+	const kindOption  *defineMacroKind;
 	struct sDirective {
 		enum eState state;       /* current directive being processed */
 		boolean	accept;          /* is a directive syntactically permitted? */
@@ -87,6 +88,7 @@ static cppState Cpp = {
 	FALSE,       /* resolveRequired */
 	FALSE,       /* hasAtLiteralStrings */
 	FALSE,       /* hasCxxRawLiteralStrings */
+	NULL,        /* defineMacroKind */
 	{
 		DRCTV_NONE,  /* state */
 		FALSE,       /* accept */
@@ -111,7 +113,8 @@ extern unsigned int getDirectiveNestLevel (void)
 }
 
 extern void cppInit (const boolean state, const boolean hasAtLiteralStrings,
-                     const boolean hasCxxRawLiteralStrings)
+                     const boolean hasCxxRawLiteralStrings,
+                     const kindOption *defineMacroKind)
 {
 	BraceFormat = state;
 
@@ -120,6 +123,7 @@ extern void cppInit (const boolean state, const boolean hasAtLiteralStrings,
 	Cpp.resolveRequired = FALSE;
 	Cpp.hasAtLiteralStrings = hasAtLiteralStrings;
 	Cpp.hasCxxRawLiteralStrings = hasCxxRawLiteralStrings;
+	Cpp.defineMacroKind = defineMacroKind;
 
 	Cpp.directive.state     = DRCTV_NONE;
 	Cpp.directive.accept    = TRUE;
@@ -310,13 +314,11 @@ static void makeDefineTag (const char *const name, boolean parameterized)
 	{
 		tagEntryInfo e;
 
-		initTagEntry (&e, name);
+		initTagEntry (&e, name, Cpp.defineMacroKind);
 
 		e.lineNumberEntry = (boolean) (Option.locate != EX_PATTERN);
 		e.isFileScope  = isFileScope;
 		e.truncateLine = TRUE;
-		e.kindName     = "macro";
-		e.kind         = 'd';
 		if (parameterized)
 		{
 			e.extensionFields.signature = getArglistFromFilePos(getInputFilePosition()


Modified: ctags/main/lcpp.h
3 lines changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -37,7 +37,8 @@
 extern boolean isBraceFormat (void);
 extern unsigned int getDirectiveNestLevel (void);
 extern void cppInit (const boolean state, const boolean hasAtLiteralStrings,
-                     const boolean hasCxxRawLiteralStrings);
+                     const boolean hasCxxRawLiteralStrings,
+                     const kindOption *defineMacroKind);
 extern void cppTerminate (void);
 extern void cppBeginStatement (void);
 extern void cppEndStatement (void);


Modified: ctags/main/lregex.c
22 lines changed, 7 insertions(+), 15 deletions(-)
===================================================================
@@ -32,6 +32,7 @@
 #include "entry.h"
 #include "parse.h"
 #include "read.h"
+#include "kind.h"
 
 #ifdef HAVE_REGEX
 
@@ -53,13 +54,6 @@
 */
 #if defined (POSIX_REGEX)
 
-struct sKind {
-	boolean enabled;
-	char letter;
-	char* name;
-	char* description;
-};
-
 enum pType { PTRN_TAG, PTRN_CALLBACK };
 
 typedef struct {
@@ -68,7 +62,7 @@ typedef struct {
 	union {
 		struct {
 			char *name_pattern;
-			struct sKind kind;
+			kindOption kind;
 		} tag;
 		struct {
 			regexCallback function;
@@ -113,11 +107,11 @@ static void clearPatternSet (const langType language)
 			{
 				eFree (p->u.tag.name_pattern);
 				p->u.tag.name_pattern = NULL;
-				eFree (p->u.tag.kind.name);
+				eFree ((char *)p->u.tag.kind.name);
 				p->u.tag.kind.name = NULL;
 				if (p->u.tag.kind.description != NULL)
 				{
-					eFree (p->u.tag.kind.description);
+					eFree ((char *)p->u.tag.kind.description);
 					p->u.tag.kind.description = NULL;
 				}
 			}
@@ -134,16 +128,14 @@ static void clearPatternSet (const langType language)
 */
 
 static void makeRegexTag (
-		const vString* const name, const struct sKind* const kind)
+		const vString* const name, const kindOption* const kind)
 {
 	Assert (kind != NULL);
 	if (kind->enabled)
 	{
 		tagEntryInfo e;
 		Assert (name != NULL  &&  vStringLength (name) > 0);
-		initTagEntry (&e, vStringValue (name));
-		e.kind     = kind->letter;
-		e.kindName = kind->name;
+		initTagEntry (&e, vStringValue (name), kind);
 		makeTagEntry (&e);
 	}
 }
@@ -375,7 +367,7 @@ static void parseKinds (
 
 static void printRegexKind (const regexPattern *pat, unsigned int i, boolean indent)
 {
-	const struct sKind *const kind = &pat [i].u.tag.kind;
+	const kindOption *const kind = &pat [i].u.tag.kind;
 	const char *const indentation = indent ? "    " : "";
 	Assert (pat [i].type == PTRN_TAG);
 	printf ("%s%c  %s %s\n", indentation,


Modified: ctags/main/parse.c
34 lines changed, 24 insertions(+), 10 deletions(-)
===================================================================
@@ -33,6 +33,13 @@
 static parserDefinitionFunc* BuiltInParsers[] = { PARSER_LIST };
 parserDefinition** LanguageTable = NULL;
 unsigned int LanguageCount = 0;
+static kindOption defaultFileKind = {
+	.enabled     = FALSE,
+	.letter      = KIND_FILE_DEFAULT,
+	.name        = KIND_FILE_DEFAULT_LONG,
+	.description = KIND_FILE_DEFAULT_LONG,
+};
+
 tagEntryFunction TagEntryFunction = NULL;
 void *TagEntryUserData = NULL;
 
@@ -53,10 +60,7 @@ extern void makeSimpleTag (const vString* const name,
 	if (name != NULL  &&  vStringLength (name) > 0)
 	{
 		tagEntryInfo e;
-		initTagEntry (&e, vStringValue (name));
-
-		e.kindName = kinds [kind].name;
-		e.kind     = kinds [kind].letter;
+		initTagEntry (&e, vStringValue (name), &(kinds [kind]));
 
 		makeTagEntry (&e);
 	}
@@ -71,10 +75,8 @@ extern void makeSimpleScopedTag (const vString* const name,
 	if (name != NULL  &&  vStringLength (name) > 0)
 	{
 		tagEntryInfo e;
-		initTagEntry (&e, vStringValue (name));
+		initTagEntry (&e, vStringValue (name), &(kinds [kind]));
 
-		e.kindName = kinds [kind].name;
-		e.kind     = kinds [kind].letter;
 		e.extensionFields.scopeKind = &(kinds [kind]);
 		e.extensionFields.scopeName = scopeName;
 		e.extensionFields.access = laccess;
@@ -91,6 +93,7 @@ extern parserDefinition* parserNew (const char* name)
 {
 	parserDefinition* result = xCalloc (1, parserDefinition);
 	result->name = eStrdup (name);
+	result->fileKind = &defaultFileKind;
 	return result;
 }
 
@@ -101,6 +104,19 @@ extern const char *getLanguageName (const langType language)
 		return LanguageTable [language]->name;
 }
 
+extern kindOption* getLanguageFileKind (const langType language)
+{
+	kindOption* kind;
+
+	Assert (0 <= language  &&  language < (int) LanguageCount);
+
+	kind = LanguageTable [language]->fileKind;
+
+	Assert (kind != KIND_NULL);
+
+	return kind;
+}
+
 extern langType getNamedLanguage (const char *const name)
 {
 	langType result = LANG_IGNORE;
@@ -595,13 +611,11 @@ static void makeFileTag (const char *const fileName)
 	if (Option.include.fileNames)
 	{
 		tagEntryInfo tag;
-		initTagEntry (&tag, baseFilename (fileName));
+		initTagEntry (&tag, baseFilename (fileName), getInputLanguageFileKind ());
 
 		tag.isFileEntry     = TRUE;
 		tag.lineNumberEntry = TRUE;
 		tag.lineNumber      = 1;
-		tag.kindName        = "file";
-		tag.kind            = 'F';
 
 		makeTagEntry (&tag);
 	}


Modified: ctags/main/parse.h
2 lines changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -46,6 +46,7 @@ typedef struct {
 	char* name;             /* name of language */
 	kindOption* kinds;          /* tag kinds handled by parser */
 	unsigned int kindCount;     /* size of `kinds' list */
+	kindOption* fileKind;           /* kind for overriding the default fileKind */
 	const char* const* extensions;  /* list of default extensions */
 	const char* const* patterns;    /* list of default file name patterns */
 	parserInitialize initialize;    /* initialization routine, if needed */
@@ -95,6 +96,7 @@ extern void makeSimpleScopedTag (const vString* const name, kindOption* const ki
 
 extern parserDefinition* parserNew (const char* name);
 extern const char *getLanguageName (const langType language);
+extern kindOption* getLanguageFileKind (const langType language);
 extern langType getNamedLanguage (const char *const name);
 extern langType getFileLanguage (const char *const fileName);
 extern void installLanguageMapDefault (const langType language);


Modified: ctags/main/read.c
9 lines changed, 6 insertions(+), 3 deletions(-)
===================================================================
@@ -36,6 +36,11 @@ static MIOPos StartOfLine;      /* holds deferred position of start of line */
 *   FUNCTION DEFINITIONS
 */
 
+extern kindOption *getInputLanguageFileKind (void)
+{
+	return getLanguageFileKind (File.input.language);
+}
+
 extern void freeSourceFileResources (void)
 {
 	vStringDelete (File.input.name);
@@ -217,13 +222,11 @@ static boolean parseLineDirective (void)
 				lNum == 1)
 			{
 				tagEntryInfo tag;
-				initTagEntry (&tag, baseFilename (vStringValue (fileName)));
+				initTagEntry (&tag, baseFilename (vStringValue (fileName)), getInputLanguageFileKind ());
 
 				tag.isFileEntry     = TRUE;
 				tag.lineNumberEntry = TRUE;
 				tag.lineNumber      = 1;
-				tag.kindName        = "file";
-				tag.kind            = 'F';
 
 				makeTagEntry (&tag);
 			}


Modified: ctags/main/read.h
4 lines changed, 4 insertions(+), 0 deletions(-)
===================================================================
@@ -102,6 +102,10 @@ extern inputFile File;
 /*
 *   FUNCTION PROTOTYPES
 */
+
+/* InputFile: reading from fp in inputFile with updating fields in input fields */
+extern kindOption *getInputLanguageFileKind (void);
+
 extern void freeSourceFileResources (void);
 extern boolean fileOpen (const char *const fileName, const langType language);
 extern boolean fileEOF (void);


Modified: ctags/parsers/abc.c
4 lines changed, 1 insertions(+), 3 deletions(-)
===================================================================
@@ -52,12 +52,10 @@ static kindOption AbcKinds[] = {
 static void makeAbcTag (const vString* const name, boolean name_before)
 {
 	tagEntryInfo e;
-	initTagEntry (&e, vStringValue(name));
+	initTagEntry (&e, vStringValue(name), &(AbcKinds[0]));
 
 	if (name_before)
 		e.lineNumber--;	/* we want the line before the underline chars */
-	e.kindName = AbcKinds[0].name;
-	e.kind = AbcKinds[0].letter;
 
 	makeTagEntry(&e);
 }


Modified: ctags/parsers/asciidoc.c
4 lines changed, 1 insertions(+), 3 deletions(-)
===================================================================
@@ -73,11 +73,9 @@ static void makeAsciidocTag (const vString* const name, const int kind)
 	if (vStringLength (name) > 0)
 	{
 		tagEntryInfo e;
-		initTagEntry (&e, vStringValue (name));
+		initTagEntry (&e, vStringValue (name), &(AsciidocKinds [kind]));
 
 		e.lineNumber--;	/* we want the line before the '---' underline chars */
-		e.kindName = AsciidocKinds [kind].name;
-		e.kind = AsciidocKinds [kind].letter;
 
 		if (nl && nl->type < kind)
 		{


Modified: ctags/parsers/c.c
6 lines changed, 2 insertions(+), 4 deletions(-)
===================================================================
@@ -1454,13 +1454,11 @@ static void makeTag (const tokenInfo *const token,
 			return;
 		}
 
-		initTagEntry (&e, vStringValue (token->name));
+		initTagEntry (&e, vStringValue (token->name), tagKind (type));
 
 		e.lineNumber	= token->lineNumber;
 		e.filePosition	= token->filePosition;
 		e.isFileScope = isFileScope;
-		e.kindName	= tagKind (type)->name;
-		e.kind		= tagKind (type)->letter;
 
 		findScopeHierarchy (scope, st);
 		addOtherFields (&e, type, token, st, scope);
@@ -3157,7 +3155,7 @@ static boolean findCTags (const unsigned int passCount)
 	contextual_fake_count = 0;
 
 	Assert (passCount < 3);
-	cppInit ((boolean) (passCount > 1), isLanguage (Lang_csharp), isLanguage (Lang_cpp));
+	cppInit ((boolean) (passCount > 1), isLanguage (Lang_csharp), isLanguage (Lang_cpp), &(CKinds [CK_DEFINE]));
 
 	exception = (exception_t) setjmp (Exception);
 	retry = FALSE;


Modified: ctags/parsers/css.c
4 lines changed, 1 insertions(+), 3 deletions(-)
===================================================================
@@ -228,12 +228,10 @@ static void findCssTags (void)
 			if (CssKinds[kind].enabled)
 			{
 				tagEntryInfo e;
-				initTagEntry (&e, vStringValue (selector));
+				initTagEntry (&e, vStringValue (selector), &(CssKinds[kind]));
 
 				e.lineNumber	= lineNumber;
 				e.filePosition	= filePosition;
-				e.kindName		= CssKinds[kind].name;
-				e.kind			= (char) CssKinds[kind].letter;
 
 				makeTagEntry (&e);
 			}


Modified: ctags/parsers/erlang.c
4 lines changed, 1 insertions(+), 3 deletions(-)
===================================================================
@@ -79,9 +79,7 @@ static void makeMemberTag (
 	if (ErlangKinds [kind].enabled  &&  vStringLength (identifier) > 0)
 	{
 		tagEntryInfo tag;
-		initTagEntry (&tag, vStringValue (identifier));
-		tag.kindName = ErlangKinds[kind].name;
-		tag.kind = ErlangKinds[kind].letter;
+		initTagEntry (&tag, vStringValue (identifier), &(ErlangKinds[kind]));
 
 		if (module != NULL  &&  vStringLength (module) > 0)
 		{


Modified: ctags/parsers/fortran.c
4 lines changed, 1 insertions(+), 3 deletions(-)
===================================================================
@@ -488,16 +488,14 @@ static void makeFortranTag (tokenInfo *const token, tagType tag)
 		const char *const name = vStringValue (token->string);
 		tagEntryInfo e;
 
-		initTagEntry (&e, name);
+		initTagEntry (&e, name, &(FortranKinds [token->tag]));
 
 		if (token->tag == TAG_COMMON_BLOCK)
 			e.lineNumberEntry = (boolean) (Option.locate != EX_PATTERN);
 
 		e.lineNumber	= token->lineNumber;
 		e.filePosition	= token->filePosition;
 		e.isFileScope	= isFileScope (token->tag);
-		e.kindName		= FortranKinds [token->tag].name;
-		e.kind			= FortranKinds [token->tag].letter;
 		e.truncateLine	= (boolean) (token->tag != TAG_LABEL);
 
 		if (ancestorCount () > 0)


Modified: ctags/parsers/go.c
4 lines changed, 1 insertions(+), 3 deletions(-)
===================================================================
@@ -523,15 +523,13 @@ static void makeTag (tokenInfo *const token, const goKind kind,
 	const char *const name = vStringValue (token->string);
 
 	tagEntryInfo e;
-	initTagEntry (&e, name);
+	initTagEntry (&e, name, &(GoKinds [kind]));
 
 	if (!GoKinds [kind].enabled)
 		return;
 
 	e.lineNumber = token->lineNumber;
 	e.filePosition = token->filePosition;
-	e.kindName = GoKinds [kind].name;
-	e.kind = GoKinds [kind].letter;
 	if (argList)
 		e.extensionFields.signature = argList;
 	if (varType)


Modified: ctags/parsers/jscript.c
4 lines changed, 1 insertions(+), 3 deletions(-)
===================================================================
@@ -224,12 +224,10 @@ static void makeJsTag (tokenInfo *const token, const jsKind kind, vString *const
 			name = p + 1;
 		}
 
-		initTagEntry (&e, name);
+		initTagEntry (&e, name, &(JsKinds [kind]));
 
 		e.lineNumber   = token->lineNumber;
 		e.filePosition = token->filePosition;
-		e.kindName	   = JsKinds [kind].name;
-		e.kind		   = JsKinds [kind].letter;
 
 		if ( vStringLength(fullscope) > 0 )
 		{


Modified: ctags/parsers/json.c
4 lines changed, 1 insertions(+), 3 deletions(-)
===================================================================
@@ -117,12 +117,10 @@ static void makeJsonTag (tokenInfo *const token, const jsonKind kind)
 	if (! JsonKinds[kind].enabled)
 		return;
 
-	initTagEntry (&e, vStringValue (token->string));
+	initTagEntry (&e, vStringValue (token->string), &(JsonKinds[kind]));
 
 	e.lineNumber	= token->lineNumber;
 	e.filePosition	= token->filePosition;
-	e.kindName		= JsonKinds[kind].name;
-	e.kind			= JsonKinds[kind].letter;
 
 	if (vStringLength (token->scope) > 0)
 	{


Modified: ctags/parsers/markdown.c
4 lines changed, 1 insertions(+), 3 deletions(-)
===================================================================
@@ -49,12 +49,10 @@ static boolean issame(const char *str)
 static void makeMarkdownTag (const vString* const name, boolean name_before)
 {
 	tagEntryInfo e;
-	initTagEntry (&e, vStringValue(name));
+	initTagEntry (&e, vStringValue(name), &(MarkdownKinds [0]));
 
 	if (name_before)
 		e.lineNumber--;	/* we want the line before the underline chars */
-	e.kindName = "variable";
-	e.kind = 'v';
 
 	makeTagEntry(&e);
 }


Modified: ctags/parsers/objc.c
4 lines changed, 1 insertions(+), 3 deletions(-)
===================================================================
@@ -438,9 +438,7 @@ static objcKind parentType = K_INTERFACE;
  * add additional information to the tag. */
 static void prepareTag (tagEntryInfo * tag, vString const *name, objcKind kind)
 {
-	initTagEntry (tag, vStringValue (name));
-	tag->kindName = ObjcKinds[kind].name;
-	tag->kind = ObjcKinds[kind].letter;
+	initTagEntry (tag, vStringValue (name), &(ObjcKinds[kind]));
 
 	if (parentName != NULL)
 	{


Modified: ctags/parsers/pascal.c
6 lines changed, 1 insertions(+), 5 deletions(-)
===================================================================
@@ -44,15 +44,11 @@ static void createPascalTag (tagEntryInfo* const tag,
 {
 	if (PascalKinds [kind].enabled  &&  name != NULL  &&  vStringLength (name) > 0)
 	{
-		initTagEntry (tag, vStringValue (name));
+		initTagEntry (tag, vStringValue (name), &(PascalKinds [kind]));
 
-		tag->kindName = PascalKinds [kind].name;
-		tag->kind     = PascalKinds [kind].letter;
 		tag->extensionFields.signature = arglist;
 		tag->extensionFields.varType = vartype;
 	}
-	else
-		initTagEntry (tag, NULL);
 }
 
 static void makePascalTag (const tagEntryInfo* const tag)


Modified: ctags/parsers/perl.c
5 lines changed, 1 insertions(+), 4 deletions(-)
===================================================================
@@ -319,7 +319,7 @@ static void findPerlTags (void)
 				 * isSubroutineDeclaration() may consume several lines.  So
 				 * we record line positions.
 				 */
-				initTagEntry(&e, vStringValue(name));
+				initTagEntry(&e, vStringValue(name), &(PerlKinds[kind]));
 
 				if (TRUE == isSubroutineDeclaration(cp)) {
 					if (TRUE == PerlKinds[K_SUBROUTINE_DECLARATION].enabled) {
@@ -330,9 +330,6 @@ static void findPerlTags (void)
 					}
 				}
 
-				e.kind     = PerlKinds[kind].letter;
-				e.kindName = PerlKinds[kind].name;
-
 				makeTagEntry(&e);
 
 				if (Option.include.qualifiedTags && qualified &&


Modified: ctags/parsers/php.c
8 lines changed, 2 insertions(+), 6 deletions(-)
===================================================================
@@ -281,12 +281,10 @@ static void initPhpEntry (tagEntryInfo *const e, const tokenInfo *const token,
 		parentKind = K_NAMESPACE;
 	}
 
-	initTagEntry (e, vStringValue (token->string));
+	initTagEntry (e, vStringValue (token->string), &(PhpKinds[kind]));
 
 	e->lineNumber	= token->lineNumber;
 	e->filePosition	= token->filePosition;
-	e->kindName		= PhpKinds[kind].name;
-	e->kind			= (char) PhpKinds[kind].letter;
 
 	if (access != ACCESS_UNDEFINED)
 		e->extensionFields.access = accessToString (access);
@@ -325,12 +323,10 @@ static void makeNamespacePhpTag (const tokenInfo *const token, const vString *co
 	{
 		tagEntryInfo e;
 
-		initTagEntry (&e, vStringValue (name));
+		initTagEntry (&e, vStringValue (name), &(PhpKinds[K_NAMESPACE]));
 
 		e.lineNumber	= token->lineNumber;
 		e.filePosition	= token->filePosition;
-		e.kindName		= PhpKinds[K_NAMESPACE].name;
-		e.kind			= (char) PhpKinds[K_NAMESPACE].letter;
 
 		makeTagEntry (&e);
 	}


Modified: ctags/parsers/powershell.c
4 lines changed, 1 insertions(+), 3 deletions(-)
===================================================================
@@ -99,12 +99,10 @@ static const char *findValidAccessType (const char *const access)
 static void initPowerShellEntry (tagEntryInfo *const e, const tokenInfo *const token,
 								 const powerShellKind kind, const char *const access)
 {
-	initTagEntry (e, vStringValue (token->string));
+	initTagEntry (e, vStringValue (token->string), &(PowerShellKinds[kind]));
 
 	e->lineNumber	= token->lineNumber;
 	e->filePosition	= token->filePosition;
-	e->kindName		= PowerShellKinds[kind].name;
-	e->kind			= (char) PowerShellKinds[kind].letter;
 
 	if (access != NULL)
 		e->extensionFields.access = access;


Modified: ctags/parsers/python.c
24 lines changed, 9 insertions(+), 15 deletions(-)
===================================================================
@@ -113,27 +113,25 @@ static void makeFunctionTag (vString *const function,
 	vString *const parent, int is_class_parent, const char *arglist)
 {
 	tagEntryInfo tag;
-	initTagEntry (&tag, vStringValue (function));
-
-	tag.kindName = PythonKinds[K_FUNCTION].name;
-	tag.kind = PythonKinds[K_FUNCTION].letter;
-	tag.extensionFields.signature = arglist;
 
 	if (vStringLength (parent) > 0)
 	{
 		if (is_class_parent)
 		{
-			tag.kindName = PythonKinds[K_METHOD].name;
-			tag.kind = PythonKinds[K_METHOD].letter;
+			initTagEntry (&tag, vStringValue (function), &(PythonKinds[K_METHOD]));
 			tag.extensionFields.scopeKind = &(PythonKinds[K_CLASS]);
-			tag.extensionFields.scopeName = vStringValue (parent);
 		}
 		else
 		{
+			initTagEntry (&tag, vStringValue (function), &(PythonKinds[K_FUNCTION]));
 			tag.extensionFields.scopeKind = &(PythonKinds[K_FUNCTION]);
-			tag.extensionFields.scopeName = vStringValue (parent);
 		}
+		tag.extensionFields.scopeName = vStringValue (parent);
 	}
+	else
+		initTagEntry (&tag, vStringValue (function), &(PythonKinds[K_FUNCTION]));
+
+	tag.extensionFields.signature = arglist;
 
 	addAccessFields (&tag, function, is_class_parent ? K_METHOD : K_FUNCTION,
 		vStringLength (parent) > 0, is_class_parent);
@@ -148,9 +146,7 @@ static void makeClassTag (vString *const class, vString *const inheritance,
 	vString *const parent, int is_class_parent)
 {
 	tagEntryInfo tag;
-	initTagEntry (&tag, vStringValue (class));
-	tag.kindName = PythonKinds[K_CLASS].name;
-	tag.kind = PythonKinds[K_CLASS].letter;
+	initTagEntry (&tag, vStringValue (class), &(PythonKinds[K_CLASS]));
 	if (vStringLength (parent) > 0)
 	{
 		if (is_class_parent)
@@ -174,9 +170,7 @@ static void makeVariableTag (vString *const var, vString *const parent,
 	boolean is_class_parent)
 {
 	tagEntryInfo tag;
-	initTagEntry (&tag, vStringValue (var));
-	tag.kindName = PythonKinds[K_VARIABLE].name;
-	tag.kind = PythonKinds[K_VARIABLE].letter;
+	initTagEntry (&tag, vStringValue (var), &(PythonKinds[K_VARIABLE]));
 	if (vStringLength (parent) > 0)
 	{
 		tag.extensionFields.scopeKind = &(PythonKinds[K_CLASS]);


Modified: ctags/parsers/r.c
5 lines changed, 1 insertions(+), 4 deletions(-)
===================================================================
@@ -61,13 +61,10 @@ static void installRRegex (const langType language)
 static void makeRTag(const vString* const name, rKind kind)
 {
 	tagEntryInfo e;
-	initTagEntry(&e, vStringValue(name));
+	initTagEntry(&e, vStringValue(name), &(RKinds[kind]));
 
 	Assert(kind < KIND_COUNT);
 
-	e.kindName = RKinds[kind].name;
-	e.kind     = RKinds[kind].letter;
-
 	makeTagEntry(&e);
 }
 


Modified: ctags/parsers/rest.c
4 lines changed, 1 insertions(+), 3 deletions(-)
===================================================================
@@ -70,11 +70,9 @@ static void makeRestTag (const vString* const name, const int kind)
 	if (vStringLength (name) > 0)
 	{
 		tagEntryInfo e;
-		initTagEntry (&e, vStringValue (name));
+		initTagEntry (&e, vStringValue (name), &(RestKinds [kind]));
 
 		e.lineNumber--;	/* we want the line before the '---' underline chars */
-		e.kindName = RestKinds [kind].name;
-		e.kind = RestKinds [kind].letter;
 
 		if (nl && nl->type < kind)
 		{


Modified: ctags/parsers/ruby.c
4 lines changed, 1 insertions(+), 3 deletions(-)
===================================================================
@@ -213,16 +213,14 @@ static void emitRubyTag (vString* name, rubyKind kind)
 	else
 		unqualified_name = qualified_name;
 
-	initTagEntry (&tag, unqualified_name);
+	initTagEntry (&tag, unqualified_name, &(RubyKinds [kind]));
 	if (vStringLength (scope) > 0) {
 		Assert (0 <= parent_kind &&
 		        (size_t) parent_kind < (sizeof RubyKinds / sizeof RubyKinds[0]));
 
 	    tag.extensionFields.scopeKind = &(RubyKinds [parent_kind]);
 	    tag.extensionFields.scopeName = vStringValue (scope);
 	}
-	tag.kindName = RubyKinds [kind].name;
-	tag.kind = RubyKinds [kind].letter;
 	makeTagEntry (&tag);
 
 	nestingLevelsPush (nesting, name, kind);


Modified: ctags/parsers/rust.c
5 lines changed, 1 insertions(+), 4 deletions(-)
===================================================================
@@ -439,15 +439,12 @@ static void addTag (vString* ident, const char* type, const char* arg_list, int
 	if (kind == K_NONE)
 		return;
 	tagEntryInfo tag;
-	initTagEntry(&tag, ident->buffer);
+	initTagEntry(&tag, ident->buffer, &(rustKinds[kind]));
 
 	tag.lineNumber = line;
 	tag.filePosition = pos;
 	tag.sourceFileName = getSourceFileName();
 
-	tag.kindName = rustKinds[kind].name;
-	tag.kind = rustKinds[kind].letter;
-
 	tag.extensionFields.signature = arg_list;
 	tag.extensionFields.varType = type;
 	if (parent_kind != K_NONE)


Modified: ctags/parsers/sql.c
4 lines changed, 1 insertions(+), 3 deletions(-)
===================================================================
@@ -439,12 +439,10 @@ static void makeSqlTag (tokenInfo *const token, const sqlKind kind)
 	{
 		const char *const name = vStringValue (token->string);
 		tagEntryInfo e;
-		initTagEntry (&e, name);
+		initTagEntry (&e, name, &(SqlKinds [kind]));
 
 		e.lineNumber   = token->lineNumber;
 		e.filePosition = token->filePosition;
-		e.kindName	   = SqlKinds [kind].name;
-		e.kind		   = SqlKinds [kind].letter;
 
 		if (vStringLength (token->scope) > 0)
 		{


Modified: ctags/parsers/txt2tags.c
5 lines changed, 1 insertions(+), 4 deletions(-)
===================================================================
@@ -51,10 +51,7 @@ static void makeTxt2tagsTag (const vString* const name,
 	tagEntryInfo e;
 	vString *scope = NULL;
 	kindOption *kind = &Txt2tagsKinds[type];
-	initTagEntry (&e, vStringValue(name));
-
-	e.kindName = kind->name;
-	e.kind = kind->letter;
+	initTagEntry (&e, vStringValue(name), kind);
 
 	if (nls->n > 0) {
 		int i;


Modified: src/tagmanager/tm_source_file.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -179,7 +179,7 @@ static gboolean init_tag(TMTag *tag, TMSourceFile *file, const tagEntryInfo *tag
 	if (!tag_entry)
 		return FALSE;
 
-	type = tm_parser_get_tag_type(tag_entry->kind, file->lang);
+	type = tm_parser_get_tag_type(tag_entry->kind->letter, file->lang);
 	if (!tag_entry->name || type == tm_tag_undef_t)
 		return FALSE;
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list