add startLine option (#346)

This commit is contained in:
Raphael Mu
2017-02-10 06:06:28 -08:00
committed by Daniel Tschinder
parent 407c97c9c2
commit f25a2fbc78
6 changed files with 471 additions and 1 deletions

View File

@@ -0,0 +1,2 @@
call(1);
run(2);

View File

@@ -0,0 +1,459 @@
{
"type": "File",
"start": 0,
"end": 16,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 4,
"column": 7
}
},
"program": {
"type": "Program",
"start": 0,
"end": 16,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 4,
"column": 7
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 8,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 8
}
},
"expression": {
"type": "CallExpression",
"start": 0,
"end": 7,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 7
}
},
"callee": {
"type": "Identifier",
"start": 0,
"end": 4,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 4
},
"identifierName": "call"
},
"name": "call"
},
"arguments": [
{
"type": "NumericLiteral",
"start": 5,
"end": 6,
"loc": {
"start": {
"line": 3,
"column": 5
},
"end": {
"line": 3,
"column": 6
}
},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
]
}
},
{
"type": "ExpressionStatement",
"start": 9,
"end": 16,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 7
}
},
"expression": {
"type": "CallExpression",
"start": 9,
"end": 15,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 6
}
},
"callee": {
"type": "Identifier",
"start": 9,
"end": 12,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 3
},
"identifierName": "run"
},
"name": "run"
},
"arguments": [
{
"type": "NumericLiteral",
"start": 13,
"end": 14,
"loc": {
"start": {
"line": 4,
"column": 4
},
"end": {
"line": 4,
"column": 5
}
},
"extra": {
"rawValue": 2,
"raw": "2"
},
"value": 2
}
]
}
}
],
"directives": []
},
"comments": [],
"tokens": [
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "call",
"start": 0,
"end": 4,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 4
}
}
},
{
"type": {
"label": "(",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 4,
"end": 5,
"loc": {
"start": {
"line": 3,
"column": 4
},
"end": {
"line": 3,
"column": 5
}
}
},
{
"type": {
"label": "num",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": 1,
"start": 5,
"end": 6,
"loc": {
"start": {
"line": 3,
"column": 5
},
"end": {
"line": 3,
"column": 6
}
}
},
{
"type": {
"label": ")",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 6,
"end": 7,
"loc": {
"start": {
"line": 3,
"column": 6
},
"end": {
"line": 3,
"column": 7
}
}
},
{
"type": {
"label": ";",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 7,
"end": 8,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 8
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "run",
"start": 9,
"end": 12,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 3
}
}
},
{
"type": {
"label": "(",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 12,
"end": 13,
"loc": {
"start": {
"line": 4,
"column": 3
},
"end": {
"line": 4,
"column": 4
}
}
},
{
"type": {
"label": "num",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": 2,
"start": 13,
"end": 14,
"loc": {
"start": {
"line": 4,
"column": 4
},
"end": {
"line": 4,
"column": 5
}
}
},
{
"type": {
"label": ")",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 14,
"end": 15,
"loc": {
"start": {
"line": 4,
"column": 5
},
"end": {
"line": 4,
"column": 6
}
}
},
{
"type": {
"label": ";",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 15,
"end": 16,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 7
}
}
},
{
"type": {
"label": "eof",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 16,
"end": 16,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 7
}
}
}
]
}

View File

@@ -0,0 +1,3 @@
{
"startLine": 3
}