Skip to content

Improved the ctags impl regex. #15865

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Aug 6, 2014
Merged

Improved the ctags impl regex. #15865

merged 1 commit into from
Aug 6, 2014

Conversation

jameshurst
Copy link

Previously the implementation detection regex would detect
impl fmt::Show for MyStruct as fmt. Now it will be detected as
fmt::Show for MyStruct. Implementations such as impl MyStruct will
still be detected as MyStruct.

@@ -7,5 +7,5 @@
--regex-Rust=/^[ \t]*(pub[ \t]+)?mod[ \t]+([a-zA-Z0-9_]+)/\2/m,modules,module names/
--regex-Rust=/^[ \t]*(pub[ \t]+)?static[ \t]+([a-zA-Z0-9_]+)/\2/c,consts,static constants/
--regex-Rust=/^[ \t]*(pub[ \t]+)?trait[ \t]+([a-zA-Z0-9_]+)/\2/t,traits,traits/
--regex-Rust=/^[ \t]*(pub[ \t]+)?impl([ \t\n]+<.*>)?[ \t]+([a-zA-Z0-9_]+)/\3/i,impls,trait implementations/
--regex-Rust=/^[ \t]*(pub[ \t]+)?impl([ \t\n]*<.*>)?[ \t]+(([a-zA-Z0-9_:]+[ \t])[ \t]*(for[ \t])[ \t]*)?([a-zA-Z0-9_:]+)/\4\5\6/i,impls,trait implementations/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably still wrong for something like impl Iterator<uint> for ..., right? (That is, I can't see handling of type parameters here.) Also, is the space-or-tab meant to be included in these capturing groups?

@jameshurst
Copy link
Author

I've made some changes so now it should handle type parameters as well. Previously I did intent to capture the space or tab so that it would show up in the replacement, but it looks like I can just add the space in the replacements and ctags is smart enough to remove the unneeded spaces.

bors added a commit that referenced this pull request Aug 6, 2014
Previously the implementation detection regex would detect
`impl fmt::Show for MyStruct` as `fmt`. Now it will be detected as
`fmt::Show for MyStruct`. Implementations such as `impl MyStruct` will
still be detected as `MyStruct`.
@bors bors closed this Aug 6, 2014
@bors bors merged commit 8a7b0fa into rust-lang:master Aug 6, 2014
@jameshurst jameshurst deleted the ctags-regex branch August 7, 2014 01:22
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants