CTags icon indicating copy to clipboard operation
CTags copied to clipboard

Fix matching of regex patterns lacking a right-anchor:

Open zcutlip opened this issue 6 years ago • 4 comments

  • This addresses issue #310
  • ctags sometimes omits the right-anchor ('$') from its regexes
  • This seems to happen with C macros
  • Split ex_command into the pattern, sans right-anchor plus:
    • an optional '$' anchor is there was one to start with
  • Return a tuple: (pattern, optional_anchor)
  • When later searching for the pattern, add the anchor or empty string back on

zcutlip avatar Apr 05 '19 04:04 zcutlip

I haven't touched this for quite some time and no longer use it myself, therefore I'm unable to test this :( I'd be willing to blindly merge it but how well tested is it?

stephenfin avatar Apr 05 '19 06:04 stephenfin

Not terribly well tested. I tried it out on some fairly complex open source kernel code, but that's about it. Do you have a set of tests or some sort of testing process I can do?

zcutlip avatar Apr 05 '19 17:04 zcutlip

Not particularly. There are some unit tests but I'm not sure how applicable they are. If you've been using this for some time, that's probably good enough testing

stephenfin avatar Apr 06 '19 08:04 stephenfin

@zcutlip thank you for fixing the issue.

I see more things with C code and incorrect regexps. For example a bunch of functions in Linux tree are not properly CTagged. e.g. jumping to arch_local_irq_restore does not work. Looking at tags file I see

arch_local_irq_restore  arch/x86/include/asm/irqflags.h /^static inline notrace void arch_local_irq_restore(unsigned long flags)$/;"    f       typeref:typename:notrace void   signature:(unsigned long flags)
arch_local_irq_restore  arch/x86/include/asm/paravirt.h /^static inline notrace void arch_local_irq_restore(unsigned long f)$/;"        f       typeref:typename:notrace void   signature:(unsigned long f)
arch_local_irq_restore  include/asm-generic/irqflags.h  /^void arch_local_irq_restore(unsigned long flags);$/;" p       typeref:typename:void   signature:(unsigned long flags)

I wonder if parethesis in the regexp should be escaped. But as it is harder to change CTgas behavior maybe the plugin should workaround the pproblem?

anatol avatar Apr 26 '19 20:04 anatol