Fix code generator to ensure the order of the generated values

This commit is contained in:
moznion
2020-11-25 22:28:57 +09:00
parent 30daa6839d
commit c67a8f88dd
3 changed files with 51 additions and 49 deletions
+8 -6
View File
@@ -3,14 +3,16 @@
set -eu
REPO_ROOT="$(cd ./"$(git rev-parse --show-cdup)" || exit; pwd)"
DICTS_DIR="${REPO_ROOT}/dicts"
SRC_DIR="${REPO_ROOT}/src"
DICT_NAMES=(
"rfc2865"
)
DICTS=$(ls "$DICTS_DIR")
for DICT_NAME in "${DICT_NAMES[@]}"; do
cat /dev/null > "${REPO_ROOT}/src/${DICT_NAME}.rs"
cargo run --bin code_gen "${REPO_ROOT}/dicts/dictionary.${DICT_NAME}" "${REPO_ROOT}/src/${DICT_NAME}.rs"
# shellcheck disable=SC2068
for DICT in ${DICTS[@]}; do
DICT_NAME="${DICT##*.}"
cat /dev/null > "${SRC_DIR}/${DICT_NAME}.rs"
cargo run --bin code_gen "${DICTS_DIR}/dictionary.${DICT_NAME}" "${SRC_DIR}/${DICT_NAME}.rs"
done
cargo fmt