svelte-parse
Version:
An increidbly relaxed svelte-parser
1,318 lines (1,317 loc) • 25.4 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteScript",
"tagName": "script",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\timport Hoverable from './Hoverable.svelte';\n",
"position": {
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 3,
"column": 1,
"offset": 54
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 3,
"column": 10,
"offset": 63
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 3,
"column": 10,
"offset": 63
},
"end": {
"line": 5,
"column": 1,
"offset": 65
}
}
},
{
"type": "svelteStyle",
"tagName": "style",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\tdiv {\n\t\tpadding: 1em;\n\t\tmargin: 0 0 1em 0;\n\t\tbackground-color: #eee;\n\t}\n\n\t.active {\n\t\tbackground-color: #ff3e00;\n\t\tcolor: white;\n\t}\n",
"position": {
"start": {
"line": 5,
"column": 8,
"offset": 72
},
"end": {
"line": 16,
"column": 1,
"offset": 206
}
}
}
],
"position": {
"start": {
"line": 5,
"column": 1,
"offset": 65
},
"end": {
"line": 16,
"column": 9,
"offset": 214
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 16,
"column": 9,
"offset": 214
},
"end": {
"line": 18,
"column": 1,
"offset": 216
}
}
},
{
"type": "svelteComponent",
"tagName": "Hoverable",
"properties": [
{
"type": "svelteDirective",
"name": "let",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 18,
"column": 25,
"offset": 240
},
"end": {
"line": 18,
"column": 33,
"offset": 248
}
},
"expression": {
"type": "svelteExpression",
"value": "active",
"position": {
"start": {
"line": 18,
"column": 26,
"offset": 241
},
"end": {
"line": 18,
"column": 32,
"offset": 247
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 18,
"column": 12,
"offset": 227
},
"end": {
"line": 18,
"column": 33,
"offset": 248
}
},
"specifier": "hovering"
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\t",
"position": {
"start": {
"line": 18,
"column": 34,
"offset": 249
},
"end": {
"line": 19,
"column": 2,
"offset": 251
}
}
},
{
"type": "svelteElement",
"tagName": "div",
"properties": [
{
"type": "svelteDirective",
"name": "class",
"value": [],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 19,
"column": 7,
"offset": 256
},
"end": {
"line": 19,
"column": 19,
"offset": 268
}
},
"specifier": "active"
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\t\t",
"position": {
"start": {
"line": 19,
"column": 20,
"offset": 269
},
"end": {
"line": 20,
"column": 3,
"offset": 272
}
}
},
{
"type": "svelteBranchingBlock",
"name": "if",
"branches": [
{
"type": "svelteBranch",
"name": "if",
"expression": {
"type": "svelteExpression",
"value": "active",
"position": {
"start": {
"line": 20,
"column": 8,
"offset": 277
},
"end": {
"line": 20,
"column": 14,
"offset": 283
}
}
},
"children": [
{
"type": "text",
"value": "\n\t\t\t",
"position": {
"start": {
"line": 20,
"column": 15,
"offset": 284
},
"end": {
"line": 21,
"column": 4,
"offset": 288
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "I am being hovered upon.",
"position": {
"start": {
"line": 21,
"column": 7,
"offset": 291
},
"end": {
"line": 21,
"column": 31,
"offset": 315
}
}
}
],
"position": {
"start": {
"line": 21,
"column": 4,
"offset": 288
},
"end": {
"line": 21,
"column": 35,
"offset": 319
}
}
},
{
"type": "text",
"value": "\n\t\t",
"position": {
"start": {
"line": 21,
"column": 35,
"offset": 319
},
"end": {
"line": 22,
"column": 3,
"offset": 322
}
}
}
],
"position": {
"start": {
"line": 20,
"column": 3,
"offset": 272
},
"end": {
"line": 22,
"column": 3,
"offset": 322
}
}
},
{
"type": "svelteBranch",
"name": "else",
"expression": {
"type": "svelteExpression",
"value": ""
},
"children": [
{
"type": "text",
"value": "\n\t\t\t",
"position": {
"start": {
"line": 22,
"column": 10,
"offset": 329
},
"end": {
"line": 23,
"column": 4,
"offset": 333
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "Hover over me!",
"position": {
"start": {
"line": 23,
"column": 7,
"offset": 336
},
"end": {
"line": 23,
"column": 21,
"offset": 350
}
}
}
],
"position": {
"start": {
"line": 23,
"column": 4,
"offset": 333
},
"end": {
"line": 23,
"column": 25,
"offset": 354
}
}
},
{
"type": "text",
"value": "\n\t\t",
"position": {
"start": {
"line": 23,
"column": 25,
"offset": 354
},
"end": {
"line": 24,
"column": 3,
"offset": 357
}
}
}
],
"position": {
"start": {
"line": 22,
"column": 3,
"offset": 322
},
"end": {
"line": 24,
"column": 3,
"offset": 357
}
}
}
],
"position": {
"start": {
"line": 20,
"column": 3,
"offset": 272
},
"end": {
"line": 24,
"column": 8,
"offset": 362
}
}
},
{
"type": "text",
"value": "\n\t",
"position": {
"start": {
"line": 24,
"column": 8,
"offset": 362
},
"end": {
"line": 25,
"column": 2,
"offset": 364
}
}
}
],
"position": {
"start": {
"line": 19,
"column": 2,
"offset": 251
},
"end": {
"line": 25,
"column": 8,
"offset": 370
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 25,
"column": 8,
"offset": 370
},
"end": {
"line": 26,
"column": 1,
"offset": 371
}
}
}
],
"position": {
"start": {
"line": 18,
"column": 1,
"offset": 216
},
"end": {
"line": 26,
"column": 13,
"offset": 383
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 26,
"column": 13,
"offset": 383
},
"end": {
"line": 28,
"column": 1,
"offset": 385
}
}
},
{
"type": "svelteComponent",
"tagName": "Hoverable",
"properties": [
{
"type": "svelteDirective",
"name": "let",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 28,
"column": 25,
"offset": 409
},
"end": {
"line": 28,
"column": 33,
"offset": 417
}
},
"expression": {
"type": "svelteExpression",
"value": "active",
"position": {
"start": {
"line": 28,
"column": 26,
"offset": 410
},
"end": {
"line": 28,
"column": 32,
"offset": 416
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 28,
"column": 12,
"offset": 396
},
"end": {
"line": 28,
"column": 33,
"offset": 417
}
},
"specifier": "hovering"
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\t",
"position": {
"start": {
"line": 28,
"column": 34,
"offset": 418
},
"end": {
"line": 29,
"column": 2,
"offset": 420
}
}
},
{
"type": "svelteElement",
"tagName": "div",
"properties": [
{
"type": "svelteDirective",
"name": "class",
"value": [],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 29,
"column": 7,
"offset": 425
},
"end": {
"line": 29,
"column": 19,
"offset": 437
}
},
"specifier": "active"
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\t\t",
"position": {
"start": {
"line": 29,
"column": 20,
"offset": 438
},
"end": {
"line": 30,
"column": 3,
"offset": 441
}
}
},
{
"type": "svelteBranchingBlock",
"name": "if",
"branches": [
{
"type": "svelteBranch",
"name": "if",
"expression": {
"type": "svelteExpression",
"value": "active",
"position": {
"start": {
"line": 30,
"column": 8,
"offset": 446
},
"end": {
"line": 30,
"column": 14,
"offset": 452
}
}
},
"children": [
{
"type": "text",
"value": "\n\t\t\t",
"position": {
"start": {
"line": 30,
"column": 15,
"offset": 453
},
"end": {
"line": 31,
"column": 4,
"offset": 457
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "I am being hovered upon.",
"position": {
"start": {
"line": 31,
"column": 7,
"offset": 460
},
"end": {
"line": 31,
"column": 31,
"offset": 484
}
}
}
],
"position": {
"start": {
"line": 31,
"column": 4,
"offset": 457
},
"end": {
"line": 31,
"column": 35,
"offset": 488
}
}
},
{
"type": "text",
"value": "\n\t\t",
"position": {
"start": {
"line": 31,
"column": 35,
"offset": 488
},
"end": {
"line": 32,
"column": 3,
"offset": 491
}
}
}
],
"position": {
"start": {
"line": 30,
"column": 3,
"offset": 441
},
"end": {
"line": 32,
"column": 3,
"offset": 491
}
}
},
{
"type": "svelteBranch",
"name": "else",
"expression": {
"type": "svelteExpression",
"value": ""
},
"children": [
{
"type": "text",
"value": "\n\t\t\t",
"position": {
"start": {
"line": 32,
"column": 10,
"offset": 498
},
"end": {
"line": 33,
"column": 4,
"offset": 502
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "Hover over me!",
"position": {
"start": {
"line": 33,
"column": 7,
"offset": 505
},
"end": {
"line": 33,
"column": 21,
"offset": 519
}
}
}
],
"position": {
"start": {
"line": 33,
"column": 4,
"offset": 502
},
"end": {
"line": 33,
"column": 25,
"offset": 523
}
}
},
{
"type": "text",
"value": "\n\t\t",
"position": {
"start": {
"line": 33,
"column": 25,
"offset": 523
},
"end": {
"line": 34,
"column": 3,
"offset": 526
}
}
}
],
"position": {
"start": {
"line": 32,
"column": 3,
"offset": 491
},
"end": {
"line": 34,
"column": 3,
"offset": 526
}
}
}
],
"position": {
"start": {
"line": 30,
"column": 3,
"offset": 441
},
"end": {
"line": 34,
"column": 8,
"offset": 531
}
}
},
{
"type": "text",
"value": "\n\t",
"position": {
"start": {
"line": 34,
"column": 8,
"offset": 531
},
"end": {
"line": 35,
"column": 2,
"offset": 533
}
}
}
],
"position": {
"start": {
"line": 29,
"column": 2,
"offset": 420
},
"end": {
"line": 35,
"column": 8,
"offset": 539
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 35,
"column": 8,
"offset": 539
},
"end": {
"line": 36,
"column": 1,
"offset": 540
}
}
}
],
"position": {
"start": {
"line": 28,
"column": 1,
"offset": 385
},
"end": {
"line": 36,
"column": 13,
"offset": 552
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 36,
"column": 13,
"offset": 552
},
"end": {
"line": 38,
"column": 1,
"offset": 554
}
}
},
{
"type": "svelteComponent",
"tagName": "Hoverable",
"properties": [
{
"type": "svelteDirective",
"name": "let",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 38,
"column": 25,
"offset": 578
},
"end": {
"line": 38,
"column": 33,
"offset": 586
}
},
"expression": {
"type": "svelteExpression",
"value": "active",
"position": {
"start": {
"line": 38,
"column": 26,
"offset": 579
},
"end": {
"line": 38,
"column": 32,
"offset": 585
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 38,
"column": 12,
"offset": 565
},
"end": {
"line": 38,
"column": 33,
"offset": 586
}
},
"specifier": "hovering"
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\t",
"position": {
"start": {
"line": 38,
"column": 34,
"offset": 587
},
"end": {
"line": 39,
"column": 2,
"offset": 589
}
}
},
{
"type": "svelteElement",
"tagName": "div",
"properties": [
{
"type": "svelteDirective",
"name": "class",
"value": [],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 39,
"column": 7,
"offset": 594
},
"end": {
"line": 39,
"column": 19,
"offset": 606
}
},
"specifier": "active"
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\t\t",
"position": {
"start": {
"line": 39,
"column": 20,
"offset": 607
},
"end": {
"line": 40,
"column": 3,
"offset": 610
}
}
},
{
"type": "svelteBranchingBlock",
"name": "if",
"branches": [
{
"type": "svelteBranch",
"name": "if",
"expression": {
"type": "svelteExpression",
"value": "active",
"position": {
"start": {
"line": 40,
"column": 8,
"offset": 615
},
"end": {
"line": 40,
"column": 14,
"offset": 621
}
}
},
"children": [
{
"type": "text",
"value": "\n\t\t\t",
"position": {
"start": {
"line": 40,
"column": 15,
"offset": 622
},
"end": {
"line": 41,
"column": 4,
"offset": 626
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "I am being hovered upon.",
"position": {
"start": {
"line": 41,
"column": 7,
"offset": 629
},
"end": {
"line": 41,
"column": 31,
"offset": 653
}
}
}
],
"position": {
"start": {
"line": 41,
"column": 4,
"offset": 626
},
"end": {
"line": 41,
"column": 35,
"offset": 657
}
}
},
{
"type": "text",
"value": "\n\t\t",
"position": {
"start": {
"line": 41,
"column": 35,
"offset": 657
},
"end": {
"line": 42,
"column": 3,
"offset": 660
}
}
}
],
"position": {
"start": {
"line": 40,
"column": 3,
"offset": 610
},
"end": {
"line": 42,
"column": 3,
"offset": 660
}
}
},
{
"type": "svelteBranch",
"name": "else",
"expression": {
"type": "svelteExpression",
"value": ""
},
"children": [
{
"type": "text",
"value": "\n\t\t\t",
"position": {
"start": {
"line": 42,
"column": 10,
"offset": 667
},
"end": {
"line": 43,
"column": 4,
"offset": 671
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "Hover over me!",
"position": {
"start": {
"line": 43,
"column": 7,
"offset": 674
},
"end": {
"line": 43,
"column": 21,
"offset": 688
}
}
}
],
"position": {
"start": {
"line": 43,
"column": 4,
"offset": 671
},
"end": {
"line": 43,
"column": 25,
"offset": 692
}
}
},
{
"type": "text",
"value": "\n\t\t",
"position": {
"start": {
"line": 43,
"column": 25,
"offset": 692
},
"end": {
"line": 44,
"column": 3,
"offset": 695
}
}
}
],
"position": {
"start": {
"line": 42,
"column": 3,
"offset": 660
},
"end": {
"line": 44,
"column": 3,
"offset": 695
}
}
}
],
"position": {
"start": {
"line": 40,
"column": 3,
"offset": 610
},
"end": {
"line": 44,
"column": 8,
"offset": 700
}
}
},
{
"type": "text",
"value": "\n\t",
"position": {
"start": {
"line": 44,
"column": 8,
"offset": 700
},
"end": {
"line": 45,
"column": 2,
"offset": 702
}
}
}
],
"position": {
"start": {
"line": 39,
"column": 2,
"offset": 589
},
"end": {
"line": 45,
"column": 8,
"offset": 708
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 45,
"column": 8,
"offset": 708
},
"end": {
"line": 46,
"column": 1,
"offset": 709
}
}
}
],
"position": {
"start": {
"line": 38,
"column": 1,
"offset": 554
},
"end": {
"line": 46,
"column": 13,
"offset": 721
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 46,
"column": 13,
"offset": 721
}
}
}