as discussed, update the FFI interface to be C-compatible (and simpler)
To test:
I included an example filter in this branch again (temporarily) so you should be able to run cargo build --release --all and then run eg ./target/release/tree-sitter-grep -l rust --filter ./target/release/libtree_sitter_grep_filter_before_line_number.dylib --filter-arg 30 ./reference-parameters.scm and see matches printed that only have line numbers < 30
If you run that without --filter-arg passed then it should fail on expecting to be passed a filter argument
If you run that with eg --filter-arg abc passed then it should fail on expecting to be passed a usize filter argument
If in the example filter you comment out the initialize() function (and the static atomic) and just put a hardcoded line number inside the filterer() callback eg 20 and re-build and re-run the above (without necessarily including the --filter-arg 30) then you should see matches printed that only have line numbers < 20
Running without a --filter argument should still work as expected
If you're feeling bold, try writing a filter plugin in a different language and seeing if it works?
Based on match-predicate (Maybe looking at the diff of this branch vs current master would be preferable since this branch tears out a lot of what was on match-predicate, feel free to change the base branch of this PR)
In this PR:
To test: I included an example filter in this branch again (temporarily) so you should be able to run
cargo build --release --all
and then run eg./target/release/tree-sitter-grep -l rust --filter ./target/release/libtree_sitter_grep_filter_before_line_number.dylib --filter-arg 30 ./reference-parameters.scm
and see matches printed that only have line numbers < 30 If you run that without--filter-arg
passed then it should fail on expecting to be passed a filter argument If you run that with eg--filter-arg abc
passed then it should fail on expecting to be passed a usize filter argument If in the example filter you comment out theinitialize()
function (and the static atomic) and just put a hardcoded line number inside thefilterer()
callback eg20
and re-build and re-run the above (without necessarily including the--filter-arg 30
) then you should see matches printed that only have line numbers < 20 Running without a--filter
argument should still work as expected If you're feeling bold, try writing a filter plugin in a different language and seeing if it works?Based on
match-predicate
(Maybe looking at the diff of this branch vs currentmaster
would be preferable since this branch tears out a lot of what was onmatch-predicate
, feel free to change the base branch of this PR)