UNPKG

svelte-parse

Version:

An increidbly relaxed svelte-parser

1,557 lines (1,556 loc) 28.8 kB
{ "type": "root", "children": [ { "type": "svelteScript", "tagName": "script", "properties": [], "selfClosing": false, "children": [ { "type": "text", "value": "\n\timport { createEventDispatcher } from 'svelte';\n\n\texport let value = '';\n\n\tconst dispatch = createEventDispatcher();\n\n\tconst select = num => () => value += num;\n\tconst clear = () => value = '';\n\tconst submit = () => dispatch('submit');\n", "position": { "start": { "line": 1, "column": 9, "offset": 8 }, "end": { "line": 11, "column": 1, "offset": 247 } } } ], "position": { "start": { "line": 1, "column": 1, "offset": 0 }, "end": { "line": 11, "column": 10, "offset": 256 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 11, "column": 10, "offset": 256 }, "end": { "line": 13, "column": 1, "offset": 258 } } }, { "type": "svelteStyle", "tagName": "style", "properties": [], "selfClosing": false, "children": [ { "type": "text", "value": "\n\t.keypad {\n\t\tdisplay: grid;\n\t\tgrid-template-columns: repeat(3, 5em);\n\t\tgrid-template-rows: repeat(4, 3em);\n\t\tgrid-gap: 0.5em\n\t}\n\n\tbutton {\n\t\tmargin: 0\n\t}\n", "position": { "start": { "line": 13, "column": 8, "offset": 265 }, "end": { "line": 24, "column": 1, "offset": 420 } } } ], "position": { "start": { "line": 13, "column": 1, "offset": 258 }, "end": { "line": 24, "column": 9, "offset": 428 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 24, "column": 9, "offset": 428 }, "end": { "line": 26, "column": 1, "offset": 430 } } }, { "type": "svelteElement", "tagName": "div", "properties": [ { "type": "svelteProperty", "name": "class", "value": [ { "type": "text", "value": "keypad", "position": { "start": { "line": 26, "column": 13, "offset": 442 }, "end": { "line": 26, "column": 20, "offset": 449 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 26, "column": 6, "offset": 435 }, "end": { "line": 26, "column": 20, "offset": 449 } } } ], "selfClosing": false, "children": [ { "type": "text", "value": "\n\t", "position": { "start": { "line": 26, "column": 21, "offset": 450 }, "end": { "line": 27, "column": 2, "offset": 452 } } }, { "type": "svelteElement", "tagName": "button", "properties": [ { "type": "svelteDirective", "name": "on", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 27, "column": 19, "offset": 469 }, "end": { "line": 27, "column": 30, "offset": 480 } }, "expression": { "type": "svelteExpression", "value": "select(1)", "position": { "start": { "line": 27, "column": 20, "offset": 470 }, "end": { "line": 27, "column": 29, "offset": 479 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 27, "column": 10, "offset": 460 }, "end": { "line": 27, "column": 30, "offset": 480 } }, "specifier": "click" } ], "selfClosing": false, "children": [ { "type": "text", "value": "1", "position": { "start": { "line": 27, "column": 31, "offset": 481 }, "end": { "line": 27, "column": 32, "offset": 482 } } } ], "position": { "start": { "line": 27, "column": 2, "offset": 452 }, "end": { "line": 27, "column": 41, "offset": 491 } } }, { "type": "text", "value": "\n\t", "position": { "start": { "line": 27, "column": 41, "offset": 491 }, "end": { "line": 28, "column": 2, "offset": 493 } } }, { "type": "svelteElement", "tagName": "button", "properties": [ { "type": "svelteDirective", "name": "on", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 28, "column": 19, "offset": 510 }, "end": { "line": 28, "column": 30, "offset": 521 } }, "expression": { "type": "svelteExpression", "value": "select(2)", "position": { "start": { "line": 28, "column": 20, "offset": 511 }, "end": { "line": 28, "column": 29, "offset": 520 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 28, "column": 10, "offset": 501 }, "end": { "line": 28, "column": 30, "offset": 521 } }, "specifier": "click" } ], "selfClosing": false, "children": [ { "type": "text", "value": "2", "position": { "start": { "line": 28, "column": 31, "offset": 522 }, "end": { "line": 28, "column": 32, "offset": 523 } } } ], "position": { "start": { "line": 28, "column": 2, "offset": 493 }, "end": { "line": 28, "column": 41, "offset": 532 } } }, { "type": "text", "value": "\n\t", "position": { "start": { "line": 28, "column": 41, "offset": 532 }, "end": { "line": 29, "column": 2, "offset": 534 } } }, { "type": "svelteElement", "tagName": "button", "properties": [ { "type": "svelteDirective", "name": "on", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 29, "column": 19, "offset": 551 }, "end": { "line": 29, "column": 30, "offset": 562 } }, "expression": { "type": "svelteExpression", "value": "select(3)", "position": { "start": { "line": 29, "column": 20, "offset": 552 }, "end": { "line": 29, "column": 29, "offset": 561 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 29, "column": 10, "offset": 542 }, "end": { "line": 29, "column": 30, "offset": 562 } }, "specifier": "click" } ], "selfClosing": false, "children": [ { "type": "text", "value": "3", "position": { "start": { "line": 29, "column": 31, "offset": 563 }, "end": { "line": 29, "column": 32, "offset": 564 } } } ], "position": { "start": { "line": 29, "column": 2, "offset": 534 }, "end": { "line": 29, "column": 41, "offset": 573 } } }, { "type": "text", "value": "\n\t", "position": { "start": { "line": 29, "column": 41, "offset": 573 }, "end": { "line": 30, "column": 2, "offset": 575 } } }, { "type": "svelteElement", "tagName": "button", "properties": [ { "type": "svelteDirective", "name": "on", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 30, "column": 19, "offset": 592 }, "end": { "line": 30, "column": 30, "offset": 603 } }, "expression": { "type": "svelteExpression", "value": "select(4)", "position": { "start": { "line": 30, "column": 20, "offset": 593 }, "end": { "line": 30, "column": 29, "offset": 602 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 30, "column": 10, "offset": 583 }, "end": { "line": 30, "column": 30, "offset": 603 } }, "specifier": "click" } ], "selfClosing": false, "children": [ { "type": "text", "value": "4", "position": { "start": { "line": 30, "column": 31, "offset": 604 }, "end": { "line": 30, "column": 32, "offset": 605 } } } ], "position": { "start": { "line": 30, "column": 2, "offset": 575 }, "end": { "line": 30, "column": 41, "offset": 614 } } }, { "type": "text", "value": "\n\t", "position": { "start": { "line": 30, "column": 41, "offset": 614 }, "end": { "line": 31, "column": 2, "offset": 616 } } }, { "type": "svelteElement", "tagName": "button", "properties": [ { "type": "svelteDirective", "name": "on", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 31, "column": 19, "offset": 633 }, "end": { "line": 31, "column": 30, "offset": 644 } }, "expression": { "type": "svelteExpression", "value": "select(5)", "position": { "start": { "line": 31, "column": 20, "offset": 634 }, "end": { "line": 31, "column": 29, "offset": 643 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 31, "column": 10, "offset": 624 }, "end": { "line": 31, "column": 30, "offset": 644 } }, "specifier": "click" } ], "selfClosing": false, "children": [ { "type": "text", "value": "5", "position": { "start": { "line": 31, "column": 31, "offset": 645 }, "end": { "line": 31, "column": 32, "offset": 646 } } } ], "position": { "start": { "line": 31, "column": 2, "offset": 616 }, "end": { "line": 31, "column": 41, "offset": 655 } } }, { "type": "text", "value": "\n\t", "position": { "start": { "line": 31, "column": 41, "offset": 655 }, "end": { "line": 32, "column": 2, "offset": 657 } } }, { "type": "svelteElement", "tagName": "button", "properties": [ { "type": "svelteDirective", "name": "on", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 32, "column": 19, "offset": 674 }, "end": { "line": 32, "column": 30, "offset": 685 } }, "expression": { "type": "svelteExpression", "value": "select(6)", "position": { "start": { "line": 32, "column": 20, "offset": 675 }, "end": { "line": 32, "column": 29, "offset": 684 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 32, "column": 10, "offset": 665 }, "end": { "line": 32, "column": 30, "offset": 685 } }, "specifier": "click" } ], "selfClosing": false, "children": [ { "type": "text", "value": "6", "position": { "start": { "line": 32, "column": 31, "offset": 686 }, "end": { "line": 32, "column": 32, "offset": 687 } } } ], "position": { "start": { "line": 32, "column": 2, "offset": 657 }, "end": { "line": 32, "column": 41, "offset": 696 } } }, { "type": "text", "value": "\n\t", "position": { "start": { "line": 32, "column": 41, "offset": 696 }, "end": { "line": 33, "column": 2, "offset": 698 } } }, { "type": "svelteElement", "tagName": "button", "properties": [ { "type": "svelteDirective", "name": "on", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 33, "column": 19, "offset": 715 }, "end": { "line": 33, "column": 30, "offset": 726 } }, "expression": { "type": "svelteExpression", "value": "select(7)", "position": { "start": { "line": 33, "column": 20, "offset": 716 }, "end": { "line": 33, "column": 29, "offset": 725 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 33, "column": 10, "offset": 706 }, "end": { "line": 33, "column": 30, "offset": 726 } }, "specifier": "click" } ], "selfClosing": false, "children": [ { "type": "text", "value": "7", "position": { "start": { "line": 33, "column": 31, "offset": 727 }, "end": { "line": 33, "column": 32, "offset": 728 } } } ], "position": { "start": { "line": 33, "column": 2, "offset": 698 }, "end": { "line": 33, "column": 41, "offset": 737 } } }, { "type": "text", "value": "\n\t", "position": { "start": { "line": 33, "column": 41, "offset": 737 }, "end": { "line": 34, "column": 2, "offset": 739 } } }, { "type": "svelteElement", "tagName": "button", "properties": [ { "type": "svelteDirective", "name": "on", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 34, "column": 19, "offset": 756 }, "end": { "line": 34, "column": 30, "offset": 767 } }, "expression": { "type": "svelteExpression", "value": "select(8)", "position": { "start": { "line": 34, "column": 20, "offset": 757 }, "end": { "line": 34, "column": 29, "offset": 766 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 34, "column": 10, "offset": 747 }, "end": { "line": 34, "column": 30, "offset": 767 } }, "specifier": "click" } ], "selfClosing": false, "children": [ { "type": "text", "value": "8", "position": { "start": { "line": 34, "column": 31, "offset": 768 }, "end": { "line": 34, "column": 32, "offset": 769 } } } ], "position": { "start": { "line": 34, "column": 2, "offset": 739 }, "end": { "line": 34, "column": 41, "offset": 778 } } }, { "type": "text", "value": "\n\t", "position": { "start": { "line": 34, "column": 41, "offset": 778 }, "end": { "line": 35, "column": 2, "offset": 780 } } }, { "type": "svelteElement", "tagName": "button", "properties": [ { "type": "svelteDirective", "name": "on", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 35, "column": 19, "offset": 797 }, "end": { "line": 35, "column": 30, "offset": 808 } }, "expression": { "type": "svelteExpression", "value": "select(9)", "position": { "start": { "line": 35, "column": 20, "offset": 798 }, "end": { "line": 35, "column": 29, "offset": 807 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 35, "column": 10, "offset": 788 }, "end": { "line": 35, "column": 30, "offset": 808 } }, "specifier": "click" } ], "selfClosing": false, "children": [ { "type": "text", "value": "9", "position": { "start": { "line": 35, "column": 31, "offset": 809 }, "end": { "line": 35, "column": 32, "offset": 810 } } } ], "position": { "start": { "line": 35, "column": 2, "offset": 780 }, "end": { "line": 35, "column": 41, "offset": 819 } } }, { "type": "text", "value": "\n\n\t", "position": { "start": { "line": 35, "column": 41, "offset": 819 }, "end": { "line": 37, "column": 2, "offset": 822 } } }, { "type": "svelteElement", "tagName": "button", "properties": [ { "type": "svelteProperty", "name": "disabled", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 37, "column": 19, "offset": 839 }, "end": { "line": 37, "column": 27, "offset": 847 } }, "expression": { "type": "svelteExpression", "value": "!value", "position": { "start": { "line": 37, "column": 20, "offset": 840 }, "end": { "line": 37, "column": 26, "offset": 846 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 37, "column": 10, "offset": 830 }, "end": { "line": 37, "column": 27, "offset": 847 } } }, { "type": "svelteDirective", "name": "on", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 37, "column": 37, "offset": 857 }, "end": { "line": 37, "column": 44, "offset": 864 } }, "expression": { "type": "svelteExpression", "value": "clear", "position": { "start": { "line": 37, "column": 38, "offset": 858 }, "end": { "line": 37, "column": 43, "offset": 863 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 37, "column": 28, "offset": 848 }, "end": { "line": 37, "column": 44, "offset": 864 } }, "specifier": "click" } ], "selfClosing": false, "children": [ { "type": "text", "value": "clear", "position": { "start": { "line": 37, "column": 45, "offset": 865 }, "end": { "line": 37, "column": 50, "offset": 870 } } } ], "position": { "start": { "line": 37, "column": 2, "offset": 822 }, "end": { "line": 37, "column": 59, "offset": 879 } } }, { "type": "text", "value": "\n\t", "position": { "start": { "line": 37, "column": 59, "offset": 879 }, "end": { "line": 38, "column": 2, "offset": 881 } } }, { "type": "svelteElement", "tagName": "button", "properties": [ { "type": "svelteDirective", "name": "on", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 38, "column": 19, "offset": 898 }, "end": { "line": 38, "column": 30, "offset": 909 } }, "expression": { "type": "svelteExpression", "value": "select(0)", "position": { "start": { "line": 38, "column": 20, "offset": 899 }, "end": { "line": 38, "column": 29, "offset": 908 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 38, "column": 10, "offset": 889 }, "end": { "line": 38, "column": 30, "offset": 909 } }, "specifier": "click" } ], "selfClosing": false, "children": [ { "type": "text", "value": "0", "position": { "start": { "line": 38, "column": 31, "offset": 910 }, "end": { "line": 38, "column": 32, "offset": 911 } } } ], "position": { "start": { "line": 38, "column": 2, "offset": 881 }, "end": { "line": 38, "column": 41, "offset": 920 } } }, { "type": "text", "value": "\n\t", "position": { "start": { "line": 38, "column": 41, "offset": 920 }, "end": { "line": 39, "column": 2, "offset": 922 } } }, { "type": "svelteElement", "tagName": "button", "properties": [ { "type": "svelteProperty", "name": "disabled", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 39, "column": 19, "offset": 939 }, "end": { "line": 39, "column": 27, "offset": 947 } }, "expression": { "type": "svelteExpression", "value": "!value", "position": { "start": { "line": 39, "column": 20, "offset": 940 }, "end": { "line": 39, "column": 26, "offset": 946 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 39, "column": 10, "offset": 930 }, "end": { "line": 39, "column": 27, "offset": 947 } } }, { "type": "svelteDirective", "name": "on", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 39, "column": 37, "offset": 957 }, "end": { "line": 39, "column": 45, "offset": 965 } }, "expression": { "type": "svelteExpression", "value": "submit", "position": { "start": { "line": 39, "column": 38, "offset": 958 }, "end": { "line": 39, "column": 44, "offset": 964 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 39, "column": 28, "offset": 948 }, "end": { "line": 39, "column": 45, "offset": 965 } }, "specifier": "click" } ], "selfClosing": false, "children": [ { "type": "text", "value": "submit", "position": { "start": { "line": 39, "column": 46, "offset": 966 }, "end": { "line": 39, "column": 52, "offset": 972 } } } ], "position": { "start": { "line": 39, "column": 2, "offset": 922 }, "end": { "line": 39, "column": 61, "offset": 981 } } }, { "type": "text", "value": "\n", "position": { "start": { "line": 39, "column": 61, "offset": 981 }, "end": { "line": 40, "column": 1, "offset": 982 } } } ], "position": { "start": { "line": 26, "column": 1, "offset": 430 }, "end": { "line": 40, "column": 7, "offset": 988 } } } ], "position": { "start": { "column": 1, "line": 1, "offset": 0 }, "end": { "line": 40, "column": 7, "offset": 988 } } }