[Github-comments] [geany/geany] Improve handling of anonymous tags (PR #3059)
Thomas Martitz
notifications at xxxxx
Mon Dec 20 20:46:57 UTC 2021
@kugel- commented on this pull request.
> + 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.
> @@ -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
> @@ -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.
> +{
+ 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?
```diff
-AnonymousFunction2�16�(n)�class3.c3m1�0
+anon_function_1�16�()�class2.c2m1�1
```
--
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/3059#pullrequestreview-836793260
You are receiving this because you are subscribed to this thread.
Message ID: <geany/geany/pull/3059/review/836793260 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20211220/8fda0657/attachment-0001.htm>
More information about the Github-comments
mailing list