Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync ctags parsers with big changes with Geany #2991

Merged
merged 23 commits into from Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
328bc8b
Remove the geany_ prefix from selected parsers and use the correspond…
techee Nov 8, 2021
644f22a
Update tag mappings in tm_parser.c
techee Nov 26, 2021
cd1ec45
Update PHP and zephir context separator to "\\" which is used in ucta…
techee Nov 26, 2021
28a0a50
Update ruby unit tests
techee Nov 26, 2021
9168afd
Update nsis unit tests
techee Nov 26, 2021
955e0eb
Update pascal unit tests
techee Nov 26, 2021
d2e6420
Update go unit tests
techee Nov 26, 2021
827228e
Update php and zephir unit tests
techee Nov 26, 2021
5e28f6b
Update Objective-C unit tests
techee Nov 26, 2021
cb1c3e8
Update lua unit tests
techee Nov 26, 2021
4589ce6
Remove pascal parser
techee Nov 28, 2021
0de1b5d
Revert "Update pascal unit tests"
techee Nov 28, 2021
0ae4e82
Add uctags iniconf parser
techee Nov 29, 2021
2a01521
Update tag mappings for the iniconf parser
techee Nov 29, 2021
4fb3cdd
Add a way to modify scope information if needed and use it to unify p…
techee Dec 1, 2021
8a29088
Remove comment regarding ruby scope separator
techee Dec 1, 2021
7810a5b
Add comment explaining why we modify PHP scope separators
techee Dec 2, 2021
d49f3e9
Merge branch 'master' into nontrivial_parser_sync
techee Dec 2, 2021
ceaef0d
Add a mechanism to enable/disable roles for certain kinds
techee Dec 2, 2021
75466c4
Move Go parser to the list of languages returning full scope information
techee Dec 2, 2021
940012d
Add a mechanism to enable/disable some ctags kinds
techee Dec 3, 2021
77723b6
Add LUA to the list of parsers returning full scope
techee Dec 3, 2021
70bad89
Enable/disable kinds in ctags based on whether we use them or not
techee Dec 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/tagmanager/tm_ctags.c
Expand Up @@ -49,7 +49,22 @@ static bool nonfatal_error_printer(const errorSelection selection,
}


static void enable_all_lang_kinds()
static void enable_roles(const TMParserType lang, guint kind)
{
unsigned int c = countLanguageRoles(lang, kind);
kindDefinition *def = getLanguageKind(lang, kind);
gchar kind_letter = def->letter;

for (unsigned int i = 0; i < c; i++)
{
roleDefinition* rdef = getLanguageRole(lang, kind, (int)i);
gboolean should_enable = tm_parser_enable_role(lang, kind_letter);
enableRole(rdef, should_enable);
}
}


static void enable_kinds_and_roles()
{
TMParserType lang;

Expand All @@ -62,6 +77,7 @@ static void enable_all_lang_kinds()
{
kindDefinition *def = getLanguageKind(lang, kind);
enableKind(def, true);
enable_roles(lang, kind);
}
}
}
Expand Down Expand Up @@ -226,7 +242,7 @@ void tm_ctags_init(void)
enableXtag(XTAG_REFERENCE_TAGS, true);

/* some kinds we are interested in are disabled by default */
enable_all_lang_kinds();
enable_kinds_and_roles();
}


Expand Down
17 changes: 16 additions & 1 deletion src/tagmanager/tm_parser.c
Expand Up @@ -816,6 +816,21 @@ gchar *tm_parser_update_scope(TMParserType lang, gchar *scope)
}


/* whether or not to enable ctags roles for the given language and kind */
gboolean tm_parser_enable_role(TMParserType lang, gchar kind)
{
switch (lang)
{
case TM_PARSER_GO:
/* 'p' is used both for package definition tags and imported package
* tags and we can't tell which is which just by kind. By disabling
* roles for this kind, we only get package definition tags. */
return kind == 'p' ? FALSE : TRUE;
}
return TRUE;
}


const gchar *tm_parser_context_separator(TMParserType lang)
{
switch (lang)
Expand Down Expand Up @@ -858,6 +873,7 @@ gboolean tm_parser_has_full_context(TMParserType lang)
case TM_PARSER_D:
case TM_PARSER_FERITE:
case TM_PARSER_GLSL:
case TM_PARSER_GO:
case TM_PARSER_JAVA:
case TM_PARSER_JAVASCRIPT:
case TM_PARSER_JSON:
Expand All @@ -879,7 +895,6 @@ gboolean tm_parser_has_full_context(TMParserType lang)
case TM_PARSER_ERLANG:
case TM_PARSER_F77:
case TM_PARSER_FORTRAN:
case TM_PARSER_GO:
case TM_PARSER_OBJC:
case TM_PARSER_REST:
/* Other parsers don't use scope at all (or should be somewhere above) */
Expand Down
2 changes: 2 additions & 0 deletions src/tagmanager/tm_parser.h
Expand Up @@ -125,6 +125,8 @@ TMTagType tm_parser_get_subparser_type(TMParserType lang, TMParserType sublang,

gchar *tm_parser_update_scope(TMParserType lang, gchar *scope);

gboolean tm_parser_enable_role(TMParserType lang, gchar kind);

const gchar *tm_parser_context_separator(TMParserType lang);

gboolean tm_parser_has_full_context(TMParserType lang);
Expand Down
1 change: 0 additions & 1 deletion tests/ctags/test.go.tags
Expand Up @@ -33,7 +33,6 @@ f2
f3�16�()�main.T1�0�(a, b int)
f4�16�(a func () func ())�main.T7�0�(func (), int)
f5�16�()�main�0
fmt�256�0
g�16384�main�0�int
h�16384�main�0�int
main�16�()�main�0
Expand Down