diff --git a/docs/parser.md b/docs/parser.md index 83965a4..56ddf4a 100644 --- a/docs/parser.md +++ b/docs/parser.md @@ -89,6 +89,9 @@ npm run format # Run parser against the given repository scripts/parse_repo.sh elixir-lang/elixir + +# Run parser against a predefined list of popular repositories +scripts/integration_test.sh ``` ## Implementation notes diff --git a/grammar.js b/grammar.js index 0e38673..d644186 100644 --- a/grammar.js +++ b/grammar.js @@ -58,8 +58,6 @@ const ATOM_OPERATOR_LITERALS = ALL_OPS.filter( (operator) => !/[a-z]/.test(operator) && operator !== "=>" ); -// Note that for keywords we use external scanner (KEYWORD_SPECIAL_LITERAL), -// so it should be kept in sync const ATOM_SPECIAL_LITERALS = ["...", "%{}", "{}", "%", "<<>>", "..//"]; // See Ref 6. in the docs diff --git a/scripts/integration_test.sh b/scripts/integration_test.sh new file mode 100755 index 0000000..93d1cc5 --- /dev/null +++ b/scripts/integration_test.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -e + +cd "$(dirname "$0")/.." + +print_usage_and_exit() { + echo "Usage: $0" + echo "" + echo "Runs the parser against a predefined list of popular Elixir repositories" + echo "" + exit 1 +} + +if [ $# -ne 0 ]; then + print_usage_and_exit +fi + +repos="elixir-lang/elixir elixir-lang/ex_doc elixir-plug/plug elixir-ecto/ecto dashbitco/broadway elixir-nx/nx elixir-nx/axon livebook-dev/livebook" + +for repo in $repos; do + ./scripts/parse_repo.sh $repo +done diff --git a/scripts/parse_repo.sh b/scripts/parse_repo.sh index 6208b58..44e883b 100755 --- a/scripts/parse_repo.sh +++ b/scripts/parse_repo.sh @@ -26,7 +26,7 @@ dir="tmp/gh/${gh_repo//[\/-]/_}" if [[ ! -d "$dir" ]]; then mkdir -p "$(dirname "$dir")" - git clone "https://github.com/$gh_repo.git" "$dir" + git clone --depth 1 "https://github.com/$gh_repo.git" "$dir" fi echo "Running parser against $gh_repo"