UNPKG

svelte-parse

Version:

An increidbly relaxed svelte-parser

2,044 lines (2,043 loc) 37.8 kB
{ "type": "root", "children": [ { "type": "svelteScript", "tagName": "script", "properties": [], "selfClosing": false, "children": [ { "type": "text", "value": "\n\texport let x, y;\n", "position": { "start": { "line": 1, "column": 9, "offset": 8 }, "end": { "line": 3, "column": 1, "offset": 27 } } } ], "position": { "start": { "line": 1, "column": 1, "offset": 0 }, "end": { "line": 3, "column": 10, "offset": 36 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 3, "column": 10, "offset": 36 }, "end": { "line": 5, "column": 1, "offset": 38 } } }, { "type": "svelteStyle", "tagName": "style", "properties": [], "selfClosing": false, "children": [ { "type": "text", "value": "\n\t.grid-line {\n\t\tstroke:#ccc;\n\t\topacity: 0.5;\n\t\tstroke-width: 2;\n\t}\n\n\t.grid-line-xy {\n\t\tstroke: tomato;\n\t\tstroke-width: 2;\n\t}\n", "position": { "start": { "line": 5, "column": 8, "offset": 45 }, "end": { "line": 16, "column": 1, "offset": 171 } } } ], "position": { "start": { "line": 5, "column": 1, "offset": 38 }, "end": { "line": 16, "column": 9, "offset": 179 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 16, "column": 9, "offset": 179 }, "end": { "line": 18, "column": 1, "offset": 181 } } }, { "type": "svelteMeta", "tagName": "options", "properties": [ { "type": "svelteProperty", "name": "namespace", "value": [ { "type": "text", "value": "svg", "position": { "start": { "line": 18, "column": 28, "offset": 208 }, "end": { "line": 18, "column": 32, "offset": 212 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 18, "column": 17, "offset": 197 }, "end": { "line": 18, "column": 32, "offset": 212 } } } ], "selfClosing": true, "children": [], "position": { "start": { "line": 18, "column": 1, "offset": 181 }, "end": { "line": 18, "column": 35, "offset": 215 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 18, "column": 35, "offset": 215 }, "end": { "line": 20, "column": 1, "offset": 217 } } }, { "type": "svelteElement", "tagName": "rect", "properties": [ { "type": "svelteProperty", "name": "x", "value": [ { "type": "text", "value": "0", "position": { "start": { "line": 21, "column": 4, "offset": 226 }, "end": { "line": 21, "column": 5, "offset": 227 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 21, "column": 2, "offset": 224 }, "end": { "line": 21, "column": 5, "offset": 227 } } }, { "type": "svelteProperty", "name": "y", "value": [ { "type": "text", "value": "0", "position": { "start": { "line": 22, "column": 4, "offset": 231 }, "end": { "line": 22, "column": 5, "offset": 232 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 22, "column": 2, "offset": 229 }, "end": { "line": 22, "column": 5, "offset": 232 } } }, { "type": "svelteProperty", "name": "width", "value": [ { "type": "text", "value": "1400", "position": { "start": { "line": 23, "column": 8, "offset": 240 }, "end": { "line": 23, "column": 12, "offset": 244 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 23, "column": 2, "offset": 234 }, "end": { "line": 23, "column": 12, "offset": 244 } } }, { "type": "svelteProperty", "name": "height", "value": [ { "type": "text", "value": "1800", "position": { "start": { "line": 24, "column": 9, "offset": 253 }, "end": { "line": 24, "column": 13, "offset": 257 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 24, "column": 2, "offset": 246 }, "end": { "line": 24, "column": 13, "offset": 257 } } }, { "type": "svelteProperty", "name": "stroke", "value": [ { "type": "text", "value": "#ccc", "position": { "start": { "line": 25, "column": 9, "offset": 266 }, "end": { "line": 25, "column": 13, "offset": 270 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 25, "column": 2, "offset": 259 }, "end": { "line": 25, "column": 13, "offset": 270 } } }, { "type": "svelteProperty", "name": "style", "value": [ { "type": "text", "value": "opacity:", "position": { "start": { "line": 26, "column": 9, "offset": 279 }, "end": {} } }, { "type": "text", "value": " ", "position": { "start": { "line": 26, "column": 17, "offset": 287 }, "end": {} } }, { "type": "text", "value": "0.5", "position": { "start": { "line": 26, "column": 18, "offset": 288 }, "end": { "line": 26, "column": 22, "offset": 292 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 26, "column": 2, "offset": 272 }, "end": { "line": 26, "column": 22, "offset": 292 } } }, { "type": "svelteProperty", "name": "fill", "value": [ { "type": "text", "value": "none", "position": { "start": { "line": 27, "column": 7, "offset": 299 }, "end": { "line": 27, "column": 11, "offset": 303 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 27, "column": 2, "offset": 294 }, "end": { "line": 27, "column": 11, "offset": 303 } } }, { "type": "svelteProperty", "name": "stroke-width", "value": [ { "type": "text", "value": "2", "position": { "start": { "line": 28, "column": 15, "offset": 318 }, "end": { "line": 28, "column": 16, "offset": 319 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 28, "column": 2, "offset": 305 }, "end": { "line": 28, "column": 16, "offset": 319 } } } ], "selfClosing": true, "children": [], "position": { "start": { "line": 20, "column": 1, "offset": 217 }, "end": { "line": 29, "column": 3, "offset": 322 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 29, "column": 3, "offset": 322 }, "end": { "line": 31, "column": 1, "offset": 324 } } }, { "type": "svelteBranchingBlock", "name": "each", "branches": [ { "type": "svelteBranch", "name": "each", "expression": { "type": "svelteExpression", "value": "{ length: 8 } as _, i", "position": { "start": { "line": 31, "column": 8, "offset": 331 }, "end": { "line": 31, "column": 29, "offset": 352 } } }, "children": [ { "type": "text", "value": "\n\t", "position": { "start": { "line": 31, "column": 30, "offset": 353 }, "end": { "line": 32, "column": 2, "offset": 355 } } }, { "type": "svelteBranchingBlock", "name": "if", "branches": [ { "type": "svelteBranch", "name": "if", "expression": { "type": "svelteExpression", "value": "i < 6", "position": { "start": { "line": 32, "column": 7, "offset": 360 }, "end": { "line": 32, "column": 12, "offset": 365 } } }, "children": [ { "type": "text", "value": "\n\t\t", "position": { "start": { "line": 32, "column": 13, "offset": 366 }, "end": { "line": 33, "column": 3, "offset": 369 } } }, { "type": "svelteElement", "tagName": "path", "properties": [ { "type": "svelteProperty", "name": "d", "value": [ { "type": "text", "value": "M", "position": { "start": { "line": 34, "column": 7, "offset": 381 }, "end": { "line": 34, "column": 8, "offset": 382 } } }, { "type": "svelteDynamicContent", "position": { "start": { "line": 34, "column": 8, "offset": 382 }, "end": { "line": 34, "column": 21, "offset": 395 } }, "expression": { "type": "svelteExpression", "value": "(i+1) * 200", "position": { "start": { "line": 34, "column": 9, "offset": 383 }, "end": { "line": 34, "column": 20, "offset": 394 } } } }, { "type": "text", "value": " ", "position": { "start": { "line": 34, "column": 21, "offset": 395 }, "end": {} } }, { "type": "text", "value": "0", "position": { "start": { "line": 34, "column": 22, "offset": 396 }, "end": {} } }, { "type": "text", "value": " ", "position": { "start": { "line": 34, "column": 23, "offset": 397 }, "end": {} } }, { "type": "text", "value": "L", "position": { "start": { "line": 34, "column": 24, "offset": 398 }, "end": { "line": 34, "column": 25, "offset": 399 } } }, { "type": "svelteDynamicContent", "position": { "start": { "line": 34, "column": 25, "offset": 399 }, "end": { "line": 34, "column": 36, "offset": 410 } }, "expression": { "type": "svelteExpression", "value": "(i+1)*200", "position": { "start": { "line": 34, "column": 26, "offset": 400 }, "end": { "line": 34, "column": 35, "offset": 409 } } } }, { "type": "text", "value": " ", "position": { "start": { "line": 34, "column": 36, "offset": 410 }, "end": {} } }, { "type": "text", "value": "1802", "position": { "start": { "line": 34, "column": 37, "offset": 411 }, "end": { "line": 34, "column": 42, "offset": 416 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 34, "column": 4, "offset": 378 }, "end": { "line": 34, "column": 42, "offset": 416 } } }, { "type": "svelteProperty", "name": "class", "value": [ { "type": "text", "value": "grid-line", "position": { "start": { "line": 35, "column": 11, "offset": 427 }, "end": { "line": 35, "column": 21, "offset": 437 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 35, "column": 4, "offset": 420 }, "end": { "line": 35, "column": 21, "offset": 437 } } } ], "selfClosing": true, "children": [], "position": { "start": { "line": 33, "column": 3, "offset": 369 }, "end": { "line": 36, "column": 5, "offset": 442 } } }, { "type": "text", "value": "\n\t", "position": { "start": { "line": 36, "column": 5, "offset": 442 }, "end": { "line": 37, "column": 2, "offset": 444 } } } ], "position": { "start": { "line": 32, "column": 2, "offset": 355 }, "end": { "line": 37, "column": 2, "offset": 444 } } } ], "position": { "start": { "line": 32, "column": 2, "offset": 355 }, "end": { "line": 37, "column": 7, "offset": 449 } } }, { "type": "text", "value": "\n\t", "position": { "start": { "line": 37, "column": 7, "offset": 449 }, "end": { "line": 38, "column": 2, "offset": 451 } } }, { "type": "svelteElement", "tagName": "path", "properties": [ { "type": "svelteProperty", "name": "d", "value": [ { "type": "text", "value": "M0", "position": { "start": { "line": 39, "column": 6, "offset": 462 }, "end": {} } }, { "type": "text", "value": " ", "position": { "start": { "line": 39, "column": 8, "offset": 464 }, "end": { "line": 39, "column": 9, "offset": 465 } } }, { "type": "svelteDynamicContent", "position": { "start": { "line": 39, "column": 9, "offset": 465 }, "end": { "line": 39, "column": 22, "offset": 478 } }, "expression": { "type": "svelteExpression", "value": "(i+1) * 200", "position": { "start": { "line": 39, "column": 10, "offset": 466 }, "end": { "line": 39, "column": 21, "offset": 477 } } } }, { "type": "text", "value": " ", "position": { "start": { "line": 39, "column": 22, "offset": 478 }, "end": {} } }, { "type": "text", "value": "L1400", "position": { "start": { "line": 39, "column": 23, "offset": 479 }, "end": {} } }, { "type": "text", "value": " ", "position": { "start": { "line": 39, "column": 28, "offset": 484 }, "end": { "line": 39, "column": 29, "offset": 485 } } }, { "type": "svelteDynamicContent", "position": { "start": { "line": 39, "column": 29, "offset": 485 }, "end": { "line": 39, "column": 40, "offset": 496 } }, "expression": { "type": "svelteExpression", "value": "(i+1)*200", "position": { "start": { "line": 39, "column": 30, "offset": 486 }, "end": { "line": 39, "column": 39, "offset": 495 } } } }, { "type": "text", "value": " ", "position": { "start": { "line": 39, "column": 40, "offset": 496 }, "end": { "line": 39, "column": 42, "offset": 498 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 39, "column": 3, "offset": 459 }, "end": { "line": 39, "column": 42, "offset": 498 } } }, { "type": "svelteProperty", "name": "class", "value": [ { "type": "text", "value": "grid-line", "position": { "start": { "line": 40, "column": 10, "offset": 508 }, "end": { "line": 40, "column": 20, "offset": 518 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 40, "column": 3, "offset": 501 }, "end": { "line": 40, "column": 20, "offset": 518 } } } ], "selfClosing": true, "children": [], "position": { "start": { "line": 38, "column": 2, "offset": 451 }, "end": { "line": 41, "column": 4, "offset": 522 } } }, { "type": "text", "value": "\n", "position": { "start": { "line": 41, "column": 4, "offset": 522 }, "end": { "line": 42, "column": 1, "offset": 523 } } } ], "position": { "start": { "line": 31, "column": 1, "offset": 324 }, "end": { "line": 42, "column": 1, "offset": 523 } } } ], "position": { "start": { "line": 31, "column": 1, "offset": 324 }, "end": { "line": 42, "column": 8, "offset": 530 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 42, "column": 8, "offset": 530 }, "end": { "line": 44, "column": 1, "offset": 532 } } }, { "type": "svelteElement", "tagName": "path", "properties": [ { "type": "svelteProperty", "name": "style", "value": [ { "type": "text", "value": "transform:", "position": { "start": { "line": 45, "column": 9, "offset": 546 }, "end": {} } }, { "type": "text", "value": " ", "position": { "start": { "line": 45, "column": 19, "offset": 556 }, "end": {} } }, { "type": "text", "value": "translateX(", "position": { "start": { "line": 45, "column": 20, "offset": 557 }, "end": { "line": 45, "column": 31, "offset": 568 } } }, { "type": "svelteDynamicContent", "position": { "start": { "line": 45, "column": 31, "offset": 568 }, "end": { "line": 45, "column": 38, "offset": 575 } }, "expression": { "type": "svelteExpression", "value": "x+200", "position": { "start": { "line": 45, "column": 32, "offset": 569 }, "end": { "line": 45, "column": 37, "offset": 574 } } } }, { "type": "text", "value": "px)", "position": { "start": { "line": 45, "column": 38, "offset": 575 }, "end": { "line": 45, "column": 42, "offset": 579 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 45, "column": 2, "offset": 539 }, "end": { "line": 45, "column": 42, "offset": 579 } } }, { "type": "svelteProperty", "name": "d", "value": [ { "type": "text", "value": "M0", "position": { "start": { "line": 46, "column": 5, "offset": 584 }, "end": {} } }, { "type": "text", "value": " ", "position": { "start": { "line": 46, "column": 7, "offset": 586 }, "end": {} } }, { "type": "text", "value": "0", "position": { "start": { "line": 46, "column": 8, "offset": 587 }, "end": {} } }, { "type": "text", "value": " ", "position": { "start": { "line": 46, "column": 9, "offset": 588 }, "end": {} } }, { "type": "text", "value": "L0", "position": { "start": { "line": 46, "column": 10, "offset": 589 }, "end": {} } }, { "type": "text", "value": " ", "position": { "start": { "line": 46, "column": 12, "offset": 591 }, "end": {} } }, { "type": "text", "value": "1800", "position": { "start": { "line": 46, "column": 13, "offset": 592 }, "end": { "line": 46, "column": 18, "offset": 597 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 46, "column": 2, "offset": 581 }, "end": { "line": 46, "column": 18, "offset": 597 } } }, { "type": "svelteProperty", "name": "class", "value": [ { "type": "text", "value": "grid-line-xy", "position": { "start": { "line": 47, "column": 9, "offset": 606 }, "end": { "line": 47, "column": 22, "offset": 619 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 47, "column": 2, "offset": 599 }, "end": { "line": 47, "column": 22, "offset": 619 } } } ], "selfClosing": true, "children": [], "position": { "start": { "line": 44, "column": 1, "offset": 532 }, "end": { "line": 48, "column": 3, "offset": 622 } } }, { "type": "text", "value": "\n", "position": { "start": { "line": 48, "column": 3, "offset": 622 }, "end": { "line": 49, "column": 1, "offset": 623 } } }, { "type": "svelteElement", "tagName": "path", "properties": [ { "type": "svelteProperty", "name": "style", "value": [ { "type": "text", "value": "transform:", "position": { "start": { "line": 50, "column": 9, "offset": 637 }, "end": {} } }, { "type": "text", "value": " ", "position": { "start": { "line": 50, "column": 19, "offset": 647 }, "end": {} } }, { "type": "text", "value": "translateY(", "position": { "start": { "line": 50, "column": 20, "offset": 648 }, "end": { "line": 50, "column": 31, "offset": 659 } } }, { "type": "svelteDynamicContent", "position": { "start": { "line": 50, "column": 31, "offset": 659 }, "end": { "line": 50, "column": 34, "offset": 662 } }, "expression": { "type": "svelteExpression", "value": "y", "position": { "start": { "line": 50, "column": 32, "offset": 660 }, "end": { "line": 50, "column": 33, "offset": 661 } } } }, { "type": "text", "value": "px)", "position": { "start": { "line": 50, "column": 34, "offset": 662 }, "end": { "line": 50, "column": 38, "offset": 666 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 50, "column": 2, "offset": 630 }, "end": { "line": 50, "column": 38, "offset": 666 } } }, { "type": "svelteProperty", "name": "d", "value": [ { "type": "text", "value": "M0", "position": { "start": { "line": 51, "column": 5, "offset": 671 }, "end": {} } }, { "type": "text", "value": " ", "position": { "start": { "line": 51, "column": 7, "offset": 673 }, "end": {} } }, { "type": "text", "value": "400", "position": { "start": { "line": 51, "column": 8, "offset": 674 }, "end": {} } }, { "type": "text", "value": " ", "position": { "start": { "line": 51, "column": 11, "offset": 677 }, "end": {} } }, { "type": "text", "value": "L1400", "position": { "start": { "line": 51, "column": 12, "offset": 678 }, "end": {} } }, { "type": "text", "value": " ", "position": { "start": { "line": 51, "column": 17, "offset": 683 }, "end": {} } }, { "type": "text", "value": "400", "position": { "start": { "line": 51, "column": 18, "offset": 684 }, "end": { "line": 51, "column": 22, "offset": 688 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 51, "column": 2, "offset": 668 }, "end": { "line": 51, "column": 22, "offset": 688 } } }, { "type": "svelteProperty", "name": "class", "value": [ { "type": "text", "value": "grid-line-xy", "position": { "start": { "line": 52, "column": 9, "offset": 697 }, "end": { "line": 52, "column": 22, "offset": 710 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 52, "column": 2, "offset": 690 }, "end": { "line": 52, "column": 22, "offset": 710 } } } ], "selfClosing": true, "children": [], "position": { "start": { "line": 49, "column": 1, "offset": 623 }, "end": { "line": 53, "column": 3, "offset": 713 } } }, { "type": "text", "value": "\n", "position": { "start": { "line": 53, "column": 3, "offset": 713 }, "end": { "line": 54, "column": 1, "offset": 714 } } }, { "type": "svelteElement", "tagName": "rect", "properties": [ { "type": "svelteProperty", "name": "x", "value": [ { "type": "text", "value": "200", "position": { "start": { "line": 55, "column": 4, "offset": 723 }, "end": { "line": 55, "column": 7, "offset": 726 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 55, "column": 2, "offset": 721 }, "end": { "line": 55, "column": 7, "offset": 726 } } }, { "type": "svelteProperty", "name": "y", "value": [ { "type": "text", "value": "400", "position": { "start": { "line": 56, "column": 4, "offset": 730 }, "end": { "line": 56, "column": 7, "offset": 733 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 56, "column": 2, "offset": 728 }, "end": { "line": 56, "column": 7, "offset": 733 } } }, { "type": "svelteProperty", "name": "width", "value": [ { "type": "text", "value": "1000", "position": { "start": { "line": 57, "column": 8, "offset": 741 }, "end": { "line": 57, "column": 12, "offset": 745 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 57, "column": 2, "offset": 735 }, "end": { "line": 57, "column": 12, "offset": 745 } } }, { "type": "svelteProperty", "name": "height", "value": [ { "type": "text", "value": "1000", "position": { "start": { "line": 58, "column": 9, "offset": 754 }, "end": { "line": 58, "column": 13, "offset": 758 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 58, "column": 2, "offset": 747 }, "end": { "line": 58, "column": 13, "offset": 758 } } }, { "type": "svelteProperty", "name": "stroke", "value": [ { "type": "text", "value": "#999", "position": { "start": { "line": 59, "column": 9, "offset": 767 }, "end": { "line": 59, "column": 13, "offset": 771 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 59, "column": 2, "offset": 760 }, "end": { "line": 59, "column": 13, "offset": 771 } } }, { "type": "svelteProperty", "name": "fill", "value": [ { "type": "text", "value": "none", "position": { "start": { "line": 60, "column": 7, "offset": 778 }, "end": { "line": 60, "column": 11, "offset": 782 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 60, "column": 2, "offset": 773 }, "end": { "line": 60, "column": 11, "offset": 782 } } }, { "type": "svelteProperty", "name": "stroke-width", "value": [ { "type": "text", "value": "2", "position": { "start": { "line": 61, "column": 15, "offset": 797 }, "end": { "line": 61, "column": 16, "offset": 798 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 61, "column": 2, "offset": 784 }, "end": { "line": 61, "column": 16, "offset": 798 } } } ], "selfClosing": true, "children": [], "position": { "start": { "line": 54, "column": 1, "offset": 714 }, "end": { "line": 62, "column": 3, "offset": 801 } } } ], "position": { "start": { "column": 1, "line": 1, "offset": 0 }, "end": { "line": 62, "column": 3, "offset": 801 } } }