ctags icon indicating copy to clipboard operation
ctags copied to clipboard

[WIP] main: using regex for choosing a paser for given file name

Open masatake opened this issue 9 months ago • 0 comments

main: using regex for choosing a parser for the given file name

This change extends --map-<LANG> option to support regular expression matching with the full file name.

The original --map-<LANG> option supports glob based matching and extension comparison with the file basename. However, two methods are not enough if the file names are too generic. See https://github.com/universal-ctags/ctags/pull/3287 .

The regular expression passed to --map-<LANG> must be surround by % character like

--map-RpmMacros='%(.*/)?macros.d/macros.([^/]+)$%'

If you want to match in a case-insensitive way, append `i' after the second % like

--map-RpmMacros='%(.*/)?macros.d/macros.([^/]+)$%i'

If you want to use % as part of an expression, put \ before % for escaping.

TODO:

  • [ ] reconsider name regex, rxpr, or something
  • [ ] update ctags.1
  • [ ] add Tmain test cases
  • [ ] add description to --help
  • [X] extend optlib2c
  • [X] add --list-map-regex
  • [X] add --list-maps
  • [ ] add pcre backend

masatake avatar Jun 08 '25 23:06 masatake