Skip to content

Commit

Permalink
Upgrade grammar (#79)
Browse files Browse the repository at this point in the history
* Update solidity-antlr4 submodule
* Fix build grammar script
* Update grammar
  • Loading branch information
pablofullana committed Dec 3, 2018
1 parent 4aa0704 commit ea5307b
Show file tree
Hide file tree
Showing 8 changed files with 1,831 additions and 1,820 deletions.
32 changes: 16 additions & 16 deletions lib/grammar/Solidity.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -150,22 +150,22 @@ LINE_COMMENT=119
'enum'=31
'['=32
']'=33
'.'=34
'mapping'=35
'=>'=36
'memory'=37
'storage'=38
'calldata'=39
'if'=40
'else'=41
'while'=42
'assembly'=43
'do'=44
'return'=45
'throw'=46
'emit'=47
'var'=48
'address'=49
'address'=34
'.'=35
'mapping'=36
'=>'=37
'memory'=38
'storage'=39
'calldata'=40
'if'=41
'else'=42
'while'=43
'assembly'=44
'do'=45
'return'=46
'throw'=47
'emit'=48
'var'=49
'bool'=50
'string'=51
'byte'=52
Expand Down
1,547 changes: 777 additions & 770 deletions lib/grammar/SolidityLexer.js

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions lib/grammar/SolidityLexer.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -150,22 +150,22 @@ LINE_COMMENT=119
'enum'=31
'['=32
']'=33
'.'=34
'mapping'=35
'=>'=36
'memory'=37
'storage'=38
'calldata'=39
'if'=40
'else'=41
'while'=42
'assembly'=43
'do'=44
'return'=45
'throw'=46
'emit'=47
'var'=48
'address'=49
'address'=34
'.'=35
'mapping'=36
'=>'=37
'memory'=38
'storage'=39
'calldata'=40
'if'=41
'else'=42
'while'=43
'assembly'=44
'do'=45
'return'=46
'throw'=47
'emit'=48
'var'=49
'bool'=50
'string'=51
'byte'=52
Expand Down
2 changes: 1 addition & 1 deletion lib/grammar/SolidityListener.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from Solidity.g4 by ANTLR 4.7
// Generated from ./Solidity.g4 by ANTLR 4.7.1
// jshint ignore: start
var antlr4 = require('antlr4/index');

Expand Down
2,024 changes: 1,013 additions & 1,011 deletions lib/grammar/SolidityParser.js

Large diffs are not rendered by default.

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
2 changes: 1 addition & 1 deletion solidity-antlr4
Submodule solidity-antlr4 updated 2 files
+3 −2 Solidity.g4
+1 −0 test.sol

0 comments on commit ea5307b

Please sign in to comment.