Comparing version 1.3.1 to 1.3.2
{ | ||
"name": "solparse", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "PEG.js Solidity parser for Javascript", | ||
@@ -37,5 +37,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"mocha": "^2.4.5", | ||
"mocha": "^4.0.1", | ||
"pegjs": "^0.10.0", | ||
"yargs": "^4.6.0" | ||
"yargs": "^10.0.3" | ||
}, | ||
@@ -42,0 +42,0 @@ "devDependencies": { |
127
README.md
@@ -1,4 +0,4 @@ | ||
Solparse is a fork of Consensys' solidity-parser. Solium is heavily dependant on a parser for operating on the AST and so I needed full control over whichever parse was added as a depandancy to the linter. Hence, the fork which I maintain and have the flexibility to release whenever I need to. | ||
Solparse is a fork of [Consensys' solidity-parser](https://github.com/ConsenSys/solidity-parser). Solium is heavily dependant on a parser for operating on the AST and so I needed full control over whichever parse was added as a depandancy to the linter. Hence, the fork which I maintain and have the flexibility to release whenever I need to. | ||
# Solidity Parser | ||
# Solparse | ||
@@ -15,16 +15,14 @@ A Solidity parser in Javascript. So we can evaluate and alter Solidity code without resorting to cruddy preprocessing. | ||
``` | ||
npm install solidity-parser | ||
``` | ||
npm install solidity-parser | ||
Then, in your code: | ||
```javascript | ||
var SolidityParser = require("solidity-parser"); | ||
``` | ||
const SolidityParser = require('solidity-parser'); | ||
// Parse Solidity code as a string: | ||
var result = SolidityParser.parse("contract { ... }"); | ||
// Parse Solidity code as a string: | ||
const result = SolidityParser.parse('contract { ... }'); | ||
// Or, parse a file: | ||
var result = SolidityParser.parseFile("./path/to/file.sol"); | ||
// Or, parse a file: | ||
const result = SolidityParser.parseFile('./path/to/file.sol'); | ||
``` | ||
@@ -34,20 +32,15 @@ | ||
```javascript | ||
const SolidityParser = require('solidity-parser'); | ||
var SolidityParser = require("solidity-parser"); | ||
const result = SolidityParser.parseFile('./path/to/file.sol', 'imports'); | ||
var result = SolidityParser.parseFile("./path/to/file.sol", "imports"); | ||
console.log(result); | ||
// [ | ||
// 'SomeFile.sol', | ||
// 'AnotherFile.sol' | ||
// ] | ||
console.log(result); | ||
// [ | ||
// "SomeFile.sol", | ||
// "AnotherFile.sol" | ||
// ] | ||
``` | ||
**Command Line** (for convenience) | ||
``` | ||
$ solidity-parser ./path/to/file.js | ||
``` | ||
$ solidity-parser ./path/to/file.js | ||
@@ -58,59 +51,55 @@ ### Results | ||
``` | ||
import "Foo.sol"; | ||
import "Foo.sol"; | ||
contract MyContract { | ||
mapping (uint => address) public addresses; | ||
} | ||
``` | ||
contract MyContract { | ||
mapping (uint => address) public addresses; | ||
} | ||
You'll receiving the following (or something very similar) as output. Note that the structure of mappings could be made more clear, and this will likely be changed in the future. | ||
```json | ||
{ | ||
"type": "Program", | ||
"body": [ | ||
{ | ||
"type": "ImportStatement", | ||
"value": "Foo.sol" | ||
}, | ||
{ | ||
"type": "ContractStatement", | ||
"name": "MyContract", | ||
"is": [], | ||
"type": "Program", | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"expression": { | ||
"type": "DeclarativeExpression", | ||
"name": "addresses", | ||
"literal": { | ||
"type": "Type", | ||
"literal": { | ||
"type": "MappingExpression", | ||
"from": { | ||
"type": "ImportStatement", | ||
"value": "Foo.sol" | ||
}, | ||
{ | ||
"type": "ContractStatement", | ||
"name": "MyContract", | ||
"is": [], | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"expression": { | ||
"type": "DeclarativeExpression", | ||
"name": "addresses", | ||
"literal": { | ||
"type": "Type", | ||
"literal": "uint", | ||
"literal": { | ||
"type": "MappingExpression", | ||
"from": { | ||
"type": "Type", | ||
"literal": "uint", | ||
"members": [], | ||
"array_parts": [] | ||
}, | ||
"to": { | ||
"type": "Type", | ||
"literal": "address", | ||
"members": [], | ||
"array_parts": [] | ||
} | ||
}, | ||
"members": [], | ||
"array_parts": [] | ||
}, | ||
"to": { | ||
"type": "Type", | ||
"literal": "address", | ||
"members": [], | ||
"array_parts": [] | ||
} | ||
}, | ||
"members": [], | ||
"array_parts": [] | ||
}, | ||
"is_constant": false, | ||
"is_public": true | ||
} | ||
"is_constant": false, | ||
"is_public": true | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
``` | ||
@@ -121,5 +110,3 @@ ### Test | ||
``` | ||
$ npm test | ||
``` | ||
$ npm test | ||
@@ -126,0 +113,0 @@ ### License |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
688161
113
+ Addedansi-regex@3.0.1(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedbrowser-stdout@1.3.0(transitive)
+ Addedcamelcase@4.1.0(transitive)
+ Addedcliui@4.1.0(transitive)
+ Addedcommander@2.11.0(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedcross-spawn@5.1.0(transitive)
+ Addeddebug@3.1.0(transitive)
+ Addeddiff@3.3.1(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedexeca@0.7.0(transitive)
+ Addedfind-up@2.1.0(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedget-stream@3.0.0(transitive)
+ Addedglob@7.1.2(transitive)
+ Addedgrowl@1.10.3(transitive)
+ Addedhas-flag@2.0.0(transitive)
+ Addedhe@1.1.1(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedis-fullwidth-code-point@2.0.0(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedlocate-path@2.0.0(transitive)
+ Addedlru-cache@4.1.5(transitive)
+ Addedmem@1.1.0(transitive)
+ Addedmimic-fn@1.2.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedmocha@4.1.0(transitive)
+ Addedms@2.0.0(transitive)
+ Addednpm-run-path@2.0.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedos-locale@2.1.0(transitive)
+ Addedp-finally@1.0.0(transitive)
+ Addedp-limit@1.3.0(transitive)
+ Addedp-locate@2.0.0(transitive)
+ Addedp-try@1.0.0(transitive)
+ Addedpath-exists@3.0.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-key@2.0.1(transitive)
+ Addedpseudomap@1.0.2(transitive)
+ Addedshebang-command@1.2.0(transitive)
+ Addedshebang-regex@1.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedstring-width@2.1.1(transitive)
+ Addedstrip-ansi@4.0.0(transitive)
+ Addedstrip-eof@1.0.0(transitive)
+ Addedsupports-color@4.4.0(transitive)
+ Addedwhich@1.3.1(transitive)
+ Addedwhich-module@2.0.1(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedyallist@2.1.2(transitive)
+ Addedyargs@10.1.2(transitive)
+ Addedyargs-parser@8.1.0(transitive)
- Removedcamelcase@3.0.0(transitive)
- Removedcliui@3.2.0(transitive)
- Removedcommander@0.6.12.3.0(transitive)
- Removeddebug@2.2.0(transitive)
- Removeddiff@1.4.0(transitive)
- Removederror-ex@1.3.2(transitive)
- Removedescape-string-regexp@1.0.2(transitive)
- Removedfind-up@1.1.2(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedglob@3.2.11(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedgrowl@1.9.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhosted-git-info@2.8.9(transitive)
- Removedis-arrayish@0.2.1(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedis-utf8@0.2.1(transitive)
- Removedjade@0.26.3(transitive)
- Removedload-json-file@1.1.0(transitive)
- Removedlodash.assign@4.2.0(transitive)
- Removedlru-cache@2.7.3(transitive)
- Removedminimatch@0.3.0(transitive)
- Removedmkdirp@0.3.0(transitive)
- Removedmocha@2.5.3(transitive)
- Removedms@0.7.1(transitive)
- Removednormalize-package-data@2.5.0(transitive)
- Removedos-locale@1.4.0(transitive)
- Removedparse-json@2.2.0(transitive)
- Removedpath-exists@2.1.0(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedpath-type@1.1.0(transitive)
- Removedpify@2.3.0(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)
- Removedread-pkg@1.1.0(transitive)
- Removedread-pkg-up@1.0.1(transitive)
- Removedresolve@1.22.8(transitive)
- Removedsemver@5.7.2(transitive)
- Removedsigmund@1.0.1(transitive)
- Removedspdx-correct@3.2.0(transitive)
- Removedspdx-exceptions@2.5.0(transitive)
- Removedspdx-expression-parse@3.0.1(transitive)
- Removedspdx-license-ids@3.0.20(transitive)
- Removedstrip-bom@2.0.0(transitive)
- Removedsupports-color@1.2.0(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedto-iso-string@0.0.2(transitive)
- Removedvalidate-npm-package-license@3.0.4(transitive)
- Removedwhich-module@1.0.0(transitive)
- Removedwindow-size@0.2.0(transitive)
- Removedyargs@4.8.1(transitive)
- Removedyargs-parser@2.4.1(transitive)
Updatedmocha@^4.0.1
Updatedyargs@^10.0.3