[Github-comments] [geany/geany] TM cleanups (#957)

Colomban Wendling notifications at xxxxx
Tue May 3 19:56:20 UTC 2016


> +};
> +
> +/* not in universal-ctags */
> +static TMParserMapEntry powershell_map[] = {
> +	{'f', tm_tag_function_t},
> +	{'v', tm_tag_variable_t},
> +};
> +
> +
> +typedef struct
> +{
> +    TMParserMapEntry *entries;
> +    guint size;
> +} TMParserMap;
> +
> +#define MAP_ENTRY(map) {map, (sizeof(map)/sizeof(TMParserMapEntry))}

Also, as we now depend on C99, we could have a more safe thing using explicit subobject initialization.
Also, if the maps used a streamlined scheme following the parser name (similar to highlightingmappings.h), we could have something even more automated, like i.e.

```c
#define MAP_ENTRY_REF(lang, lang_src)	[lang] = { map_##lang_src, G_N_ELEMENTS(map_##lang_src) }
#define MAP_ENTRY(lang)					MAP_ENTRY_REF(lang, lang)

static TMParserMap parser_map[] = {
	MAP_ENTRY(C),
	MAP_ENTRY_REF(CPP, C),	/* C++ - same as C */
	MAP_ENTRY(JAVA),
	MAP_ENTRY(MAKEFILE),
	MAP_ENTRY(PASCAL),
	// ...
};

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/957/files/aea7d7845917843dd6b02e5a8dc9031cabc87a86..5d9376ea801a6e6c3ec22748741362a3a2eff7ac#r61944971
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20160503/426b8b5e/attachment.html>


More information about the Github-comments mailing list