Skip to content

Commit

Permalink
Fix build grammar script
Browse files Browse the repository at this point in the history
  • Loading branch information
pablofullana committed Nov 27, 2018
1 parent 0f843b0 commit 93d4f4f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"exec-tests": "nyc -x \"**/grammar/**\" mocha && nyc report --reporter=text-lcov | coveralls",
"test": "npm run exec-tests",
"test-only": "mocha",
"generate": "(cd ./solidity-antlr4; java org.antlr.v4.Tool ./Solidity.g4 -Dlanguage=JavaScript -o ../lib/grammar)",
"generate": "scripts/build-grammar.sh",
"lint": "eslint ."
},
"bin": {
Expand Down
10 changes: 6 additions & 4 deletions scripts/build-grammar.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env sh

# download antlr4
ANTLR_JAR="antlr4.jar"

if [ ! -e "$ANTLR_JAR" ]; then
curl http://www.antlr.org/download/antlr-4.7-complete.jar -o "$ANTLR_JAR"
curl https://www.antlr.org/download/antlr-4.7.1-complete.jar -o "$ANTLR_JAR"
fi

java -jar $ANTLR_JAR -Dlanguage=JavaScript lib/grammar/Solidity.g4
# build grammar based on solidity-antlr4 submodule
cd ./solidity-antlr4; java -jar ../$ANTLR_JAR ./Solidity.g4 -Dlanguage=JavaScript -o ../lib/grammar; cd - > /dev/null

find lib/grammar/ -name '*interp' -delete
# cleanup
rm lib/grammar/*.interp antlr4.jar

0 comments on commit 93d4f4f

Please sign in to comment.