@kugel- commented on this pull request.


In src/tagmanager/tm_ctags.c:

> +						if (!removed_typedefs)
+							removed_typedefs = g_ptr_array_new();
+						g_ptr_array_add(removed_typedefs, GUINT_TO_POINTER(j));
+					}
+				}
+			}
+
+			/* there's no typedef name for the anon tag so let's generate one  */
+			if (!new_name)
+			{
+				gchar buf[50];
+				guint anon_counter;
+				const gchar *kind_name = tm_ctags_get_kind_name(kind, tag->lang);
+
+				if (!anon_counter_table)
+					anon_counter_table = g_new0(gchar, 256);

Err, well, I thought of simply placing the array on the stack (at the function begin). I'm also not sure if 8 bit counter will suit everyone. I think generated sources (from a large vala file or someting like that) could easily overflow 256 anon structs.

I think a gint anon_counter_table[256] should work.


In src/tagmanager/tm_parser.c:

> @@ -818,6 +818,28 @@ void tm_parser_verify_type_mappings(void)
 }
 
 
+/* determine anonymous tags from tag names only when corresponding
+ * ctags information is not available */
+gboolean tm_parser_is_anon_name(TMParserType lang, gchar *name)
+{
+	guint i;
+	char dummy;
+
+	if (lang == TM_PARSER_C || lang == TM_PARSER_CPP)
+	{
+		return sscanf(name, "anon_%*[a-z]_%u%c", &i, &dummy) == 1 ||

Agree


In tests/ctags/enum.f90.tags:

> @@ -11,6 +9,8 @@ Named5
 Named6�2�Constants�0
 Named7�2�Constants�0
 a�4�Enum#1�0
+anon_enum_1�2�Constants�1
+anon_enum_2�2�Constants�1

Yea, lets see if there's any (negative) feedback.


In src/tagmanager/tm_parser.c:

> +{
+	guint i;
+	char dummy;
+
+	if (lang == TM_PARSER_C || lang == TM_PARSER_CPP)
+	{
+		return sscanf(name, "anon_%*[a-z]_%u%c", &i, &dummy) == 1 ||
+			sscanf(name, "__anon%u%c", &i, &dummy) == 1;
+	}
+	else if (lang == TM_PARSER_FORTRAN || lang == TM_PARSER_F77)
+	{
+		return sscanf(name, "Structure#%u%c", &i, &dummy) == 1 ||
+			sscanf(name, "Interface#%u%c", &i, &dummy) == 1 ||
+			sscanf(name, "Enum#%u%c", &i, &dummy) == 1;
+	}
+	return FALSE;

But what about existing tag files for java script?

-AnonymousFunction2�16�(n)�class3.c3m1�0
+anon_function_1�16�()�class2.c2m1�1


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <geany/geany/pull/3059/review/836793260@github.com>