Use cxx parser from uctags by techee · Pull Request #3032 · geany/geany (original) (raw)

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

techee

@techee

This is to avoid clash with cpreprocessor.c/h used by the new cxx parser. Merging lcpp.c/h with cpreprocessor.c/h would be difficult (at least for now) because of the differences in c.c so keep them separate for now.

@techee

As a result, when we copy the new cxx parser, we don't have clashes of these symbols from the two different parsers.

@techee

This patch only makes the parser compile, it doesn't enable it yet.

@techee

There are several things needed for this:

  1. The new preprocessor has to be defined as a separate parser.

  2. Tags from the new c/c++ parsers and the preprocessor parser have to be mapped to Geany types. We still need to keep the old mappings because some parsers like Ferite or GLSL still use the old C parser.

  3. Anonymous tags have a different name so we have to reflect this in tm_tag_is_anon().

@techee

The changes are mostly these:

  1. Spaces in function argument list

(int var1, int var2, ...) - before (int var1,int var2,...) - now

  1. Anonymous tags

anon_struct_1 anon_union_2 anon_typedef_3

vs

__anon1 __anon2 __anon3

  1. Improved parsing of the new parser

@techee

@techee

techee

@techee

The syntax is slightly different from the previous syntax and is described here:

https://docs.ctags.io/en/latest/parser-cxx.html

Basic usage should be the same, uctags just doesn't support Geany's wildcard ignores like G_GNUC_*. On the other hand the new parser is much more resilient to macros so there shouldn't be so much need for manual ignores.

The original code is still kept for parsers from c.c that still use the old preprocessor.

@techee

Conflicts:

ctags/Makefile.am

@techee

@ntrel ntrel mentioned this pull request

Apr 28, 2023