Remove invalid characters from grammar names

This commit is contained in:
Phil Turnbull 2019-02-02 22:15:04 +00:00
parent ce040e21e1
commit d102c473e8

View file

@ -53,7 +53,11 @@ for lang in ${languages[@]}; do
modes=(true halt false recover)
for i in 0 2; do
$CXX $CXXFLAGS -std=c++11 -I lib/include -D TS_HALT_ON_ERROR="${modes[i]}" -D TS_LANG="tree_sitter_$lang" \
# FIXME: We should extract the grammar name from grammar.js. Use the name of
# the directory instead. Also, the grammar name needs to be a valid C
# identifier so replace any '-' characters
ts_lang="tree_sitter_$(echo $lang | tr -- - _)"
$CXX $CXXFLAGS -std=c++11 -I lib/include -D TS_HALT_ON_ERROR="${modes[i]}" -D TS_LANG="$ts_lang" \
"test/fuzz/fuzzer.cc" "${objects[@]}" \
libtree-sitter.a "$LIB_FUZZER_PATH" \
-o "out/${lang}_fuzzer_${modes[i+1]}"