diff --git a/lang b/lang index 81e008c..4bd523d 100755 --- a/lang +++ b/lang @@ -1,4 +1,4 @@ -#! /usr/bin/env sh +#! /usr/bin/env bash # Usage: # @@ -47,7 +47,6 @@ else extrem=$dynamic fi shift -parsers=$@ # the names of the parsers # ################################################ # # Clone and Build tree-sitter # @@ -75,13 +74,16 @@ then wget "https://github.com/tree-sitter/tree-sitter/releases/download/v$tstag/$gz" gunzip "$gz" chmod +x "$cli" + cli="../$cli" +else + cli="tree-sitter" fi # ################################################ # # Clone then Build Languages passed in args # # ################################################ # -for lang in "$parsers" +for lang in "$@" do GET=tree-sitter-$lang @@ -98,23 +100,23 @@ do then echo "> $lang: cloning" git clone https://github.com/tree-sitter/$GET - cd $GET - # Checkout the fixed ref. - checkout=$(cat ref | grep "^$lang:" | cut -d ':' -f 2) - if [ -z "$checkout" ] - then - echo "> $lang: using HEAD. Are you sure?" - else - echo "> $lang: checking out $checkout" - git checkout "$checkout" - fi - cd .. fi + # Checkout the fixed ref. + checkout=$(cat $PWD/ref | grep "^$lang:" | cut -d ':' -f 2) + cd $GET + if [ -z "$checkout" ] + then + echo "> $lang: using HEAD. Are you sure?" + else + echo "> $lang: checking out $checkout" + git checkout "$checkout" + fi + cd .. # Regenerate. See https://github.com/tree-sitter/tree-sitter/issues/2731 cd $GET echo "> $lang: regenerating" - ../$cli generate -- + $cli generate -- # clean echo "> $lang: cleaning" cd src @@ -125,7 +127,7 @@ do cd - echo "> $lang: compiling" - ../$cli build --output $OUT + $cli build --output $OUT echo "> $lang: done" done diff --git a/ref b/ref index e5b20a2..62ae3b5 100644 --- a/ref +++ b/ref @@ -2,9 +2,9 @@ bash:7331995b19b8f8aba2d5e26deb51d2195c18bc94 c:212a80f86452bb1316324fa0db730cf52f29e05a embedded-template:203f7bd3c1bbfbd98fc19add4b8fcb213c059205 html:949b78051835564bca937565241e5e337d838502 -java:2b57cd9541f9fd3a89207d054ce8fbe72657c444 -javascript:098bd31b7f838a31cce08db4091e989ea42f3ef6 +java:953abfc8bb3eb2f578e1f461edba4a9885f974b8 +javascript:4928d3d18019a848906855476fde2dc8be030217 json:3fef30de8aee74600f25ec2e319b62a1a870d51e python:82f5c9937fe4300b4bec3ee0e788d642c77aab2c -ruby:7a010836b74351855148818d5cb8170dc4df8e6a -rust:79456e6080f50fc1ca7c21845794308fa5d35a51 +ruby:788a63ca1b7619288980aaafd37d890ee2469421 +rust:9c84af007b0f144954adb26b3f336495cbb320a7