Skip to content

Instantly share code, notes, and snippets.

@bounceme
Last active May 20, 2017 02:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bounceme/ae8bab4f56ec1948ac1faca3b2f38b98 to your computer and use it in GitHub Desktop.
Save bounceme/ae8bab4f56ec1948ac1faca3b2f38b98 to your computer and use it in GitHub Desktop.
[
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"elisp",
"regex":"((defun|cl-defun)\\s+JJJ\\j",
"tests":[
"(defun test (blah)",
"(defun test\n",
"(cl-defun test (blah)",
"(cl-defun test\n"
],
"not":[
"(defun test-asdf (blah)",
"(defun test-blah\n",
"(cl-defun test-asdf (blah)",
"(cl-defun test-blah\n"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"elisp",
"regex":"\\(defvar\\b\\s*JJJ\\j",
"tests":[
"(defvar test ",
"(defvar test\n"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"elisp",
"regex":"\\(defcustom\\b\\s*JJJ\\j",
"tests":[
"(defcustom test ",
"(defcustom test\n"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"elisp",
"regex":"\\(setq\\b\\s*JJJ\\j",
"tests":[
"(setq test 123)"
],
"not":[
"setq test-blah 123)"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"elisp",
"regex":"\\(JJJ\\s+",
"tests":[
"(let ((test 123)))"
],
"not":[
"(let ((test-2 123)))"
]
},
{
"type":"variable",
"supports":[
"ag",
"rg",
"git-grep"
],
"language":"elisp",
"regex":"\\((defun|cl-defun)\\s*.+\\(?\\s*JJJ\\j\\s*\\)?",
"tests":[
"(defun blah (test)",
"(defun blah (test blah)",
"(defun (blah test)"
],
"not":[
"(defun blah (test-1)",
"(defun blah (test-2 blah)",
"(defun (blah test-3)"
]
},
{
"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);"
],
"not":[
"return test();)",
"int test(a, b);",
"if( test() ) {",
"else test();"
]
},
{
"type":"variable",
"supports":[
"ag"
],
"language":"c++",
"regex":"\\b(?!(class\\b|struct\\b|return\\b|else\\b|delete\\b))(\\w+|[,>])([*&]|\\s)+JJJ\\s*(\\[(\\d|\\s)*\\])*\\s*([=,(){;]|:\\s*\\d)|#define\\s+JJJ\\b",
"tests":[
"int test=2;",
"char *test;",
"int x = 1, test = 2",
"int test[20];",
"#define test",
"typedef int test;",
"unsigned int test:2"
],
"not":[
"return test;",
"#define NOT test",
"else test=2;"
]
},
{
"type":"type",
"supports":[
"ag",
"rg",
"git-grep"
],
"language":"c++",
"regex":"\\b(class|struct|enum|union)\\b\\s*JJJ\\b\\s*(final\\s*)?(:((\\s*\\w+\\s*::)*\\s*\\w*\\s*<?(\\s*\\w+\\s*::)*\\w+>?\\s*,*)+)?((\\{|$))|}\\s*JJJ\\b\\s*;",
"tests":[
"typedef struct test {",
"enum test {",
"} test;",
"union test {",
"class test final: public Parent1, private Parent2{",
"class test : public std::vector<int> {"
],
"not":[
"union test var;",
"struct test function() {"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"clojure",
"regex":"\\(def\\s+JJJ\\j",
"tests":[
"(def test (foo)"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"clojure",
"regex":"\\(defn-?\\s+JJJ\\j",
"tests":[
"(defn test [foo]",
"(defn- test [foo]"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"clojure",
"regex":"\\(defmacro\\s+JJJ\\j",
"tests":[
"(defmacro test [foo]"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"clojure",
"regex":"\\(deftype\\s+JJJ\\j",
"tests":[
"(deftype test [foo]"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"clojure",
"regex":"\\(defmulti\\s+JJJ\\j",
"tests":[
"(defmulti test fn"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"clojure",
"regex":"\\(defmethod\\s+JJJ\\j",
"tests":[
"(defmethod test type"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"clojure",
"regex":"\\(definterface\\s+JJJ\\j",
"tests":[
"(definterface test (foo)"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"clojure",
"regex":"\\(defprotocol\\s+JJJ\\j",
"tests":[
"(defprotocol test (foo)"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"clojure",
"regex":"\\(defrecord\\s+JJJ\\j",
"tests":[
"(defrecord test [foo]"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"coffeescript",
"regex":"^\\s*JJJ\\s*[=:].*[-=]>",
"tests":[
"test = () =>",
"test= =>",
"test = ->",
"test=()->",
"test : () =>",
"test: =>",
"test : ->",
"test:()->"
],
"not":[
"# test = =>",
"test = 1"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"coffeescript",
"regex":"^\\s*JJJ\\s*[:=][^:=-][^>]+$",
"tests":[
"test = $",
"test : [",
"test = {",
"test = a"
],
"not":[
"test::a",
"test: =>",
"test == 1",
"# test = 1"
]
},
{
"type":"class",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"coffeescript",
"regex":"^\\s*\\bclass\\s+JJJ",
"tests":[
"class test",
"class test extends"
],
"not":[
"# class"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"objc",
"regex":"\\)\\s*JJJ(:|\\b|\\s)",
"tests":[
"- (void)test",
"- (void)test:(UIAlertView *)alertView"
],
"not":[
"- (void)testnot",
"- (void)testnot:(UIAlertView *)alertView"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"objc",
"regex":"\\b\\*?JJJ\\s*=[^=\\n]+",
"tests":[
"NSString *test = @\"asdf\""
],
"not":[
"NSString *testnot = @\"asdf\"",
"NSString *nottest = @\"asdf\""
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"swift",
"regex":"(let|var)\\s*JJJ\\s*(=|:)[^=:\\n]+",
"tests":[
"let test = 1234",
"var test = 1234",
"private lazy var test: UITapGestureRecognizer"
],
"not":[
"if test == 1234:"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"swift",
"regex":"func\\s*JJJ\\b\\s*\\(",
"tests":[
"func test(asdf)",
"func test()"
],
"not":[
"func testnot(asdf)",
"func testnot()"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"swift",
"regex":"(class|struct)\\s*JJJ\\b\\s*?",
"tests":[
"class test:",
"class test: UIWindow"
],
"not":[
"class testnot:",
"class testnot(object):"
]
},
{
"type":"function",
"supports":[
"ag",
"rg"
],
"language":"csharp",
"regex":"^\\s*(?:[^=\\W]+\\s+){1,3}JJJ\\s*\\(",
"tests":[
"int test()",
"int test(param)",
"static int test()",
"static int test(param)",
"public static MyType test()",
"private virtual SomeType test(param)",
"static int test()"
],
"not":[
"test()",
"testnot()",
"blah = new test()"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"csharp",
"regex":"\\s*\\bJJJ\\s*=[^=\\n)]+",
"tests":[
"int test = 1234"
],
"not":[
"if test == 1234:",
"int nottest = 44"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"csharp",
"regex":"(class|interface)\\s*JJJ\\b",
"tests":[
"class test:",
"public class test : IReadableChannel, I"
],
"not":[
"class testnot:",
"public class testnot : IReadableChannel, I"
]
},
{
"type":"function",
"supports":[
"ag",
"rg"
],
"language":"java",
"regex":"^\\s*(?:[^=\\W]+\\s+){1,3}JJJ\\s*\\(",
"tests":[
"int test()",
"int test(param)",
"static int test()",
"static int test(param)",
"public static MyType test()",
"private virtual SomeType test(param)",
"static int test()"
],
"not":[
"test()",
"testnot()",
"blah = new test()"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"java",
"regex":"\\s*\\bJJJ\\s*=[^=\\n)]+",
"tests":[
"int test = 1234"
],
"not":[
"if test == 1234:",
"int nottest = 44"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"java",
"regex":"(class|interface)\\s*JJJ\\b",
"tests":[
"class test:",
"public class test implements Something"
],
"not":[
"class testnot:",
"public class testnot implements Something"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"python",
"regex":"\\s*JJJ\\s*=[^=\\n]+",
"tests":[
"test = 1234"
],
"not":[
"if test == 1234:"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"python",
"regex":"def\\s*JJJ\\b\\s*\\(",
"tests":[
"\tdef test(asdf)",
"def test()"
],
"not":[
"\tdef testnot(asdf)",
"def testnot()"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"python",
"regex":"class\\s*JJJ\\b\\s*\\(?",
"tests":[
"class test(object):",
"class test:"
],
"not":[
"class testnot:",
"class testnot(object):"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"ruby",
"regex":"\\s*JJJ\\s*=[^=\\n]+",
"tests":[
"test = 1234"
],
"not":[
"if test == 1234"
]
},
{
"type":"function",
"supports":[
"ag",
"rg"
],
"language":"ruby",
"regex":"\\bdef\\s+(?:\\w+(::|\\.))*JJJ\\j",
"tests":[
"def test(foo)",
"def test()",
"def test foo",
"def test; end",
"def self.test()",
"def MODULE::test()"
]
},
{
"type":"function",
"supports":[
"ag",
"rg"
],
"language":"ruby",
"regex":"\\bdefine(?:_singleton|_instance)?_method\\s*(?:\\(\\s*)?:JJJ\\j",
"tests":[
"define_method(:test, &body)",
"mod.define_instance_method(:test) { body }"
]
},
{
"type":"type",
"supports":[
"ag",
"rg"
],
"language":"ruby",
"regex":"\\bclass\\s+(?:\\w*::)*JJJ\\j",
"tests":[
"class test",
"class Foo::test"
]
},
{
"type":"type",
"supports":[
"ag",
"rg"
],
"language":"ruby",
"regex":"\\bmodule\\s+(?:\\w*::)*JJJ\\j",
"tests":[
"module test",
"module Foo::test"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"scala",
"regex":"\\bval\\s*JJJ\\s*=[^=\\n]+",
"tests":[
"val test = 1234"
],
"not":[
"case test => 1234"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"scala",
"regex":"\\bvar\\s*JJJ\\s*=[^=\\n]+",
"tests":[
"var test = 1234"
],
"not":[
"case test => 1234"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"scala",
"regex":"\\btype\\s*JJJ\\s*=[^=\\n]+",
"tests":[
"type test = 1234"
],
"not":[
"case test => 1234"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"scala",
"regex":"\\bdef\\s*JJJ\\s*\\(",
"tests":[
"def test(asdf)",
"def test()"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"scala",
"regex":"class\\s*JJJ\\s*\\(?",
"tests":[
"class test(object)"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"scala",
"regex":"trait\\s*JJJ\\s*\\(?",
"tests":[
"trait test(object)"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"scala",
"regex":"object\\s*JJJ\\s*\\(?",
"tests":[
"object test(object)"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"r",
"regex":"\\bJJJ\\s*=[^=><]",
"tests":[
"test = 1234"
],
"not":[
"if (test == 1234)"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"r",
"regex":"\\bJJJ\\s*<-\\s*function",
"tests":[
"test <- function"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"perl",
"regex":"sub\\s*JJJ\\s*\\{",
"tests":[
"sub test{",
"sub test {"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"perl",
"regex":"JJJ\\s*=\\s*",
"tests":[
"$test = 1234"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"shell",
"regex":"function\\s*JJJ\\s*",
"tests":[
"function test{",
"function test {",
"function test () {"
],
"not":[
"function nottest {"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"shell",
"regex":"\\bJJJ\\s*=\\s*",
"tests":[
"test = 1234"
],
"not":[
"blahtest = 1234"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"php",
"regex":"function\\s*JJJ\\s*\\(",
"tests":[
"function test()",
"function test ()"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"php",
"regex":"(\\s|->|\\$|::)JJJ\\s*=\\s*",
"tests":[
"$test = 1234",
"$foo->test = 1234"
]
},
{
"type":"trait",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"php",
"regex":"trait\\s*JJJ\\s*\\{",
"tests":[
"trait test{",
"trait test {"
]
},
{
"type":"interface",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"php",
"regex":"interface\\s*JJJ\\s*\\{",
"tests":[
"interface test{",
"interface test {"
]
},
{
"type":"class",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"php",
"regex":"class\\s*JJJ\\s*(extends|implements|\\{)",
"tests":[
"class test{",
"class test {",
"class test extends foo",
"class test implements foo"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"faust",
"regex":"\\bJJJ(\\(.+\\))*\\s*=",
"tests":[
"test = osc + 0.5;",
"test(freq) = osc(freq) + 0.5;"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"fortran",
"regex":"\\s*\\bJJJ\\s*=[^=\\n]+",
"tests":[
"test = 1234"
],
"not":[
"if (test == 1234)"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"fortran",
"regex":"\\b(function|subroutine)\\s+JJJ\\b\\s*\\(",
"tests":[
"function test (foo)",
"integer function test(foo)",
"subroutine test (foo, bar)"
],
"not":[
"end function test",
"end subroutine test"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"fortran",
"regex":"^\\s*module\\s+JJJ\\s*",
"tests":[
"module test"
],
"not":[
"end module test"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"go",
"regex":"\\s*\\bJJJ\\s*=[^=\\n]+",
"tests":[
"test = 1234"
],
"not":[
"if test == 1234 {"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"go",
"regex":"\\s*\\bJJJ\\s*:=\\s*",
"tests":[
"test := 1234"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"go",
"regex":"func\\s+\\([^\\)]*\\)\\s+JJJ\\s*\\(",
"tests":[
"func (s *blah) test(filename string) string {"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"go",
"regex":"func\\s+JJJ\\s*\\(",
"tests":[
"func test(url string) (string, error)"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"go",
"regex":"type\\s+JJJ\\s+struct\\s+\\{",
"tests":[
"type test struct {"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"javascript",
"regex":"(service|factory)\\(['\"]JJJ['\"]",
"tags":[
"angular"
],
"tests":[
"module.factory('test', [\"$rootScope\", function($rootScope) {"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"javascript",
"regex":"\\bJJJ\\s*[=:]\\s*\\([^\\)]*\\)\\s+=>",
"tags":[
"es6"
],
"tests":[
"const test = (foo) => ",
"test: (foo) => {",
" test: (foo) => {"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"javascript",
"regex":"\\bJJJ\\s*\\([^\\)]*\\)\\s*[{]",
"tags":[
"es6"
],
"tests":[
"test(foo) {",
"test (foo){",
"test(foo){"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"javascript",
"tags":[
"es6"
],
"regex":"class\\s*JJJ\\s*[\\(\\{]",
"tests":[
"class test(object) {",
"class test{"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"javascript",
"tags":[
"es6"
],
"regex":"class\\s*JJJ\\s+extends",
"tests":[
"class test extends Component{"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"javascript",
"regex":"\\s*\\bJJJ\\s*=[^=\\n]+",
"tests":[
"test = 1234",
"const test = props =>"
],
"not":[
"if (test === 1234)"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"javascript",
"regex":"\\bfunction\\b[^\\(]*\\(\\s*[^\\)]*\\bJJJ\\b\\s*,?\\s*\\)?",
"tests":[
"function (test)",
"function (test, blah)",
"function somefunc(test, blah) {",
"function(blah, test)"
],
"not":[
"function (testLen)",
"function (test1, blah)",
"function somefunc(testFirst, blah) {",
"function(blah, testLast)",
"function (Lentest)",
"function (blahtest, blah)",
"function somefunc(Firsttest, blah) {",
"function(blah, Lasttest)"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"javascript",
"regex":"function\\s*JJJ\\s*\\(",
"tests":[
"function test()",
"function test ()"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"javascript",
"regex":"\\bJJJ\\s*:\\s*function\\s*\\(",
"tests":[
"test: function()"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"javascript",
"regex":"\\bJJJ\\s*=\\s*function\\s*\\(",
"tests":[
"test = function()"
]
},
{
"type":"function",
"supports":[
"ag"
],
"language":"haskell",
"regex":"^\\s*(let)?\\s*JJJ\\b\\s*(.+)?(?<==)",
"tests":[
"test n = n * 2",
"let test x y = x * y"
],
"not":[
"nottest n = n * 2",
"let testnot x y = x * y",
"test $ y z"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"haskell",
"regex":"^\\s*(let)?\\s*JJJ\\b\\s*::",
"tests":[
"test :: FilePath -> HttpSession [PkgIndexIndex]",
"test :: PackageId -> Tar.Entry -> PkgIndexInfo"
],
"not":[
"nottest :: FilePath -> HttpSession [PkgIndexIndex]",
"testnot :: PackageId -> Tar.Entry -> PkgIndexInfo"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"lua",
"regex":"\\s*\\bJJJ\\s*=[^=\\n]+",
"tests":[
"test = 1234"
],
"not":[
"if test === 1234"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"lua",
"regex":"\\bfunction\\b[^\\(]*\\(\\s*[^\\)]*\\bJJJ\\b\\s*,?\\s*\\)?",
"tests":[
"function (test)",
"function (test, blah)",
"function somefunc(test, blah)",
"function(blah, test)"
],
"not":[
"function (testLen)",
"function (test1, blah)",
"function somefunc(testFirst, blah)",
"function(blah, testLast)",
"function (Lentest)",
"function (blahtest, blah)",
"function somefunc(Firsttest, blah)",
"function(blah, Lasttest)"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"lua",
"regex":"function\\s*JJJ\\s*\\(",
"tests":[
"function test()",
"function test ()"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"lua",
"regex":"function\\s*.+[.:]JJJ\\s*\\(",
"tests":[
"function MyClass.test()",
"function MyClass.test ()",
"function MyClass:test()",
"function MyClass:test ()"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"lua",
"regex":"\\bJJJ\\s*=\\s*function\\s*\\(",
"tests":[
"test = function()"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"lua",
"regex":"\\b.+\\.JJJ\\s*=\\s*function\\s*\\(",
"tests":[
"MyClass.test = function()"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"rust",
"regex":"\\blet\\s+(\\([^=\\n]*)?(mut +)?JJJ([^=\\n]*\\))?(:\\s*[^=\\n]+)?\\s*=\\s*[^=\\n]+",
"tests":[
"let test = 1234;",
"let test: u32 = 1234;",
"let test: Vec<u32> = Vec::new();",
"let mut test = 1234;",
"let mut test: Vec<u32> = Vec::new();",
"let (a, test, b) = (1, 2, 3);",
"let (a, mut test, mut b) = (1, 2, 3);",
"let (mut a, mut test): (u32, usize) = (1, 2);"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"rust",
"regex":"\\bconst\\s+JJJ:\\s*[^=\\n]+\\s*=[^=\\n]+",
"tests":[
"const test: u32 = 1234;"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"rust",
"regex":"\\bstatic\\s+(mut\\s+)?JJJ:\\s*[^=\\n]+\\s*=[^=\\n]+",
"tests":[
"static test: u32 = 1234;",
"static mut test: u32 = 1234;"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"rust",
"regex":"\\bfn\\s+.+\\s*\\((.+,\\s+)?JJJ:\\s*[^=\\n]+\\s*(,\\s*.+)*\\)",
"tests":[
"fn abc(test: u32) -> u32 {",
"fn abc(x: u32, y: u32, test: Vec<u32>, z: Vec<Foo>)",
"fn abc(x: u32, y: u32, test: &mut Vec<u32>, z: Vec<Foo>)"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"rust",
"regex":"(if|while)\\s+let\\s+([^=\\n]+)?(mut\\s+)?JJJ([^=\\n\\(]+)?\\s*=\\s*[^=\\n]+",
"tests":[
"if let Some(test) = abc() {",
"if let Some(mut test) = abc() {",
"if let Ok(test) = abc() {",
"if let Ok(mut test) = abc() {",
"if let Foo(mut test) = foo {",
"if let test = abc() {",
"if let Some(test) = abc()",
"if let Some((a, test, b)) = abc()",
"while let Some(test) = abc() {",
"while let Some(mut test) = abc() {",
"while let Ok(test) = abc() {",
"while let Ok(mut test) = abc() {"
],
"not":[
"while let test(foo) = abc() {"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"rust",
"regex":"struct\\s+[^\\n{]+[{][^}]*(\\s*JJJ\\s*:\\s*[^\\n},]+)[^}]*}",
"tests":[
"struct Foo { abc: u32, test: Vec<String>, b: PathBuf }",
"struct Foo<T>{test:Vec<T>}",
"struct FooBar<'a> { test: Vec<String> }"
],
"not":[
"struct Foo { abc: u32, b: Vec<String> }",
"/// ... construct the equivalent ...\nfn abc() {\n"
]
},
{
"type":"variable",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"rust",
"regex":"enum\\s+[^\\n{]+\\s*[{][^}]*\\bJJJ\\b[^}]*}",
"tests":[
"enum Foo { VariantA, test, VariantB(u32) }",
"enum Foo<T> { test(T) }",
"enum BadStyle{test}",
"enum Foo32 { Bar, testing, test(u8) }"
],
"not":[
"enum Foo { testing }"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"rust",
"regex":"\\bfn\\s+JJJ\\s*\\(",
"tests":[
"fn test(asdf: u32)",
"fn test()",
"pub fn test()"
]
},
{
"type":"function",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"rust",
"regex":"\\bmacro_rules!\\s+JJJ",
"tests":[
"macro_rules! test"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"rust",
"regex":"struct\\s+JJJ\\s*[{\\(]?",
"tests":[
"struct test(u32, u32)",
"struct test;",
"struct test { abc: u32, def: Vec<String> }"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"rust",
"regex":"trait\\s+JJJ\\s*[{]?",
"tests":[
"trait test;",
"trait test { fn abc() -> u32; }"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"rust",
"regex":"\\btype\\s+JJJ([^=\\n]+)?\\s*=[^=\\n]+;",
"tests":[
"type test<T> = Rc<RefCell<T>>;",
"type test = Arc<RwLock<Vec<u32>>>;"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"rust",
"regex":"impl\\s+((\\w+::)*\\w+\\s+for\\s+)?(\\w+::)*JJJ\\s+[{]?",
"tests":[
"impl test {",
"impl abc::test {",
"impl std::io::Read for test {",
"impl std::io::Read for abc::test {"
]
},
{
"type":"type",
"supports":[
"ag",
"grep",
"rg",
"git-grep"
],
"language":"rust",
"regex":"mod\\s+JJJ\\s*[{]?",
"tests":[
"mod test;",
"pub mod test {"
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment