svelte-parse
Version:
An increidbly relaxed svelte-parser
654 lines (653 loc) • 10.8 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteBranchingBlock",
"name": "if",
"branches": [
{
"type": "svelteBranch",
"name": "if",
"expression": {
"type": "svelteExpression",
"value": "true",
"position": {
"start": {
"line": 1,
"column": 6,
"offset": 5
},
"end": {
"line": 1,
"column": 10,
"offset": 9
}
}
},
"children": [
{
"type": "text",
"value": "\n\t",
"position": {
"start": {
"line": 1,
"column": 11,
"offset": 10
},
"end": {
"line": 2,
"column": 2,
"offset": 12
}
}
},
{
"type": "svelteElement",
"tagName": "input",
"properties": [],
"selfClosing": true,
"children": [],
"position": {
"start": {
"line": 2,
"column": 2,
"offset": 12
},
"end": {
"line": 2,
"column": 9,
"offset": 19
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 2,
"column": 9,
"offset": 19
},
"end": {
"line": 3,
"column": 1,
"offset": 20
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 3,
"column": 1,
"offset": 20
}
}
},
{
"type": "svelteBranch",
"name": "else",
"expression": {
"type": "svelteExpression",
"value": ""
},
"children": [
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 3,
"column": 8,
"offset": 27
},
"end": {
"line": 4,
"column": 1,
"offset": 28
}
}
}
],
"position": {
"start": {
"line": 3,
"column": 1,
"offset": 20
},
"end": {
"line": 4,
"column": 1,
"offset": 28
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 4,
"column": 6,
"offset": 33
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 4,
"column": 6,
"offset": 33
},
"end": {
"line": 6,
"column": 1,
"offset": 35
}
}
},
{
"type": "svelteBranchingBlock",
"name": "if",
"branches": [
{
"type": "svelteBranch",
"name": "if",
"expression": {
"type": "svelteExpression",
"value": "true",
"position": {
"start": {
"line": 6,
"column": 6,
"offset": 40
},
"end": {
"line": 6,
"column": 10,
"offset": 44
}
}
},
"children": [
{
"type": "text",
"value": "\n\t",
"position": {
"start": {
"line": 6,
"column": 11,
"offset": 45
},
"end": {
"line": 7,
"column": 2,
"offset": 47
}
}
},
{
"type": "svelteElement",
"tagName": "br",
"properties": [],
"selfClosing": true,
"children": [],
"position": {
"start": {
"line": 7,
"column": 2,
"offset": 47
},
"end": {
"line": 7,
"column": 6,
"offset": 51
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 7,
"column": 6,
"offset": 51
},
"end": {
"line": 8,
"column": 1,
"offset": 52
}
}
}
],
"position": {
"start": {
"line": 6,
"column": 1,
"offset": 35
},
"end": {
"line": 8,
"column": 1,
"offset": 52
}
}
},
{
"type": "svelteBranch",
"name": "else",
"expression": {
"type": "svelteExpression",
"value": ""
},
"children": [
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 8,
"column": 8,
"offset": 59
},
"end": {
"line": 9,
"column": 1,
"offset": 60
}
}
}
],
"position": {
"start": {
"line": 8,
"column": 1,
"offset": 52
},
"end": {
"line": 9,
"column": 1,
"offset": 60
}
}
}
],
"position": {
"start": {
"line": 6,
"column": 1,
"offset": 35
},
"end": {
"line": 9,
"column": 6,
"offset": 65
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 9,
"column": 6,
"offset": 65
},
"end": {
"line": 11,
"column": 1,
"offset": 67
}
}
},
{
"type": "svelteBranchingBlock",
"name": "await",
"branches": [
{
"type": "svelteBranch",
"name": "await",
"expression": {
"type": "svelteExpression",
"value": "true",
"position": {
"start": {
"line": 11,
"column": 9,
"offset": 75
},
"end": {
"line": 11,
"column": 13,
"offset": 79
}
}
},
"children": [
{
"type": "text",
"value": "\n\t",
"position": {
"start": {
"line": 11,
"column": 14,
"offset": 80
},
"end": {
"line": 12,
"column": 2,
"offset": 82
}
}
},
{
"type": "svelteElement",
"tagName": "input",
"properties": [],
"selfClosing": true,
"children": [],
"position": {
"start": {
"line": 12,
"column": 2,
"offset": 82
},
"end": {
"line": 12,
"column": 9,
"offset": 89
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 12,
"column": 9,
"offset": 89
},
"end": {
"line": 13,
"column": 1,
"offset": 90
}
}
}
],
"position": {
"start": {
"line": 11,
"column": 1,
"offset": 67
},
"end": {
"line": 13,
"column": 1,
"offset": 90
}
}
},
{
"type": "svelteBranch",
"name": "then",
"expression": {
"type": "svelteExpression",
"value": "f",
"position": {
"start": {
"line": 13,
"column": 8,
"offset": 97
},
"end": {
"line": 13,
"column": 9,
"offset": 98
}
}
},
"children": [
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 13,
"column": 10,
"offset": 99
},
"end": {
"line": 14,
"column": 1,
"offset": 100
}
}
}
],
"position": {
"start": {
"line": 13,
"column": 1,
"offset": 90
},
"end": {
"line": 14,
"column": 1,
"offset": 100
}
}
}
],
"position": {
"start": {
"line": 11,
"column": 1,
"offset": 67
},
"end": {
"line": 14,
"column": 9,
"offset": 108
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 14,
"column": 9,
"offset": 108
},
"end": {
"line": 16,
"column": 1,
"offset": 110
}
}
},
{
"type": "svelteBranchingBlock",
"name": "await",
"branches": [
{
"type": "svelteBranch",
"name": "await",
"expression": {
"type": "svelteExpression",
"value": "true",
"position": {
"start": {
"line": 16,
"column": 9,
"offset": 118
},
"end": {
"line": 16,
"column": 13,
"offset": 122
}
}
},
"children": [
{
"type": "text",
"value": "\n\t",
"position": {
"start": {
"line": 16,
"column": 14,
"offset": 123
},
"end": {
"line": 17,
"column": 2,
"offset": 125
}
}
},
{
"type": "svelteElement",
"tagName": "br",
"properties": [],
"selfClosing": true,
"children": [],
"position": {
"start": {
"line": 17,
"column": 2,
"offset": 125
},
"end": {
"line": 17,
"column": 6,
"offset": 129
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 17,
"column": 6,
"offset": 129
},
"end": {
"line": 18,
"column": 1,
"offset": 130
}
}
}
],
"position": {
"start": {
"line": 16,
"column": 1,
"offset": 110
},
"end": {
"line": 18,
"column": 1,
"offset": 130
}
}
},
{
"type": "svelteBranch",
"name": "then",
"expression": {
"type": "svelteExpression",
"value": "f",
"position": {
"start": {
"line": 18,
"column": 8,
"offset": 137
},
"end": {
"line": 18,
"column": 9,
"offset": 138
}
}
},
"children": [
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 18,
"column": 10,
"offset": 139
},
"end": {
"line": 19,
"column": 1,
"offset": 140
}
}
}
],
"position": {
"start": {
"line": 18,
"column": 1,
"offset": 130
},
"end": {
"line": 19,
"column": 1,
"offset": 140
}
}
}
],
"position": {
"start": {
"line": 16,
"column": 1,
"offset": 110
},
"end": {
"line": 19,
"column": 9,
"offset": 148
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 19,
"column": 9,
"offset": 148
}
}
}