@solidity-parser/parser
Advanced tools
Comparing version 0.5.2 to 0.6.0
@@ -15,3 +15,3 @@ # Developing | ||
The entry point of the project is [`src/index.js`](src/index.js), but most of the important logic is in [`src/ASTBuilder.js`](src/ASTBuilder.js). `ASTBuilder` is a [visitor](https://en.wikipedia.org/wiki/Visitor_pattern) object that traverses the AST returned by teh generated parser, and produces the AST that will be returned by the parser. | ||
The entry point of the project is [`src/index.js`](src/index.js), but most of the important logic is in [`src/ASTBuilder.js`](src/ASTBuilder.js). `ASTBuilder` is a [visitor](https://en.wikipedia.org/wiki/Visitor_pattern) object that traverses the AST returned by the generated parser, and produces the AST that will be returned by the parser. | ||
@@ -18,0 +18,0 @@ ## Setup |
@@ -547,5 +547,14 @@ 'use strict'; | ||
}, | ||
MappingKey: function MappingKey(ctx) { | ||
if (ctx.elementaryTypeName()) { | ||
return this.visit(ctx.elementaryTypeName()); | ||
} else if (ctx.userDefinedTypeName()) { | ||
return this.visit(ctx.userDefinedTypeName()); | ||
} else { | ||
throw new Error('Expected MappingKey to have either ' + 'elementaryTypeName or userDefinedTypeName'); | ||
} | ||
}, | ||
Mapping: function Mapping(ctx) { | ||
return { | ||
keyType: this.visit(ctx.elementaryTypeName()), | ||
keyType: this.visit(ctx.mappingKey()), | ||
valueType: this.visit(ctx.typeName()) | ||
@@ -781,3 +790,4 @@ }; | ||
NameValueList: function NameValueList(ctx) { | ||
var values = {}; | ||
var names = []; | ||
var args = []; | ||
@@ -792,4 +802,4 @@ var _iteratorNormalCompletion4 = true; | ||
var name = toText(nameValue.identifier()); | ||
values[name] = this.visit(nameValue.expression()); | ||
names.push(toText(nameValue.identifier())); | ||
args.push(this.visit(nameValue.expression())); | ||
} | ||
@@ -813,3 +823,4 @@ } catch (err) { | ||
type: 'NameValueList', | ||
values: values | ||
names: names, | ||
arguments: args | ||
}; | ||
@@ -816,0 +827,0 @@ }, |
@@ -214,2 +214,8 @@ 'use strict'; | ||
// Enter a parse tree produced by SolidityParser#mappingKey. | ||
SolidityListener.prototype.enterMappingKey = function (ctx) {}; | ||
// Exit a parse tree produced by SolidityParser#mappingKey. | ||
SolidityListener.prototype.exitMappingKey = function (ctx) {}; | ||
// Enter a parse tree produced by SolidityParser#mapping. | ||
@@ -216,0 +222,0 @@ SolidityListener.prototype.enterMapping = function (ctx) {}; |
@@ -10,3 +10,3 @@ 'use strict'; | ||
exports.buildTokenList = buildTokenList; | ||
/* babel-plugin-inline-import './lib/Solidity.tokens' */var tokens = 'T__0=1\nT__1=2\nT__2=3\nT__3=4\nT__4=5\nT__5=6\nT__6=7\nT__7=8\nT__8=9\nT__9=10\nT__10=11\nT__11=12\nT__12=13\nT__13=14\nT__14=15\nT__15=16\nT__16=17\nT__17=18\nT__18=19\nT__19=20\nT__20=21\nT__21=22\nT__22=23\nT__23=24\nT__24=25\nT__25=26\nT__26=27\nT__27=28\nT__28=29\nT__29=30\nT__30=31\nT__31=32\nT__32=33\nT__33=34\nT__34=35\nT__35=36\nT__36=37\nT__37=38\nT__38=39\nT__39=40\nT__40=41\nT__41=42\nT__42=43\nT__43=44\nT__44=45\nT__45=46\nT__46=47\nT__47=48\nT__48=49\nT__49=50\nT__50=51\nT__51=52\nT__52=53\nT__53=54\nT__54=55\nT__55=56\nT__56=57\nT__57=58\nT__58=59\nT__59=60\nT__60=61\nT__61=62\nT__62=63\nT__63=64\nT__64=65\nT__65=66\nT__66=67\nT__67=68\nT__68=69\nT__69=70\nT__70=71\nT__71=72\nT__72=73\nT__73=74\nT__74=75\nT__75=76\nT__76=77\nT__77=78\nT__78=79\nT__79=80\nT__80=81\nT__81=82\nT__82=83\nT__83=84\nT__84=85\nT__85=86\nT__86=87\nT__87=88\nT__88=89\nT__89=90\nT__90=91\nT__91=92\nT__92=93\nT__93=94\nInt=95\nUint=96\nByte=97\nFixed=98\nUfixed=99\nBooleanLiteral=100\nDecimalNumber=101\nHexNumber=102\nNumberUnit=103\nHexLiteral=104\nReservedKeyword=105\nAnonymousKeyword=106\nBreakKeyword=107\nConstantKeyword=108\nContinueKeyword=109\nLeaveKeyword=110\nExternalKeyword=111\nIndexedKeyword=112\nInternalKeyword=113\nPayableKeyword=114\nPrivateKeyword=115\nPublicKeyword=116\nVirtualKeyword=117\nPureKeyword=118\nTypeKeyword=119\nViewKeyword=120\nConstructorKeyword=121\nFallbackKeyword=122\nReceiveKeyword=123\nIdentifier=124\nStringLiteralFragment=125\nVersionLiteral=126\nWS=127\nCOMMENT=128\nLINE_COMMENT=129\n\'pragma\'=1\n\';\'=2\n\'^\'=3\n\'~\'=4\n\'>=\'=5\n\'>\'=6\n\'<\'=7\n\'<=\'=8\n\'=\'=9\n\'as\'=10\n\'import\'=11\n\'*\'=12\n\'from\'=13\n\'{\'=14\n\',\'=15\n\'}\'=16\n\'abstract\'=17\n\'contract\'=18\n\'interface\'=19\n\'library\'=20\n\'is\'=21\n\'(\'=22\n\')\'=23\n\'using\'=24\n\'for\'=25\n\'struct\'=26\n\'modifier\'=27\n\'function\'=28\n\'returns\'=29\n\'event\'=30\n\'enum\'=31\n\'[\'=32\n\']\'=33\n\'address\'=34\n\'.\'=35\n\'mapping\'=36\n\'=>\'=37\n\'memory\'=38\n\'storage\'=39\n\'calldata\'=40\n\'if\'=41\n\'else\'=42\n\'try\'=43\n\'catch\'=44\n\'while\'=45\n\'assembly\'=46\n\'do\'=47\n\'return\'=48\n\'throw\'=49\n\'emit\'=50\n\'var\'=51\n\'bool\'=52\n\'string\'=53\n\'byte\'=54\n\'++\'=55\n\'--\'=56\n\'new\'=57\n\':\'=58\n\'+\'=59\n\'-\'=60\n\'after\'=61\n\'delete\'=62\n\'!\'=63\n\'**\'=64\n\'/\'=65\n\'%\'=66\n\'<<\'=67\n\'>>\'=68\n\'&\'=69\n\'|\'=70\n\'==\'=71\n\'!=\'=72\n\'&&\'=73\n\'||\'=74\n\'?\'=75\n\'|=\'=76\n\'^=\'=77\n\'&=\'=78\n\'<<=\'=79\n\'>>=\'=80\n\'+=\'=81\n\'-=\'=82\n\'*=\'=83\n\'/=\'=84\n\'%=\'=85\n\'let\'=86\n\':=\'=87\n\'=:\'=88\n\'switch\'=89\n\'case\'=90\n\'default\'=91\n\'->\'=92\n\'callback\'=93\n\'override\'=94\n\'anonymous\'=106\n\'break\'=107\n\'constant\'=108\n\'continue\'=109\n\'leave\'=110\n\'external\'=111\n\'indexed\'=112\n\'internal\'=113\n\'payable\'=114\n\'private\'=115\n\'public\'=116\n\'virtual\'=117\n\'pure\'=118\n\'type\'=119\n\'view\'=120\n\'constructor\'=121\n\'fallback\'=122\n\'receive\'=123\n'; | ||
/* babel-plugin-inline-import './lib/Solidity.tokens' */var tokens = 'T__0=1\nT__1=2\nT__2=3\nT__3=4\nT__4=5\nT__5=6\nT__6=7\nT__7=8\nT__8=9\nT__9=10\nT__10=11\nT__11=12\nT__12=13\nT__13=14\nT__14=15\nT__15=16\nT__16=17\nT__17=18\nT__18=19\nT__19=20\nT__20=21\nT__21=22\nT__22=23\nT__23=24\nT__24=25\nT__25=26\nT__26=27\nT__27=28\nT__28=29\nT__29=30\nT__30=31\nT__31=32\nT__32=33\nT__33=34\nT__34=35\nT__35=36\nT__36=37\nT__37=38\nT__38=39\nT__39=40\nT__40=41\nT__41=42\nT__42=43\nT__43=44\nT__44=45\nT__45=46\nT__46=47\nT__47=48\nT__48=49\nT__49=50\nT__50=51\nT__51=52\nT__52=53\nT__53=54\nT__54=55\nT__55=56\nT__56=57\nT__57=58\nT__58=59\nT__59=60\nT__60=61\nT__61=62\nT__62=63\nT__63=64\nT__64=65\nT__65=66\nT__66=67\nT__67=68\nT__68=69\nT__69=70\nT__70=71\nT__71=72\nT__72=73\nT__73=74\nT__74=75\nT__75=76\nT__76=77\nT__77=78\nT__78=79\nT__79=80\nT__80=81\nT__81=82\nT__82=83\nT__83=84\nT__84=85\nT__85=86\nT__86=87\nT__87=88\nT__88=89\nT__89=90\nT__90=91\nT__91=92\nT__92=93\nT__93=94\nInt=95\nUint=96\nByte=97\nFixed=98\nUfixed=99\nBooleanLiteral=100\nDecimalNumber=101\nHexNumber=102\nNumberUnit=103\nHexLiteral=104\nReservedKeyword=105\nAnonymousKeyword=106\nBreakKeyword=107\nConstantKeyword=108\nImmutableKeyword=109\nContinueKeyword=110\nLeaveKeyword=111\nExternalKeyword=112\nIndexedKeyword=113\nInternalKeyword=114\nPayableKeyword=115\nPrivateKeyword=116\nPublicKeyword=117\nVirtualKeyword=118\nPureKeyword=119\nTypeKeyword=120\nViewKeyword=121\nConstructorKeyword=122\nFallbackKeyword=123\nReceiveKeyword=124\nIdentifier=125\nStringLiteralFragment=126\nVersionLiteral=127\nWS=128\nCOMMENT=129\nLINE_COMMENT=130\n\'pragma\'=1\n\';\'=2\n\'^\'=3\n\'~\'=4\n\'>=\'=5\n\'>\'=6\n\'<\'=7\n\'<=\'=8\n\'=\'=9\n\'as\'=10\n\'import\'=11\n\'*\'=12\n\'from\'=13\n\'{\'=14\n\',\'=15\n\'}\'=16\n\'abstract\'=17\n\'contract\'=18\n\'interface\'=19\n\'library\'=20\n\'is\'=21\n\'(\'=22\n\')\'=23\n\'using\'=24\n\'for\'=25\n\'struct\'=26\n\'modifier\'=27\n\'function\'=28\n\'returns\'=29\n\'event\'=30\n\'enum\'=31\n\'[\'=32\n\']\'=33\n\'address\'=34\n\'.\'=35\n\'mapping\'=36\n\'=>\'=37\n\'memory\'=38\n\'storage\'=39\n\'calldata\'=40\n\'if\'=41\n\'else\'=42\n\'try\'=43\n\'catch\'=44\n\'while\'=45\n\'assembly\'=46\n\'do\'=47\n\'return\'=48\n\'throw\'=49\n\'emit\'=50\n\'var\'=51\n\'bool\'=52\n\'string\'=53\n\'byte\'=54\n\'++\'=55\n\'--\'=56\n\'new\'=57\n\':\'=58\n\'+\'=59\n\'-\'=60\n\'after\'=61\n\'delete\'=62\n\'!\'=63\n\'**\'=64\n\'/\'=65\n\'%\'=66\n\'<<\'=67\n\'>>\'=68\n\'&\'=69\n\'|\'=70\n\'==\'=71\n\'!=\'=72\n\'&&\'=73\n\'||\'=74\n\'?\'=75\n\'|=\'=76\n\'^=\'=77\n\'&=\'=78\n\'<<=\'=79\n\'>>=\'=80\n\'+=\'=81\n\'-=\'=82\n\'*=\'=83\n\'/=\'=84\n\'%=\'=85\n\'let\'=86\n\':=\'=87\n\'=:\'=88\n\'switch\'=89\n\'case\'=90\n\'default\'=91\n\'->\'=92\n\'callback\'=93\n\'override\'=94\n\'anonymous\'=106\n\'break\'=107\n\'constant\'=108\n\'immutable\'=109\n\'continue\'=110\n\'leave\'=111\n\'external\'=112\n\'indexed\'=113\n\'internal\'=114\n\'payable\'=115\n\'private\'=116\n\'public\'=117\n\'virtual\'=118\n\'pure\'=119\n\'type\'=120\n\'view\'=121\n\'constructor\'=122\n\'fallback\'=123\n\'receive\'=124\n'; | ||
@@ -13,0 +13,0 @@ |
@@ -88,3 +88,4 @@ // Type definitions for solidity-parser-antlr 0.2 | ||
| 'MemberAccess' | ||
| 'IndexAccess'; | ||
| 'IndexAccess' | ||
| 'NameValueList'; | ||
export interface BaseASTNode { | ||
@@ -446,2 +447,7 @@ type: ASTNodeTypeString; | ||
} | ||
export interface NameValueList extends BaseASTNode { | ||
type: 'NameValueList'; | ||
names: string[]; | ||
args: Expression[]; | ||
} | ||
export type ASTNode = | ||
@@ -448,0 +454,0 @@ | SourceUnit |
{ | ||
"name": "@solidity-parser/parser", | ||
"version": "0.5.2", | ||
"version": "0.6.0", | ||
"description": "A Solidity parser built from a robust ANTLR 4 grammar", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -125,5 +125,10 @@ # Solidity Parser for JavaScript | ||
## Used By | ||
## Used by | ||
* [sol2uml](https://github.com/naddison36/sol2uml) | ||
* [Solhint](https://github.com/protofire/solhint/) | ||
* [solidity-coverage](https://github.com/sc-forks/solidity-coverage) | ||
* [prettier-solidity](https://github.com/prettier-solidity/prettier-plugin-solidity/) | ||
* [Buidler](https://github.com/nomiclabs/buidler/) | ||
* [eth-gas-reporter](https://github.com/cgewecke/eth-gas-reporter) | ||
@@ -130,0 +135,0 @@ ## License |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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 too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
4002784
79
48206
137