From fc480a696f21b05b0b468ef8671f25830a14c8f5 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Thu, 27 Feb 2014 22:34:08 +1100 Subject: [PATCH] Improve the ctags function regular expression. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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`). --- src/etc/ctags.rust | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/etc/ctags.rust b/src/etc/ctags.rust index f0fab3347d163..b42edf7579a64 100644 --- a/src/etc/ctags.rust +++ b/src/etc/ctags.rust @@ -1,6 +1,6 @@ --langdef=Rust --langmap=Rust:.rs ---regex-Rust=/^[ \t]*(pub[ \t]+)?fn[ \t]+([a-zA-Z0-9_]+)/\2/f,functions,function definitions/ +--regex-Rust=/^[ \t]*(#\[[^\]]\][ \t]*)*(pub[ \t]+)?(extern[ \t]+)?("[^"]+"[ \t]+)?(unsafe[ \t]+)?fn[ \t]+([a-zA-Z0-9_]+)/\6/f,functions,function definitions/ --regex-Rust=/^[ \t]*(pub[ \t]+)?type[ \t]+([a-zA-Z0-9_]+)/\2/T,types,type definitions/ --regex-Rust=/^[ \t]*(pub[ \t]+)?enum[ \t]+([a-zA-Z0-9_]+)/\2/g,enum,enumeration names/ --regex-Rust=/^[ \t]*(pub[ \t]+)?struct[ \t]+([a-zA-Z0-9_]+)/\2/s,structure names/