solidity-parser
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -1,3 +0,10 @@ | ||
### 0.2.0 (unreleased) | ||
### 0.3.0 (unreleased) | ||
* Improve parsing of visibility and storage specifiers | ||
* Add separate `StateVariableDeclaration` node type | ||
* Remove `visibility` and `is_constant` keys from `DeclarativeExpression` node | ||
* Remove many JavaScript grammar rules not valid in Solidity | ||
### 0.2.0 | ||
* Fix CLI with file arguments | ||
@@ -4,0 +11,0 @@ * Fix parsing of array constructors |
21
cli.js
#!/usr/bin/env node | ||
/* eslint no-console: 0 */ | ||
var argv = require("yargs").argv; | ||
@@ -8,8 +11,14 @@ var SolidityParser = require("./index.js"); | ||
if (argv.e) { | ||
result = SolidityParser.parse(argv.e || argv.expression); | ||
} else { | ||
result = SolidityParser.parseFile(argv.f || argv.file || argv._[0]); | ||
try { | ||
if (argv.e) { | ||
result = SolidityParser.parse(argv.e || argv.expression); | ||
} else { | ||
result = SolidityParser.parseFile(argv.f || argv.file || argv._[0]); | ||
} | ||
console.log(JSON.stringify(result, null, 2)); | ||
} catch (e) { | ||
console.error(e.message) | ||
process.exit(1); | ||
} | ||
console.log(JSON.stringify(result, null, 2)); |
{ | ||
"name": "solidity-parser", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "PEG.js Solidity parser for Javascript", | ||
@@ -8,3 +8,4 @@ "main": "index.js", | ||
"build": "pegjs -o ./build/parser.js ./solidity.pegjs && pegjs -o ./build/imports_parser.js ./imports.pegjs", | ||
"test": "mocha --timeout 5000 --reporter spec" | ||
"test": "mocha --timeout 5000 --reporter spec", | ||
"lint": "eslint ." | ||
}, | ||
@@ -11,0 +12,0 @@ "bin": { |
@@ -1,14 +0,10 @@ | ||
var SolidityParser = require('../index.js'); | ||
var SolidityParser = require("../index.js"); | ||
describe("Parser", function() { | ||
it("parses documentation examples without throwing an error", function(done) { | ||
var result = SolidityParser.parseFile("./test/doc_examples.sol", true); | ||
//console.log(JSON.stringify(result.body.filter(function(i) {return i.type == "ImportStatement"}), null, 2)); | ||
done(); | ||
it("parses documentation examples without throwing an error", function() { | ||
SolidityParser.parseFile("./test/doc_examples.sol", true); | ||
}); | ||
it("parses documentation examples using imports parser without throwing an error", function(done) { | ||
var result = SolidityParser.parseFile("./test/doc_examples.sol", "imports", true); | ||
//console.log(JSON.stringify(result, null, 2)); | ||
done(); | ||
it("parses documentation examples using imports parser without throwing an error", function() { | ||
SolidityParser.parseFile("./test/doc_examples.sol", "imports", true); | ||
}); | ||
@@ -18,13 +14,9 @@ }); | ||
describe("Built Parser", function() { | ||
it("parses documentation examples without throwing an error", function(done) { | ||
var result = SolidityParser.parseFile("./test/doc_examples.sol", false); | ||
//console.log(JSON.stringify(result.body.filter(function(i) {return i.type == "ImportStatement"}), null, 2)); | ||
done(); | ||
it("parses documentation examples without throwing an error", function() { | ||
SolidityParser.parseFile("./test/doc_examples.sol", false); | ||
}); | ||
it("parses documentation examples using imports parser without throwing an error", function(done) { | ||
var result = SolidityParser.parseFile("./test/doc_examples.sol", "imports", false); | ||
//console.log(JSON.stringify(result, null, 2)); | ||
done(); | ||
it("parses documentation examples using imports parser without throwing an error", function() { | ||
SolidityParser.parseFile("./test/doc_examples.sol", "imports", false); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
15
656430
17384