35 lines
990 B
Bash
Executable file
35 lines
990 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
GRAMMARS_DIR=$(dirname $0)/../test/fixtures/grammars
|
|
|
|
fetch_grammar() {
|
|
local grammar=$1
|
|
local ref=$2
|
|
local grammar_dir=${GRAMMARS_DIR}/${grammar}
|
|
local grammar_url=https://github.com/tree-sitter/tree-sitter-${grammar}
|
|
|
|
echo "Updating ${grammar} grammar..."
|
|
|
|
if [ ! -d $grammar_dir ]; then
|
|
git clone $grammar_url $grammar_dir --depth=1
|
|
fi
|
|
|
|
(
|
|
cd $grammar_dir
|
|
git fetch origin $ref --depth=1
|
|
git reset --hard FETCH_HEAD
|
|
)
|
|
}
|
|
|
|
fetch_grammar bash master
|
|
fetch_grammar c master
|
|
fetch_grammar cpp master
|
|
fetch_grammar embedded-template highlight-queries
|
|
fetch_grammar go master
|
|
fetch_grammar html highlight-queries
|
|
fetch_grammar javascript highlight-queries
|
|
fetch_grammar json master
|
|
fetch_grammar python master
|
|
fetch_grammar ruby master
|
|
fetch_grammar rust highlight-queries
|
|
fetch_grammar typescript master
|