svelte-parse
Version:
An increidbly relaxed svelte-parser
228 lines (227 loc) • 3.84 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteBranchingBlock",
"name": "if",
"branches": [
{
"type": "svelteBranch",
"name": "if",
"expression": {
"type": "svelteExpression",
"value": "foo",
"position": {
"start": {
"line": 1,
"column": 6,
"offset": 5
},
"end": {
"line": 1,
"column": 9,
"offset": 8
}
}
},
"children": [
{
"type": "text",
"value": "\n\t",
"position": {
"start": {
"line": 1,
"column": 10,
"offset": 9
},
"end": {
"line": 2,
"column": 2,
"offset": 11
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "foo",
"position": {
"start": {
"line": 2,
"column": 5,
"offset": 14
},
"end": {
"line": 2,
"column": 8,
"offset": 17
}
}
}
],
"position": {
"start": {
"line": 2,
"column": 2,
"offset": 11
},
"end": {
"line": 2,
"column": 12,
"offset": 21
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 2,
"column": 12,
"offset": 21
},
"end": {
"line": 3,
"column": 1,
"offset": 22
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 3,
"column": 1,
"offset": 22
}
}
},
{
"type": "svelteBranch",
"name": "else",
"expression": {
"type": "svelteExpression",
"value": ""
},
"children": [
{
"type": "text",
"value": "\n\t",
"position": {
"start": {
"line": 3,
"column": 8,
"offset": 29
},
"end": {
"line": 4,
"column": 2,
"offset": 31
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "not foo",
"position": {
"start": {
"line": 4,
"column": 5,
"offset": 34
},
"end": {
"line": 4,
"column": 12,
"offset": 41
}
}
}
],
"position": {
"start": {
"line": 4,
"column": 2,
"offset": 31
},
"end": {
"line": 4,
"column": 16,
"offset": 45
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 4,
"column": 16,
"offset": 45
},
"end": {
"line": 5,
"column": 1,
"offset": 46
}
}
}
],
"position": {
"start": {
"line": 3,
"column": 1,
"offset": 22
},
"end": {
"line": 5,
"column": 1,
"offset": 46
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 5,
"column": 6,
"offset": 51
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 5,
"column": 6,
"offset": 51
}
}
}