[geany/geany] 0333c7: Add code verifying that all tag types for a language are mapped to some group

Jiří Techet git-noreply at geany.org
Sun Apr 10 12:34:15 UTC 2022


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Sun, 10 Apr 2022 12:34:15 UTC
Commit:      0333c75a08cfc64b347c8780cc7cd3b9af8d94b1
             https://github.com/geany/geany/commit/0333c75a08cfc64b347c8780cc7cd3b9af8d94b1

Log Message:
-----------
Add code verifying that all tag types for a language are mapped to some group

First, lang_types is constructed to contain all tag types used in
map_LANGUAGE mapping, then, group_types is constructed to contain all
tag types from group_LANGUAGE. Since some groups are used for more
languages (e.g. group_C) and contain more tag types than tag types
used for the given language, the check doesn't simply do

group_types != lang_types

but rather

(group_types & lang_types) != lang_types

to eliminate types from the group not used for the given language.


Modified Paths:
--------------
    src/tagmanager/tm_parser.c

Modified: src/tagmanager/tm_parser.c
10 lines changed, 10 insertions(+), 0 deletions(-)
===================================================================
@@ -1148,6 +1148,8 @@ void tm_parser_verify_type_mappings(void)
 		const gchar *kinds = tm_ctags_get_lang_kinds(lang);
 		TMParserMap *map = &parser_map[lang];
 		gchar presence_map[256];
+		TMTagType lang_types = 0;
+		TMTagType group_types = 0;
 		guint i;
 
 		if (! map->entries || map->size < 1)
@@ -1184,6 +1186,7 @@ void tm_parser_verify_type_mappings(void)
 					kinds[i], tm_ctags_get_lang_name(lang));
 
 			presence_map[(unsigned char) map->entries[i].kind]++;
+			lang_types |= map->entries[i].type;
 		}
 
 		for (i = 0; i < sizeof(presence_map); i++)
@@ -1192,6 +1195,13 @@ void tm_parser_verify_type_mappings(void)
 				g_error("Duplicate tag type '%c' found for %s",
 					(gchar)i, tm_ctags_get_lang_name(lang));
 		}
+
+		for (i = 0; i < map->group_num; i++)
+			group_types |= map->groups[i].types;
+
+		if ((group_types & lang_types) != lang_types)
+			g_warning("Not all tag types mapped to symbol tree groups for %s",
+				tm_ctags_get_lang_name(lang));
 	}
 }
 



--------------
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