diff --git a/src/tree-sitter.c b/src/tree-sitter.c index e47d17bc..8dcbf189 100644 --- a/src/tree-sitter.c +++ b/src/tree-sitter.c @@ -271,7 +271,7 @@ bool check_predicates(const struct query_match_t *qm) { op = NOT_MATCH; } else if (!strcasecmp("any-match?", ops)) { op = ANY_MATCH; - } else if (!strcasecmp("any-not-match", ops)) { + } else if (!strcasecmp("any-not-match?", ops)) { op = ANY_NOT_MATCH; } else if (!strcasecmp("any-of?", ops)) { op = ANY_OF; diff --git a/tests/testthat/_snaps/tree-sitter.md b/tests/testthat/_snaps/tree-sitter.md index 30892d7b..cc7e7331 100644 --- a/tests/testthat/_snaps/tree-sitter.md +++ b/tests/testthat/_snaps/tree-sitter.md @@ -74,6 +74,65 @@ 2 2 2 2 2 1 2 args (arg, arg2) +# pattern names + + Code + code_query("f('x')", c("(call) (call)", "(call)"))[["patterns"]] + Output + # A data frame: 3 x 4 + id name pattern match_count + + 1 1 "(call) " 1 + 2 2 "(call)\n" 1 + 3 3 "(call)\n" 1 + Code + code_query("f('x')", c(a = "(call) (call)", "(call)"))[["patterns"]] + Output + # A data frame: 3 x 4 + id name pattern match_count + + 1 1 "a" "(call) " 1 + 2 2 "a" "(call)\n" 1 + 3 3 "" "(call)\n" 1 + Code + code_query("f('x')", c("(call) (call)", b = "(call)"))[["patterns"]] + Output + # A data frame: 3 x 4 + id name pattern match_count + + 1 1 "" "(call) " 1 + 2 2 "" "(call)\n" 1 + 3 3 "b" "(call)\n" 1 + Code + code_query("f('x')", c(a = "(call) (call)", b = "(call)"))[["patterns"]] + Output + # A data frame: 3 x 4 + id name pattern match_count + + 1 1 a "(call) " 1 + 2 2 a "(call)\n" 1 + 3 3 b "(call)\n" 1 + +# syntax error is handled + + Code + code_query("f(1); g(1,2); 1+; h(3)", "(call) @call-code") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(call) @call-code\n" 3 + + $matched_captures + # A data frame: 3 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 call-code f(1) + 2 1 1 2 7 1 7 call-code g(1,2) + 3 1 1 3 19 1 19 call-code h(3) + + # code_query, field names Code @@ -331,118 +390,3115 @@ 3 1 1 3 24 1 24 arg x = 1 -# code_query, predicates, eq capture(1) x capture(1) +# code_query, predicates, #eq? Code - code_query("f(x); f(y); g()", paste0( - "((call function: (identifier) @fun-name) ", - "(call function: (identifier) @fun-name2) ", "(#eq? @fun-name @fun-name2))")) + do("", "", c("f()", "# c", "f()")) Output $patterns # A data frame: 1 x 4 id name pattern match_count - 1 1 "((call function: (identifier) @fun-name) (call funct~ 1 + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 $matched_captures # A data frame: 2 x 8 - id pattern match start_byte start_row start_column name code - - 1 1 1 1 1 1 1 fun-name f - 2 2 1 1 7 1 7 fun-name2 f + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 f - -# code_query, predicates, eq capture(1) x capture(0) - Code - NULL + do("", "", c("f()", "# c", "g()")) Output - NULL - -# code_query, predicates, eq capture(1) x capture(n) - + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + Code - NULL + do("*", "*", c("f()", "# c", "f()")) Output - NULL - -# code_query, predicates, eq capture(0) x capture(1) - + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 f + Code - NULL + do("*", "*", c("f()", "# c", "g()")) Output - NULL - -# code_query, predicates, eq capture(n) x capture(1) - + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + Code - NULL + do("*", "*", c("f()", "f(1)", "f(2)", "# c", "f()", "f(5)")) Output - NULL - -# code_query, predicates, eq capture(n) x capture(n) - + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 5 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 1 1 1 5 2 1 fn-1 f + 3 1 1 1 10 3 1 fn-1 f + 4 2 1 1 19 5 1 fn-2 f + 5 2 1 1 23 6 1 fn-2 f + Code - NULL + do("*", "*", c("f()", "f(1)", "f(2)", "# c", "f()", "g(5)")) Output - NULL - -# pattern names - + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + Code - code_query("f('x')", c("(call) (call)", "(call)"))[["patterns"]] + do("*", "*", c("f()", "# c")) Output - # A data frame: 3 x 4 - id name pattern match_count - - 1 1 "(call) " 1 - 2 2 "(call)\n" 1 - 3 3 "(call)\n" 1 + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + Code - code_query("f('x')", c(a = "(call) (call)", "(call)"))[["patterns"]] + do("*", "*", c("# c", "f()")) Output - # A data frame: 3 x 4 - id name pattern match_count - - 1 1 "a" "(call) " 1 - 2 2 "a" "(call)\n" 1 - 3 3 "" "(call)\n" 1 + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 2 1 1 5 2 1 fn-2 f + Code - code_query("f('x')", c("(call) (call)", b = "(call)"))[["patterns"]] + do("+", "+", c("f()", "# c", "f()")) Output - # A data frame: 3 x 4 - id name pattern match_count - - 1 1 "" "(call) " 1 - 2 2 "" "(call)\n" 1 - 3 3 "b" "(call)\n" 1 + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 f + Code - code_query("f('x')", c(a = "(call) (call)", b = "(call)"))[["patterns"]] + do("+", "+", c("f()", "# c", "g()")) Output - # A data frame: 3 x 4 - id name pattern match_count - - 1 1 a "(call) " 1 - 2 2 a "(call)\n" 1 - 3 3 b "(call)\n" 1 - -# syntax error is handled - + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + Code - code_query("f(1); g(1,2); 1+; h(3)", "(call) @call-code") + do("+", "+", c("f()", "f(1)", "f(2)", "# c", "f()", "f(5)")) Output $patterns # A data frame: 1 x 4 - id name pattern match_count - - 1 1 "(call) @call-code\n" 3 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 $matched_captures - # A data frame: 3 x 8 - id pattern match start_byte start_row start_column name code - - 1 1 1 1 1 1 1 call-code f(1) - 2 1 1 2 7 1 7 call-code g(1,2) - 3 1 1 3 19 1 19 call-code h(3) + # A data frame: 5 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 1 1 1 5 2 1 fn-1 f + 3 1 1 1 10 3 1 fn-1 f + 4 2 1 1 19 5 1 fn-2 f + 5 2 1 1 23 6 1 fn-2 f + + Code + do("+", "+", c("f()", "f(1)", "f(2)", "# c", "f()", "g(5)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "+", c("f()", "# c")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "+", c("# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", "?", c("f()", "# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 f + + Code + do("?", "?", c("f()", "# c", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", "?", c("f()", "f(1)", "f(2)", "# c", "f(5)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 3 + + $matched_captures + # A data frame: 6 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 19 5 1 fn-2 f + 3 1 1 2 5 2 1 fn-1 f + 4 2 1 2 19 5 1 fn-2 f + 5 1 1 3 10 3 1 fn-1 f + 6 2 1 3 19 5 1 fn-2 f + + Code + do("?", "?", c("f()", "# c", "f(5)", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 2 + + $matched_captures + # A data frame: 4 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 f + 3 1 1 2 1 1 1 fn-1 f + 4 2 1 2 14 4 1 fn-2 f + + Code + do("?", "?", c("f()", "# c")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + + Code + do("?", "?", c("# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 2 1 1 5 2 1 fn-2 f + + +# code_query, predicates, #not-eq? + + Code + do("", "", c("f()", "# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("", "", c("f()", "# c", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 g + + Code + do("*", "*", c("f()", "# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", "*", c("f()", "# c", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 g + + Code + do("*", "*", c("f()", "f(1)", "f(2)", "# c", "f()", "f(5)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", "*", c("f()", "f(1)", "f(2)", "# c", "h()", "g(5)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 5 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 1 1 1 5 2 1 fn-1 f + 3 1 1 1 10 3 1 fn-1 f + 4 2 1 1 19 5 1 fn-2 h + 5 2 1 1 23 6 1 fn-2 g + + Code + do("*", "*", c("f()", "# c")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + + Code + do("*", "*", c("# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 2 1 1 5 2 1 fn-2 f + + Code + do("+", "+", c("f()", "# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "+", c("f()", "# c", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 g + + Code + do("+", "+", c("f()", "f(1)", "f(2)", "# c", "f()", "f(5)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "+", c("f()", "f(1)", "f(2)", "# c", "h()", "g(5)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 5 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 1 1 1 5 2 1 fn-1 f + 3 1 1 1 10 3 1 fn-1 f + 4 2 1 1 19 5 1 fn-2 h + 5 2 1 1 23 6 1 fn-2 g + + Code + do("+", "+", c("f()", "# c")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "+", c("# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", "?", c("f()", "# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", "?", c("f()", "# c", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 g + + Code + do("?", "?", c("f()", "f(1)", "f(2)", "# c", "g(5)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 3 + + $matched_captures + # A data frame: 6 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 19 5 1 fn-2 g + 3 1 1 2 5 2 1 fn-1 f + 4 2 1 2 19 5 1 fn-2 g + 5 1 1 3 10 3 1 fn-1 f + 6 2 1 3 19 5 1 fn-2 g + + Code + do("?", "?", c("f()", "# c", "g(5)", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 2 + + $matched_captures + # A data frame: 4 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 g + 3 1 1 2 1 1 1 fn-1 f + 4 2 1 2 14 4 1 fn-2 g + + Code + do("?", "?", c("f()", "# c")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + + Code + do("?", "?", c("# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 2 1 1 5 2 1 fn-2 f + + +# code_query, predicates, #any-eq? + + Code + do("", "", c("f()", "# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 f + + Code + do("", "", c("f()", "# c", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", "*", c("f()", "# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 f + + Code + do("*", "*", c("f()", "# c", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", "*", c("f()", "f(1)", "f(2)", "# c", "f()", "f(5)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 5 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 1 1 1 5 2 1 fn-1 f + 3 1 1 1 10 3 1 fn-1 f + 4 2 1 1 19 5 1 fn-2 f + 5 2 1 1 23 6 1 fn-2 f + + Code + do("*", "*", c("f()", "f(1)", "f(2)", "# c", "g()", "g(5)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", "*", c("f()", "# c")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", "*", c("# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "+", c("f()", "# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 f + + Code + do("+", "+", c("f()", "# c", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "+", c("f()", "f(1)", "g(2)", "# c", "f()", "f(5)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 5 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 1 1 1 5 2 1 fn-1 f + 3 1 1 1 10 3 1 fn-1 g + 4 2 1 1 19 5 1 fn-2 f + 5 2 1 1 23 6 1 fn-2 f + + Code + do("+", "+", c("f()", "f(1)", "f(2)", "# c", "g()", "g(5)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "+", c("f()", "# c")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "+", c("# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", "?", c("f()", "# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 f + + Code + do("?", "?", c("f()", "# c", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", "?", c("f()", "f(1)", "g(2)", "# c", "f(5)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 2 + + $matched_captures + # A data frame: 4 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 19 5 1 fn-2 f + 3 1 1 2 5 2 1 fn-1 f + 4 2 1 2 19 5 1 fn-2 f + + Code + do("?", "?", c("g()", "# c", "f(5)", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", "?", c("f()", "# c")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", "?", c("# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + +# code_query, predicates, #any-not-eq? + + Code + do("", "", c("f()", "# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("", "", c("f()", "# c", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 g + + Code + do("*", "*", c("f()", "# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", "*", c("f()", "# c", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 g + + Code + do("*", "*", c("f()", "f(1)", "f(2)", "# c", "f()", "f(5)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", "*", c("f()", "f(1)", "f(2)", "# c", "g()", "g(5)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 5 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 1 1 1 5 2 1 fn-1 f + 3 1 1 1 10 3 1 fn-1 f + 4 2 1 1 19 5 1 fn-2 g + 5 2 1 1 23 6 1 fn-2 g + + Code + do("*", "*", c("f()", "# c")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", "*", c("# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "+", c("f()", "# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "+", c("f()", "# c", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 g + + Code + do("+", "+", c("f()", "f(1)", "g(2)", "# c", "f()", "f(5)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 5 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 1 1 1 5 2 1 fn-1 f + 3 1 1 1 10 3 1 fn-1 g + 4 2 1 1 19 5 1 fn-2 f + 5 2 1 1 23 6 1 fn-2 f + + Code + do("+", "+", c("f()", "f(1)", "f(2)", "# c", "g()", "g(5)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 5 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 1 1 1 5 2 1 fn-1 f + 3 1 1 1 10 3 1 fn-1 f + 4 2 1 1 19 5 1 fn-2 g + 5 2 1 1 23 6 1 fn-2 g + + Code + do("+", "+", c("f()", "# c")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "+", c("# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", "?", c("f()", "# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", "?", c("f()", "# c", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 f + 2 2 1 1 9 3 1 fn-2 g + + Code + do("?", "?", c("f()", "f(1)", "g(2)", "# c", "f(5)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 10 3 1 fn-1 g + 2 2 1 1 19 5 1 fn-2 f + + Code + do("?", "?", c("g()", "# c", "f(5)", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 2 + + $matched_captures + # A data frame: 4 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn-1 g + 2 2 1 1 9 3 1 fn-2 f + 3 1 1 2 1 1 1 fn-1 g + 4 2 1 2 14 4 1 fn-2 f + + Code + do("?", "?", c("f()", "# c")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", "?", c("# c", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program\n (call function: (identifier) @fn-1) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + +# code_query, predicates, #eq? vs string + + Code + do("", "f()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + + Code + do("", "g()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn f + + Code + do("*", c("f()", "g()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn f + + Code + do("+", c("f()", "g(1)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + + Code + do("?", c("f()", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + + +# code_query, predicates, #not-eq? vs string + + Code + do("", "f()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("", "g()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + + Code + do("*", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", c("g()", "h()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + 2 1 1 1 5 2 1 fn h + + Code + do("*", c("f()", "g()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", c("g()", "h()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + 2 1 1 1 5 2 1 fn h + + Code + do("+", c("f()", "g(1)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", c("g()", "h()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + + Code + do("?", c("f()", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + +# code_query, predicates, #any-eq? vs string + + Code + do("", "f()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + + Code + do("", "g()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn f + + Code + do("*", c("f()", "g()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 3 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn g + 3 1 1 1 9 3 1 fn f + + Code + do("+", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn f + + Code + do("+", c("f()", "g(1)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn g + + Code + do("?", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + + Code + do("?", c("f()", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + + +# code_query, predicates, #any-not-eq? vs string + + Code + do("", "f()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("", "g()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + + Code + do("*", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", c("g()", "h()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + 2 1 1 1 5 2 1 fn h + + Code + do("*", c("f()", "g()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 3 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn g + 3 1 1 1 9 3 1 fn f + + Code + do("+", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", c("g()", "h()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + 2 1 1 1 5 2 1 fn h + + Code + do("+", c("f()", "g(1)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn g + + Code + do("?", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", c("g()", "h()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + + Code + do("?", c("f()", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + +# code_query, predicates, #match? + + Code + do("", "f()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + + Code + do("", "g()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn f + + Code + do("*", c("f()", "g()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn f + + Code + do("+", c("f()", "g(1)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + + Code + do("?", c("f()", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + + +# code_query, predicates, #not-match? + + Code + do("", "f()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("", "g()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + + Code + do("*", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", c("g()", "h()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + 2 1 1 1 5 2 1 fn h + + Code + do("*", c("f()", "g()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", c("g()", "h()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + 2 1 1 1 5 2 1 fn h + + Code + do("+", c("f()", "g(1)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", c("g()", "h()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + + Code + do("?", c("f()", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + +# code_query, predicates, #any-match? + + Code + do("", "f()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + + Code + do("", "g()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn f + + Code + do("*", c("f()", "g()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 3 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn g + 3 1 1 1 9 3 1 fn f + + Code + do("+", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn f + + Code + do("+", c("f()", "g(1)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn g + + Code + do("?", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + + Code + do("?", c("f()", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + + +# code_query, predicates, #any-not-match? + + Code + do("", "f()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("", "g()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + + Code + do("*", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", c("g()", "h()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + 2 1 1 1 5 2 1 fn h + + Code + do("*", c("f()", "g()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 3 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn g + 3 1 1 1 9 3 1 fn f + + Code + do("+", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", c("g()", "h()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + 2 1 1 1 5 2 1 fn h + + Code + do("+", c("f()", "g(1)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn g + + Code + do("?", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", c("f()", "f()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", c("g()", "h()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + + Code + do("?", c("f()", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + +# code_query, predicates, #any-of? + + Code + do("", "f()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + + Code + do("", "g()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", c("f()", "f2()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn f2 + + Code + do("*", c("f()", "g()", "f2()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", c("f()", "f2()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + 2 1 1 1 5 2 1 fn f2 + + Code + do("+", c("f()", "g(1)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", c("f()", "f2()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + + Code + do("?", c("f()", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn f + + +# code_query, predicates, #not-any-of? + + Code + do("", "f()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("", "g()") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + + Code + do("*", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", c("f()", "f2()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("*", c("g()", "h()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + 2 1 1 1 5 2 1 fn h + + Code + do("*", c("f()", "g()", "f2()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", c("f()", "f2()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("+", c("g()", "h()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 2 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + 2 1 1 1 5 2 1 fn h + + Code + do("+", c("f()", "g(1)")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", "") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", c("f()", "f2()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code + + Code + do("?", c("g()", "h()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 1 + + $matched_captures + # A data frame: 1 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 fn g + + Code + do("?", c("f()", "g()")) + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(program .\n (call function: (identifier) @fn) ~ 0 + + $matched_captures + # A data frame: 0 x 8 + # i 8 variables: id , pattern , match , start_byte , + # start_row , start_column , name , code diff --git a/tests/testthat/test-tree-sitter.R b/tests/testthat/test-tree-sitter.R index b6979660..b0c3e303 100644 --- a/tests/testthat/test-tree-sitter.R +++ b/tests/testthat/test-tree-sitter.R @@ -24,6 +24,20 @@ test_that("code_query, multiple patterns", { }) }) +test_that("pattern names", { + expect_snapshot({ + code_query("f('x')", c("(call) (call)", "(call)"))[["patterns"]] + code_query("f('x')", c(a = "(call) (call)", "(call)"))[["patterns"]] + code_query("f('x')", c("(call) (call)", b = "(call)"))[["patterns"]] + code_query("f('x')", c(a = "(call) (call)", b = "(call)"))[["patterns"]] + }) +}) + +test_that("syntax error is handled", { + expect_snapshot({ + code_query("f(1); g(1,2); 1+; h(3)", "(call) @call-code") + }) +}) test_that("code_query, field names", { expect_snapshot({ code_query( @@ -134,66 +148,481 @@ test_that("code_query, anchors", { }) }) -test_that("code_query, predicates, eq capture(1) x capture(1)", { +test_that("code_query, predicates, #eq?", { + # multiple calls to the same function, from before and after comment + q <- " + (program + (call function: (identifier) @fn-1) %s + (comment) + (call function: (identifier) @fn-2) %s + (#eq? @fn-1 @fn-2) + )" + do <- function(q1, q2, code) { + q_ <- sprintf(q, q1, q2) + code_query(code, q_) + } expect_snapshot({ - # repeated function call - code_query( - "f(x); f(y); g()", - paste0( - "((call function: (identifier) @fun-name) ", - "(call function: (identifier) @fun-name2) ", - "(#eq? @fun-name @fun-name2))" - ) - ) + # no auantification + do("", "", c("f()", "# c", "f()")) + do("", "", c("f()", "# c", "g()")) + # * + do("*", "*", c("f()", "# c", "f()")) + do("*", "*", c("f()", "# c", "g()")) + do("*", "*", c("f()", "f(1)", "f(2)", "# c", "f()", "f(5)")) + do("*", "*", c("f()", "f(1)", "f(2)", "# c", "f()", "g(5)")) + do("*", "*", c("f()", "# c")) + do("*", "*", c("# c", "f()")) + # + + do("+", "+", c("f()", "# c", "f()")) + do("+", "+", c("f()", "# c", "g()")) + do("+", "+", c("f()", "f(1)", "f(2)", "# c", "f()", "f(5)")) + do("+", "+", c("f()", "f(1)", "f(2)", "# c", "f()", "g(5)")) + do("+", "+", c("f()", "# c")) + do("+", "+", c("# c", "f()")) + # ? + do("?", "?", c("f()", "# c", "f()")) + do("?", "?", c("f()", "# c", "g()")) + do("?", "?", c("f()", "f(1)", "f(2)", "# c", "f(5)")) + do("?", "?", c("f()", "# c", "f(5)", "f()")) + do("?", "?", c("f()", "# c")) + do("?", "?", c("# c", "f()")) }) }) -test_that("code_query, predicates, eq capture(1) x capture(0)", { +test_that("code_query, predicates, #not-eq?", { + # multiple calls to the same function, from before and after comment + q <- " + (program + (call function: (identifier) @fn-1) %s + (comment) + (call function: (identifier) @fn-2) %s + (#not-eq? @fn-1 @fn-2) + )" + do <- function(q1, q2, code) { + q_ <- sprintf(q, q1, q2) + code_query(code, q_) + } expect_snapshot({ - # TODO - NULL + # no auantification + do("", "", c("f()", "# c", "f()")) + do("", "", c("f()", "# c", "g()")) + # * + do("*", "*", c("f()", "# c", "f()")) + do("*", "*", c("f()", "# c", "g()")) + do("*", "*", c("f()", "f(1)", "f(2)", "# c", "f()", "f(5)")) + do("*", "*", c("f()", "f(1)", "f(2)", "# c", "h()", "g(5)")) + do("*", "*", c("f()", "# c")) + do("*", "*", c("# c", "f()")) + # + + do("+", "+", c("f()", "# c", "f()")) + do("+", "+", c("f()", "# c", "g()")) + do("+", "+", c("f()", "f(1)", "f(2)", "# c", "f()", "f(5)")) + do("+", "+", c("f()", "f(1)", "f(2)", "# c", "h()", "g(5)")) + do("+", "+", c("f()", "# c")) + do("+", "+", c("# c", "f()")) + # ? + do("?", "?", c("f()", "# c", "f()")) + do("?", "?", c("f()", "# c", "g()")) + do("?", "?", c("f()", "f(1)", "f(2)", "# c", "g(5)")) + do("?", "?", c("f()", "# c", "g(5)", "g()")) + do("?", "?", c("f()", "# c")) + do("?", "?", c("# c", "f()")) }) }) -test_that("code_query, predicates, eq capture(1) x capture(n)", { +test_that("code_query, predicates, #any-eq?", { + # multiple calls to the same function, from before and after comment + q <- " + (program + (call function: (identifier) @fn-1) %s + (comment) + (call function: (identifier) @fn-2) %s + (#any-eq? @fn-1 @fn-2) + )" + do <- function(q1, q2, code) { + q_ <- sprintf(q, q1, q2) + code_query(code, q_) + } expect_snapshot({ - # TODO - NULL + # no auantification + do("", "", c("f()", "# c", "f()")) + do("", "", c("f()", "# c", "g()")) + # * + do("*", "*", c("f()", "# c", "f()")) + do("*", "*", c("f()", "# c", "g()")) + do("*", "*", c("f()", "f(1)", "f(2)", "# c", "f()", "f(5)")) + do("*", "*", c("f()", "f(1)", "f(2)", "# c", "g()", "g(5)")) + do("*", "*", c("f()", "# c")) + do("*", "*", c("# c", "f()")) + # + + do("+", "+", c("f()", "# c", "f()")) + do("+", "+", c("f()", "# c", "g()")) + do("+", "+", c("f()", "f(1)", "g(2)", "# c", "f()", "f(5)")) + do("+", "+", c("f()", "f(1)", "f(2)", "# c", "g()", "g(5)")) + do("+", "+", c("f()", "# c")) + do("+", "+", c("# c", "f()")) + # ? + do("?", "?", c("f()", "# c", "f()")) + do("?", "?", c("f()", "# c", "g()")) + do("?", "?", c("f()", "f(1)", "g(2)", "# c", "f(5)")) + do("?", "?", c("g()", "# c", "f(5)", "f()")) + do("?", "?", c("f()", "# c")) + do("?", "?", c("# c", "f()")) }) }) -test_that("code_query, predicates, eq capture(0) x capture(1)", { +test_that("code_query, predicates, #any-not-eq?", { + # multiple calls to the same function, from before and after comment + q <- " + (program + (call function: (identifier) @fn-1) %s + (comment) + (call function: (identifier) @fn-2) %s + (#any-not-eq? @fn-1 @fn-2) + )" + do <- function(q1, q2, code) { + q_ <- sprintf(q, q1, q2) + code_query(code, q_) + } expect_snapshot({ - # TODO - NULL + # no auantification + do("", "", c("f()", "# c", "f()")) + do("", "", c("f()", "# c", "g()")) + # * + do("*", "*", c("f()", "# c", "f()")) + do("*", "*", c("f()", "# c", "g()")) + do("*", "*", c("f()", "f(1)", "f(2)", "# c", "f()", "f(5)")) + do("*", "*", c("f()", "f(1)", "f(2)", "# c", "g()", "g(5)")) + do("*", "*", c("f()", "# c")) + do("*", "*", c("# c", "f()")) + # + + do("+", "+", c("f()", "# c", "f()")) + do("+", "+", c("f()", "# c", "g()")) + do("+", "+", c("f()", "f(1)", "g(2)", "# c", "f()", "f(5)")) + do("+", "+", c("f()", "f(1)", "f(2)", "# c", "g()", "g(5)")) + do("+", "+", c("f()", "# c")) + do("+", "+", c("# c", "f()")) + # ? + do("?", "?", c("f()", "# c", "f()")) + do("?", "?", c("f()", "# c", "g()")) + do("?", "?", c("f()", "f(1)", "g(2)", "# c", "f(5)")) + do("?", "?", c("g()", "# c", "f(5)", "f()")) + do("?", "?", c("f()", "# c")) + do("?", "?", c("# c", "f()")) }) }) -test_that("code_query, predicates, eq capture(n) x capture(1)", { +test_that("code_query, predicates, #eq? vs string", { + # multiple calls to the same function, from before and after comment + q <- " + (program . + (call function: (identifier) @fn) %s + (#eq? @fn \"f\") + . )" + do <- function(q1, code) { + q_ <- sprintf(q, q1) + code_query(code, q_) + } expect_snapshot({ - # TODO - NULL + # no auantification + do("", "f()") + do("", "g()") + # * + do("*", "") + do("*", c("f()", "f()")) + do("*", c("f()", "g()", "f()")) + # + + do("+", "") + do("+", c("f()", "f()")) + do("+", c("f()", "g(1)")) + # ? + do("?", "") + do("?", c("f()", "f()")) + do("?", c("f()", "g()")) }) }) -test_that("code_query, predicates, eq capture(n) x capture(n)", { +test_that("code_query, predicates, #not-eq? vs string", { + # multiple calls to the same function, from before and after comment + q <- " + (program . + (call function: (identifier) @fn) %s + (#not-eq? @fn \"f\") + . )" + do <- function(q1, code) { + q_ <- sprintf(q, q1) + code_query(code, q_) + } expect_snapshot({ - # TODO - NULL + # no auantification + do("", "f()") + do("", "g()") + # * + do("*", "") + do("*", c("f()", "f()")) + do("*", c("g()", "h()")) + do("*", c("f()", "g()", "f()")) + # + + do("+", "") + do("+", c("f()", "f()")) + do("+", c("g()", "h()")) + do("+", c("f()", "g(1)")) + # ? + do("?", "") + do("?", c("f()", "f()")) + do("?", c("g()", "h()")) + do("?", c("f()", "g()")) }) }) -test_that("pattern names", { +test_that("code_query, predicates, #any-eq? vs string", { + # multiple calls to the same function, from before and after comment + q <- " + (program . + (call function: (identifier) @fn) %s + (#any-eq? @fn \"f\") + . )" + do <- function(q1, code) { + q_ <- sprintf(q, q1) + code_query(code, q_) + } expect_snapshot({ - code_query("f('x')", c("(call) (call)", "(call)"))[["patterns"]] - code_query("f('x')", c(a = "(call) (call)", "(call)"))[["patterns"]] - code_query("f('x')", c("(call) (call)", b = "(call)"))[["patterns"]] - code_query("f('x')", c(a = "(call) (call)", b = "(call)"))[["patterns"]] + # no auantification + do("", "f()") + do("", "g()") + # * + do("*", "") + do("*", c("f()", "f()")) + do("*", c("f()", "g()", "f()")) + # + + do("+", "") + do("+", c("f()", "f()")) + do("+", c("f()", "g(1)")) + # ? + do("?", "") + do("?", c("f()", "f()")) + do("?", c("f()", "g()")) }) }) -test_that("syntax error is handled", { +test_that("code_query, predicates, #any-not-eq? vs string", { + # multiple calls to the same function, from before and after comment + q <- " + (program . + (call function: (identifier) @fn) %s + (#any-not-eq? @fn \"f\") + . )" + do <- function(q1, code) { + q_ <- sprintf(q, q1) + code_query(code, q_) + } expect_snapshot({ - code_query("f(1); g(1,2); 1+; h(3)", "(call) @call-code") + # no auantification + do("", "f()") + do("", "g()") + # * + do("*", "") + do("*", c("f()", "f()")) + do("*", c("g()", "h()")) + do("*", c("f()", "g()", "f()")) + # + + do("+", "") + do("+", c("f()", "f()")) + do("+", c("g()", "h()")) + do("+", c("f()", "g(1)")) + # ? + do("?", "") + do("?", c("f()", "f()")) + do("?", c("g()", "h()")) + do("?", c("f()", "g()")) }) -}) \ No newline at end of file +}) + +test_that("code_query, predicates, #match?", { + # multiple calls to the same function, from before and after comment + q <- " + (program . + (call function: (identifier) @fn) %s + (#match? @fn \"^f\") + . )" + do <- function(q1, code) { + q_ <- sprintf(q, q1) + code_query(code, q_) + } + expect_snapshot({ + # no auantification + do("", "f()") + do("", "g()") + # * + do("*", "") + do("*", c("f()", "f()")) + do("*", c("f()", "g()", "f()")) + # + + do("+", "") + do("+", c("f()", "f()")) + do("+", c("f()", "g(1)")) + # ? + do("?", "") + do("?", c("f()", "f()")) + do("?", c("f()", "g()")) + }) +}) + +test_that("code_query, predicates, #not-match?", { + # multiple calls to the same function, from before and after comment + q <- " + (program . + (call function: (identifier) @fn) %s + (#not-match? @fn \"^f\") + . )" + do <- function(q1, code) { + q_ <- sprintf(q, q1) + code_query(code, q_) + } + expect_snapshot({ + # no auantification + do("", "f()") + do("", "g()") + # * + do("*", "") + do("*", c("f()", "f()")) + do("*", c("g()", "h()")) + do("*", c("f()", "g()", "f()")) + # + + do("+", "") + do("+", c("f()", "f()")) + do("+", c("g()", "h()")) + do("+", c("f()", "g(1)")) + # ? + do("?", "") + do("?", c("f()", "f()")) + do("?", c("g()", "h()")) + do("?", c("f()", "g()")) + }) +}) + +test_that("code_query, predicates, #any-match?", { + # multiple calls to the same function, from before and after comment + q <- " + (program . + (call function: (identifier) @fn) %s + (#any-match? @fn \"^f\") + . )" + do <- function(q1, code) { + q_ <- sprintf(q, q1) + code_query(code, q_) + } + expect_snapshot({ + # no auantification + do("", "f()") + do("", "g()") + # * + do("*", "") + do("*", c("f()", "f()")) + do("*", c("f()", "g()", "f()")) + # + + do("+", "") + do("+", c("f()", "f()")) + do("+", c("f()", "g(1)")) + # ? + do("?", "") + do("?", c("f()", "f()")) + do("?", c("f()", "g()")) + }) +}) + +test_that("code_query, predicates, #any-not-match?", { + # multiple calls to the same function, from before and after comment + q <- " + (program . + (call function: (identifier) @fn) %s + (#any-not-match? @fn \"^f\") + . )" + do <- function(q1, code) { + q_ <- sprintf(q, q1) + code_query(code, q_) + } + expect_snapshot({ + # no auantification + do("", "f()") + do("", "g()") + # * + do("*", "") + do("*", c("f()", "f()")) + do("*", c("g()", "h()")) + do("*", c("f()", "g()", "f()")) + # + + do("+", "") + do("+", c("f()", "f()")) + do("+", c("g()", "h()")) + do("+", c("f()", "g(1)")) + # ? + do("?", "") + do("?", c("f()", "f()")) + do("?", c("g()", "h()")) + do("?", c("f()", "g()")) + }) +}) + +test_that("code_query, predicates, #any-of?", { + # multiple calls to the same function, from before and after comment + q <- " + (program . + (call function: (identifier) @fn) %s + (#any-of? @fn \"f\" \"f2\") + . )" + do <- function(q1, code) { + q_ <- sprintf(q, q1) + code_query(code, q_) + } + expect_snapshot({ + # no auantification + do("", "f()") + do("", "g()") + # * + do("*", "") + do("*", c("f()", "f2()")) + do("*", c("f()", "g()", "f2()")) + # + + do("+", "") + do("+", c("f()", "f2()")) + do("+", c("f()", "g(1)")) + # ? + do("?", "") + do("?", c("f()", "f2()")) + do("?", c("f()", "g()")) + }) +}) + +test_that("code_query, predicates, #not-any-of?", { + # multiple calls to the same function, from before and after comment + q <- " + (program . + (call function: (identifier) @fn) %s + (#not-any-of? @fn \"f\" \"f2\") + . )" + do <- function(q1, code) { + q_ <- sprintf(q, q1) + code_query(code, q_) + } + expect_snapshot({ + # no auantification + do("", "f()") + do("", "g()") + # * + do("*", "") + do("*", c("f()", "f2()")) + do("*", c("g()", "h()")) + do("*", c("f()", "g()", "f2()")) + # + + do("+", "") + do("+", c("f()", "f2()")) + do("+", c("g()", "h()")) + do("+", c("f()", "g(1)")) + # ? + do("?", "") + do("?", c("f()", "f2()")) + do("?", c("g()", "h()")) + do("?", c("f()", "g()")) + }) +})