Skip to content

Commit e846449

Browse files
committed
Add script for testing the parser against popular repositories
1 parent 01d428d commit e846449

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

docs/parser.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ npm run format
8989
9090
# Run parser against the given repository
9191
scripts/parse_repo.sh elixir-lang/elixir
92+
93+
# Run parser against a predefined list of popular repositories
94+
scripts/integration_test.sh
9295
```
9396
9497
## Implementation notes

grammar.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ const ATOM_OPERATOR_LITERALS = ALL_OPS.filter(
5858
(operator) => !/[a-z]/.test(operator) && operator !== "=>"
5959
);
6060

61-
// Note that for keywords we use external scanner (KEYWORD_SPECIAL_LITERAL),
62-
// so it should be kept in sync
6361
const ATOM_SPECIAL_LITERALS = ["...", "%{}", "{}", "%", "<<>>", "..//"];
6462

6563
// See Ref 6. in the docs

scripts/integration_test.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
cd "$(dirname "$0")/.."
6+
7+
print_usage_and_exit() {
8+
echo "Usage: $0"
9+
echo ""
10+
echo "Runs the parser against a predefined list of popular Elixir repositories"
11+
echo ""
12+
exit 1
13+
}
14+
15+
if [ $# -ne 0 ]; then
16+
print_usage_and_exit
17+
fi
18+
19+
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"
20+
21+
for repo in $repos; do
22+
./scripts/parse_repo.sh $repo
23+
done

scripts/parse_repo.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dir="tmp/gh/${gh_repo//[\/-]/_}"
2626

2727
if [[ ! -d "$dir" ]]; then
2828
mkdir -p "$(dirname "$dir")"
29-
git clone "https://github.com/$gh_repo.git" "$dir"
29+
git clone --depth 1 "https://github.com/$gh_repo.git" "$dir"
3030
fi
3131

3232
echo "Running parser against $gh_repo"

0 commit comments

Comments
 (0)