Skip to content

Instantly share code, notes, and snippets.

@cgewecke
Last active June 8, 2017 01:29
Show Gist options
  • Save cgewecke/d4a9d3bcd443d8dad5493f94efd10eec to your computer and use it in GitHub Desktop.
Save cgewecke/d4a9d3bcd443d8dad5493f94efd10eec to your computer and use it in GitHub Desktop.
AST for solidity-parser PR
/*
AST for:
var (x, y) = (10, 20);
var (a, b) = getMyTuple();
var (,c) = (10, 20);
var (d,,) = (10, 20, 30);
var (,e,,f,) = (10, 20, 30, 40, 50);
*/
{
"type": "VariableDeclarationTuple",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "x",
"start": 8332,
"end": 8333
},
"init": null,
"start": 8332,
"end": 8333
},
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "y",
"start": 8335,
"end": 8336
},
"init": null,
"start": 8335,
"end": 8336
}
],
"init": {
"type": "SequenceExpression",
"expressions": [
{
"type": "Literal",
"value": 10,
"start": 8341,
"end": 8343
},
{
"type": "Literal",
"value": 20,
"start": 8345,
"end": 8347
}
]
},
"start": 8327,
"end": 8349
},
{
"type": "VariableDeclarationTuple",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "a",
"start": 8359,
"end": 8360
},
"init": null,
"start": 8359,
"end": 8360
},
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "b",
"start": 8362,
"end": 8363
},
"init": null,
"start": 8362,
"end": 8363
}
],
"init": {
"type": "CallExpression",
"callee": {
"type": "Identifier",
"name": "getMyTuple",
"start": 8367,
"end": 8377
},
"arguments": [],
"start": 8367,
"end": 8379
},
"start": 8354,
"end": 8380
},
{
"type": "VariableDeclarationTuple",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "c",
"start": 8391,
"end": 8392
},
"init": null,
"start": 8391,
"end": 8392
}
],
"init": {
"type": "SequenceExpression",
"expressions": [
{
"type": "Literal",
"value": 10,
"start": 8397,
"end": 8399
},
{
"type": "Literal",
"value": 20,
"start": 8401,
"end": 8403
}
]
},
"start": 8385,
"end": 8405
},
{
"type": "VariableDeclarationTuple",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "d",
"start": 8415,
"end": 8416
},
"init": null,
"start": 8415,
"end": 8416
}
],
"init": {
"type": "SequenceExpression",
"expressions": [
{
"type": "Literal",
"value": 10,
"start": 8423,
"end": 8425
},
{
"type": "Literal",
"value": 20,
"start": 8427,
"end": 8429
},
{
"type": "Literal",
"value": 30,
"start": 8431,
"end": 8433
}
]
},
"start": 8410,
"end": 8435
},
{
"type": "VariableDeclarationTuple",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "e",
"start": 8446,
"end": 8447
},
"init": null,
"start": 8446,
"end": 8447
},
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "f",
"start": 8449,
"end": 8450
},
"init": null,
"start": 8449,
"end": 8450
}
],
"init": {
"type": "SequenceExpression",
"expressions": [
{
"type": "Literal",
"value": 10,
"start": 8456,
"end": 8458
},
{
"type": "Literal",
"value": 20,
"start": 8460,
"end": 8462
},
{
"type": "Literal",
"value": 30,
"start": 8464,
"end": 8466
},
{
"type": "Literal",
"value": 40,
"start": 8468,
"end": 8470
},
{
"type": "Literal",
"value": 50,
"start": 8472,
"end": 8474
}
]
},
"start": 8440,
"end": 8476
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment