emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding support for xref jumping to headers/interfaces


From: Dmitry Gutov
Subject: Re: Adding support for xref jumping to headers/interfaces
Date: Wed, 8 Mar 2023 00:41:49 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1

On 05/03/2023 14:06, Dmitry Gutov wrote:
For C-like languages, we'd need to run "etags --declarations" on *.h
files for that, I think.  And the resulting TAGS table will have stuff
other than just declarations, so we'd need some way of distinguishing
between them and the rest.


The etags xref backend usually works with pre-generated tags files. So a way to distinguish between them and the rest would be best.

To expand on that thought: Universal Ctags has a bunch of extensions for the output -- in particular the "kind" field.

After 'sudo apt install universal-ctags', I can see this:

  $ ctags --list-kinds=c
  d  macro definitions
  e  enumerators (values inside an enumeration)
  f  function definitions
  g  enumeration names
  h  included header files
  l  local variables [off]
  m  struct, and union members
  p  function prototypes [off]
  s  structure names
  t  typedefs
  u  union names
  v  variable definitions
  x  external and forward variable declarations [off]
  z  function parameters inside function or prototype definitions [off]
  L  goto labels [off]
  D  parameters inside macro definitions [off]

That seems to mean that it can distinguish "function prototypes" and "forward variable declarations", although their scanning seems to be disabled by default (can be toggled via --kinds-c=+p+x).

So I suppose the question here is how hard it would be to add to existing etags parsers something like that, and whether we can extend the TAGS format in a backward compatible way with this info.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]