#! /usr/bin/env bash
#
# Import and patch up external files.
#
# Not the generic script because ocaml's grammar.js is in the subfolder
# 'ocaml'.
#
set -eu -o pipefail

mkdir -p src

rm -f src/scanner.c
cat ../tree-sitter-ocaml/ocaml/src/scanner.c \
  | sed -e 's:"../../common/scanner.h":"scanner.h":' \
  > src/scanner.c

(
  cd src
  ln -sf ../../tree-sitter-ocaml/common/scanner.h .
)


mkdir -p test/corpus
(
  cd test/corpus
  rm -f inherited
  ln -sf ../../../tree-sitter-ocaml/ocaml/corpus inherited
)
