svelte-parse
Version:
An increidbly relaxed svelte-parser
463 lines (462 loc) • 7.52 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteScript",
"tagName": "script",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\tlet a = 1;\n\tlet b = 2;\n",
"position": {
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 4,
"column": 1,
"offset": 33
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 4,
"column": 10,
"offset": 42
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 4,
"column": 10,
"offset": 42
},
"end": {
"line": 6,
"column": 1,
"offset": 44
}
}
},
{
"type": "svelteElement",
"tagName": "input",
"properties": [
{
"type": "svelteProperty",
"name": "type",
"value": [
{
"type": "text",
"value": "number",
"position": {
"start": {
"line": 6,
"column": 14,
"offset": 57
},
"end": {
"line": 6,
"column": 21,
"offset": 64
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 6,
"column": 8,
"offset": 51
},
"end": {
"line": 6,
"column": 21,
"offset": 64
}
}
},
{
"type": "svelteDirective",
"name": "bind",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 6,
"column": 33,
"offset": 76
},
"end": {
"line": 6,
"column": 36,
"offset": 79
}
},
"expression": {
"type": "svelteExpression",
"value": "a",
"position": {
"start": {
"line": 6,
"column": 34,
"offset": 77
},
"end": {
"line": 6,
"column": 35,
"offset": 78
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 6,
"column": 22,
"offset": 65
},
"end": {
"line": 6,
"column": 36,
"offset": 79
}
},
"specifier": "value"
}
],
"selfClosing": true,
"children": [],
"position": {
"start": {
"line": 6,
"column": 1,
"offset": 44
},
"end": {
"line": 6,
"column": 37,
"offset": 80
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 6,
"column": 37,
"offset": 80
},
"end": {
"line": 7,
"column": 1,
"offset": 81
}
}
},
{
"type": "svelteElement",
"tagName": "input",
"properties": [
{
"type": "svelteProperty",
"name": "type",
"value": [
{
"type": "text",
"value": "number",
"position": {
"start": {
"line": 7,
"column": 14,
"offset": 94
},
"end": {
"line": 7,
"column": 21,
"offset": 101
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 7,
"column": 8,
"offset": 88
},
"end": {
"line": 7,
"column": 21,
"offset": 101
}
}
},
{
"type": "svelteDirective",
"name": "bind",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 7,
"column": 33,
"offset": 113
},
"end": {
"line": 7,
"column": 36,
"offset": 116
}
},
"expression": {
"type": "svelteExpression",
"value": "b",
"position": {
"start": {
"line": 7,
"column": 34,
"offset": 114
},
"end": {
"line": 7,
"column": 35,
"offset": 115
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 7,
"column": 22,
"offset": 102
},
"end": {
"line": 7,
"column": 36,
"offset": 116
}
},
"specifier": "value"
}
],
"selfClosing": true,
"children": [],
"position": {
"start": {
"line": 7,
"column": 1,
"offset": 81
},
"end": {
"line": 7,
"column": 37,
"offset": 117
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 7,
"column": 37,
"offset": 117
},
"end": {
"line": 9,
"column": 1,
"offset": 119
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 9,
"column": 4,
"offset": 122
},
"end": {
"line": 9,
"column": 7,
"offset": 125
}
},
"expression": {
"type": "svelteExpression",
"value": "a",
"position": {
"start": {
"line": 9,
"column": 5,
"offset": 123
},
"end": {
"line": 9,
"column": 6,
"offset": 124
}
}
}
},
{
"type": "text",
"value": " + ",
"position": {
"start": {
"line": 9,
"column": 7,
"offset": 125
},
"end": {
"line": 9,
"column": 10,
"offset": 128
}
}
},
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 9,
"column": 10,
"offset": 128
},
"end": {
"line": 9,
"column": 13,
"offset": 131
}
},
"expression": {
"type": "svelteExpression",
"value": "b",
"position": {
"start": {
"line": 9,
"column": 11,
"offset": 129
},
"end": {
"line": 9,
"column": 12,
"offset": 130
}
}
}
},
{
"type": "text",
"value": " = ",
"position": {
"start": {
"line": 9,
"column": 13,
"offset": 131
},
"end": {
"line": 9,
"column": 16,
"offset": 134
}
}
},
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 9,
"column": 16,
"offset": 134
},
"end": {
"line": 9,
"column": 23,
"offset": 141
}
},
"expression": {
"type": "svelteExpression",
"value": "a + b",
"position": {
"start": {
"line": 9,
"column": 17,
"offset": 135
},
"end": {
"line": 9,
"column": 22,
"offset": 140
}
}
}
}
],
"position": {
"start": {
"line": 9,
"column": 1,
"offset": 119
},
"end": {
"line": 9,
"column": 27,
"offset": 145
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 9,
"column": 27,
"offset": 145
}
}
}