Skip to content

Commit 231832d

Browse files
chris-morganalexcrichton
authored andcommitted
Improve the ctags function regular expression.
Before it would only catch lines starting `fn` or `pub fn`. Now it can cope with: - attributes (e.g. `#[test] fn`) - external functions (e.g. `extern fn`, `extern "C" fn`) - unsafe functions (e.g. `unsafe fn`) … and any correct combination of these (e.g. `#[test] extern "C" unsafe fn`).
1 parent ea0bd40 commit 231832d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/etc/ctags.rust

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--langdef=Rust
22
--langmap=Rust:.rs
3-
--regex-Rust=/^[ \t]*(pub[ \t]+)?fn[ \t]+([a-zA-Z0-9_]+)/\2/f,functions,function definitions/
3+
--regex-Rust=/^[ \t]*(#\[[^\]]\][ \t]*)*(pub[ \t]+)?(extern[ \t]+)?("[^"]+"[ \t]+)?(unsafe[ \t]+)?fn[ \t]+([a-zA-Z0-9_]+)/\6/f,functions,function definitions/
44
--regex-Rust=/^[ \t]*(pub[ \t]+)?type[ \t]+([a-zA-Z0-9_]+)/\2/T,types,type definitions/
55
--regex-Rust=/^[ \t]*(pub[ \t]+)?enum[ \t]+([a-zA-Z0-9_]+)/\2/g,enum,enumeration names/
66
--regex-Rust=/^[ \t]*(pub[ \t]+)?struct[ \t]+([a-zA-Z0-9_]+)/\2/s,structure names/

0 commit comments

Comments
 (0)