Reorganize repo, add rust CLI and binding code,

This commit is contained in:
Max Brunsfeld 2019-01-04 17:31:49 -08:00
commit 47607cecf4
221 changed files with 11359 additions and 18038 deletions

17
script/bindgen.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash
output_path=src/bindings.rs
header_path='vendor/tree-sitter/include/tree_sitter/runtime.h'
bindgen \
--no-layout-tests \
--whitelist-type '^TS.*' \
--whitelist-function '^ts_.*' \
--opaque-type FILE \
--distrust-clang-mangling \
$header_path > $output_path
echo "" >> $output_path
version_constant='TREE_SITTER_LANGUAGE_VERSION'
version_number=$(egrep "#define $version_constant (.*)" $header_path | cut -d' ' -f3)
echo "pub const $version_constant: usize = $version_number;" >> $output_path

16
script/fetch-test-fixtures.cmd Executable file
View file

@ -0,0 +1,16 @@
@Echo off
SETLOCAL
Set grammar_dir=fixtures\tree-sitter-rust
Set grammar_url=https://github.com/tree-sitter/tree-sitter-rust
@IF NOT EXIST %grammar_dir% (
git clone %grammar_url% %grammar_dir% --depth=1
)
pushd %grammar_dir%
git fetch origin master --depth=1
git reset --hard origin/master
popd
ENDLOCAL

14
script/fetch-test-fixtures.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
grammar_dir='fixtures/tree-sitter-rust'
grammar_url='https://github.com/tree-sitter/tree-sitter-rust'
if [ ! -d $grammar_dir ]; then
git clone $grammar_url $grammar_dir --depth=1
fi
(
cd $grammar_dir;
git fetch origin master --depth=1
git reset --hard origin/master;
)

3
script/test.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
RUST_TREE_SITTER_TEST=1 cargo test $@