Use cxx parser from uctags (#3032)
commit5ea3e3ec77eaa87ff709f003743dbb80285e3b6f
authorJiří Techet <techet@gmail.com>
Sun, 19 Dec 2021 00:04:54 +0000 (19 01:04 +0100)
committerGitHub <noreply@github.com>
Sun, 19 Dec 2021 00:04:54 +0000 (19 10:04 +1000)
treef825b91c52df3b039422b242d2ae083f62a24d8b
parented1048918a0a92dd8b001a46cb049c862b4aa173
Use cxx parser from uctags (#3032)

* Add "l" prefix to functions in lcpp.c/h

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.

* Rename C/C++ parsers to "Old"

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

* Add the new cxx parser

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

* Enable the new cxx parser

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().

* Update C/C++ unit tests

The changes are mostly these:

1. Spaces in function argument list

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

2. Anonymous tags

anon_struct_1
anon_union_2
anon_typedef_3

vs

__anon1
__anon2
__anon3

3. Improved parsing of the new parser

* Eliminate console warning for cxx 'using' tags

Fix from

https://github.com/universal-ctags/ctags/commit/fb305d8814c4dc53a94fcbc5f0c0d2d701f176fa

* Update update-ctags.py to also update the cxx parser

* Pass our ignore.tags file with ignored symbols to cxx preprocessor

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.

* Update documentation regarding ignore.tags
83 files changed:
ctags/Makefile.am
ctags/parsers/cpreprocessor.c [new file with mode: 0644]
ctags/parsers/cpreprocessor.h [new file with mode: 0644]
ctags/parsers/cxx/cxx.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_debug.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_debug.h [new file with mode: 0644]
ctags/parsers/cxx/cxx_debug_type.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_keyword.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_keyword.h [new file with mode: 0644]
ctags/parsers/cxx/cxx_parser.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_parser.h [new file with mode: 0644]
ctags/parsers/cxx/cxx_parser_block.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_parser_function.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_parser_internal.h [new file with mode: 0644]
ctags/parsers/cxx/cxx_parser_lambda.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_parser_namespace.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_parser_template.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_parser_tokenizer.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_parser_typedef.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_parser_using.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_parser_variable.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_qtmoc.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_scope.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_scope.h [new file with mode: 0644]
ctags/parsers/cxx/cxx_subparser.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_subparser.h [new file with mode: 0644]
ctags/parsers/cxx/cxx_subparser_internal.h [new file with mode: 0644]
ctags/parsers/cxx/cxx_tag.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_tag.h [new file with mode: 0644]
ctags/parsers/cxx/cxx_token.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_token.h [new file with mode: 0644]
ctags/parsers/cxx/cxx_token_chain.c [new file with mode: 0644]
ctags/parsers/cxx/cxx_token_chain.h [new file with mode: 0644]
ctags/parsers/geany_c.c
ctags/parsers/geany_lcpp.c
ctags/parsers/geany_lcpp.h
ctags/parsers/geany_verilog.c
doc/geany.txt
scripts/update-ctags.py
src/symbols.c
src/tagmanager/tm_ctags.c
src/tagmanager/tm_ctags.h
src/tagmanager/tm_parser.c
src/tagmanager/tm_parser.h
src/tagmanager/tm_parsers.h
src/tagmanager/tm_tag.c
tests/ctags/backslashes.c.tags
tests/ctags/bit_field.c.tags
tests/ctags/bug1201689.c.tags
tests/ctags/bug1466117.c.tags
tests/ctags/bug1491666.c.tags
tests/ctags/bug1563476.cpp.tags
tests/ctags/bug1575055.cpp.tags
tests/ctags/bug1585745.cpp.tags
tests/ctags/bug1764143.h.tags
tests/ctags/bug1770479.cpp.tags
tests/ctags/bug1773926.cpp.tags
tests/ctags/bug1799340.cpp.tags
tests/ctags/bug1907083.cpp.tags
tests/ctags/bug1924919.cpp.tags
tests/ctags/bug507864.c.tags
tests/ctags/bug556645.c.tags
tests/ctags/bug556646.c.tags
tests/ctags/bug639639.h.tags
tests/ctags/bug639644.hpp.tags
tests/ctags/c-digraphs.c.tags
tests/ctags/c-trigraphs.c.tags
tests/ctags/cpp_destructor.cpp.tags
tests/ctags/cxx11-final.cpp.tags
tests/ctags/cxx11-noexcept.cpp.tags
tests/ctags/cxx11-override.cpp.tags
tests/ctags/cxx11enum.cpp.tags
tests/ctags/cxx14-combined.cpp.tags
tests/ctags/extern_variable.h.tags
tests/ctags/func_typedef.h.tags
tests/ctags/local.c.tags
tests/ctags/macros.c.tags
tests/ctags/namespace.cpp.tags
tests/ctags/process_order.c.tags
tests/ctags/prototype.h.tags
tests/ctags/signature.cpp.tags
tests/ctags/static_array.c.tags
tests/ctags/var-and-return-type.cpp.tags