Skip to content

Commit

Permalink
Fix C++ function rule with colon in parameter list (#368)
Browse files Browse the repository at this point in the history
A C++ function definition like

  void MyClass::test(std::string) {}

is not found by dumb-jump. Fix this by allowing colon in parameter
lists.
  • Loading branch information
jrosdahl committed Sep 12, 2020
1 parent 0d74b2f commit ec8ac6d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dumb-jump.el
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ or most optimal searcher."

;; c++
(:type "function" :supports ("ag" "rg" "git-grep") :language "c++"
:regex "\\bJJJ(\\s|\\))*\\((\\w|[,&*.<>]|\\s)*(\\))\\s*(const|->|\\{|$)|typedef\\s+(\\w|[(*]|\\s)+JJJ(\\)|\\s)*\\("
:tests ("int test(){" "my_struct (*test)(int a, int b){" "auto MyClass::test ( Builder& reference, ) -> decltype( builder.func() ) {" "int test( int *random_argument) const {" "test::test() {" "typedef int (*test)(int);")
:regex "\\bJJJ(\\s|\\))*\\((\\w|[,&*.<>:]|\\s)*(\\))\\s*(const|->|\\{|$)|typedef\\s+(\\w|[(*]|\\s)+JJJ(\\)|\\s)*\\("
:tests ("int test(){" "my_struct (*test)(int a, int b){" "auto MyClass::test ( Builder::Builder& reference, ) -> decltype( builder.func() ) {" "int test( int *random_argument) const {" "test::test() {" "typedef int (*test)(int);")
:not ("return test();)" "int test(a, b);" "if( test() ) {" "else test();"))

;; (:type "variable" :supports ("grep") :language "c++"
Expand Down

0 comments on commit ec8ac6d

Please sign in to comment.