Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

masatake
Copy link
Member

@masatake masatake commented Jun 8, 2025

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

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

The original --map- 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 #3287 .

The regular expression passed to --map- 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
  • extend optlib2c
  • add --list-map-regex
  • add --list-maps
  • add pcre backend

masatake added 3 commits June 6, 2025 09:12
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 universal-ctags#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

Signed-off-by: Masatake YAMATO <[email protected]>
@masatake masatake marked this pull request as draft June 8, 2025 23:34
@masatake masatake changed the title main: using regex for choosing a paser for given file name [WIP] main: using regex for choosing a paser for given file name Jun 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant