Skip to content

Instantly share code, notes, and snippets.

@aslpavel
Last active May 24, 2018 16:17
Show Gist options
  • Select an option

  • Save aslpavel/8c907c8946192c4793552f61718e5c7e to your computer and use it in GitHub Desktop.

Select an option

Save aslpavel/8c907c8946192c4793552f61718e5c7e to your computer and use it in GitHub Desktop.
building ctags for mononoke
--langdef=Rust
--langmap=Rust:.rs
--regex-Rust=/^[ \t]*(#\[[^\]]\][ \t]*)*(pub(\(crate\))?[ \t]+)?(extern[ \t]+)?("[^"]+"[ \t]+)?(unsafe[ \t]+)?fn[ \t]+([a-zA-Z0-9_]+)/\7/f,functions,function definitions/
--regex-Rust=/^[ \t]*(pub(\(crate\))?[ \t]+)?type[ \t]+([a-zA-Z0-9_]+)/\3/T,types,type definitions/
--regex-Rust=/^[ \t]*(pub(\(crate\))?[ \t]+)?enum[ \t]+([a-zA-Z0-9_]+)/\3/g,enum,enumeration names/
--regex-Rust=/^[ \t]*(pub(\(crate\))?[ \t]+)?struct[ \t]+([a-zA-Z0-9_]+)/\3/s,structure names/
--regex-Rust=/^[ \t]*(pub(\(crate\))?[ \t]+)?(static|const)[ \t]+(mut[ \t]+)?([a-zA-Z0-9_]+)/\5/c,consts,static constants/
--regex-Rust=/^[ \t]*(pub(\(crate\))?[ \t]+)?(unsafe[ \t]+)?trait[ \t]+([a-zA-Z0-9_]+)/\4/t,traits,traits/
--regex-Rust=/^[ \t]*(pub(\(crate\))?[ \t]+)?(unsafe[ \t]+)?impl([ \t\n]*<[^>]*>)?[ \t]+(([a-zA-Z0-9_:]+)[ \t]*(<[^>]*>)?[ \t]+)?(for[ \t]+)?([a-zA-Z0-9_]+)/\9/i,impls,trait implemented for/
--regex-Rust=/^[ \t]*(pub(\(crate\))?[ \t]+)?(unsafe[ \t]+)?impl([ \t\n]*<[^>]*>)?[ \t]+(([a-zA-Z0-9_:]+)[ \t]*(<[^>]*>)?[ \t]+)for[ \t]+[a-zA-Z0-9_]+/\6/i,impls,trait implementations/
--regex-Rust=/^[ \t]*macro_rules![ \t]+([a-zA-Z0-9_]+)/\1/d,macros,macro definitions/
--langdef=Thrift
--langmap=Thrift:.thrift
--regex-thrift=/^[ \t]*struct[ \t]*([a-zA-Z0-9_]+)/\1/c,classes/
--regex-thrift=/^[ \t]*union[ \t]*([a-zA-Z0-9_]+)/\1/T,types/
--regex-thrift=/^[ \t]*enum[ \t]*([a-zA-Z0-9_]+)/\1/T,types/
--regex-thrift=/^[ \t]*typedef[ \t]*[a-zA-Z0-9_<>]+[ \t]*([a-zA-Z0-9_]+)/\1/T,types/
--regex-thrift=/^[ \t]*[a-zA-Z0-9_<>\.]+[ \t]*([a-zA-Z0-9_]+)\(/\1/m,methods/
--regex-thrift=/^[ \t]*([A-Z0-9_]+)[ \t]*=/\1/C,constants/
#!/usr/bin/env bash
FBCODE_ROOT="/home/$USER/fbsource/fbcode"
TAGS_FILE="$FBCODE_ROOT/scm/mononoke/TAGS"
TAGS_CMD="/usr/bin/ctags -e --languages=Rust,Thrift -f $TAGS_FILE"
$TAGS_CMD -R "$FBCODE_ROOT/scm/mononoke"
$TAGS_CMD -a -R "$FBCODE_ROOT/common/rust"
RUST_VERSION="1.26.0"
$TAGS_CMD -a -R "$FBCODE_ROOT/third-party2/rust/$RUST_VERSION/src/rust/src/libstd"
$TAGS_CMD -a -R "$FBCODE_ROOT/third-party2/rust/$RUST_VERSION/src/rust/src/liballoc"
$TAGS_CMD -a -R "$FBCODE_ROOT/third-party2/rust-crates-io/0.0.0/src/crates.io/vendor"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment