UNPKG

svelte-parse

Version:

An increidbly relaxed svelte-parser

475 lines (474 loc) 8.46 kB
{ "type": "root", "children": [ { "type": "svelteScript", "tagName": "script", "properties": [], "selfClosing": false, "children": [ { "type": "text", "value": "\n\tlet x = 7;\n", "position": { "start": { "line": 1, "column": 9, "offset": 8 }, "end": { "line": 3, "column": 1, "offset": 21 } } } ], "position": { "start": { "line": 1, "column": 1, "offset": 0 }, "end": { "line": 3, "column": 10, "offset": 30 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 3, "column": 10, "offset": 30 }, "end": { "line": 5, "column": 1, "offset": 32 } } }, { "type": "svelteBranchingBlock", "name": "if", "branches": [ { "type": "svelteBranch", "name": "if", "expression": { "type": "svelteExpression", "value": "x > 10", "position": { "start": { "line": 5, "column": 6, "offset": 37 }, "end": { "line": 5, "column": 12, "offset": 43 } } }, "children": [ { "type": "text", "value": "\n\t", "position": { "start": { "line": 5, "column": 13, "offset": 44 }, "end": { "line": 6, "column": 2, "offset": 46 } } }, { "type": "svelteElement", "tagName": "p", "properties": [], "selfClosing": false, "children": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 6, "column": 5, "offset": 49 }, "end": { "line": 6, "column": 8, "offset": 52 } }, "expression": { "type": "svelteExpression", "value": "x", "position": { "start": { "line": 6, "column": 6, "offset": 50 }, "end": { "line": 6, "column": 7, "offset": 51 } } } }, { "type": "text", "value": " is greater than 10", "position": { "start": { "line": 6, "column": 8, "offset": 52 }, "end": { "line": 6, "column": 27, "offset": 71 } } } ], "position": { "start": { "line": 6, "column": 2, "offset": 46 }, "end": { "line": 6, "column": 31, "offset": 75 } } }, { "type": "text", "value": "\n", "position": { "start": { "line": 6, "column": 31, "offset": 75 }, "end": { "line": 7, "column": 1, "offset": 76 } } } ], "position": { "start": { "line": 5, "column": 1, "offset": 32 }, "end": { "line": 7, "column": 1, "offset": 76 } } }, { "type": "svelteBranch", "name": "else if", "expression": { "type": "svelteExpression", "value": "5 > x", "position": { "start": { "line": 7, "column": 11, "offset": 86 }, "end": { "line": 7, "column": 16, "offset": 91 } } }, "children": [ { "type": "text", "value": "\n\t", "position": { "start": { "line": 7, "column": 17, "offset": 92 }, "end": { "line": 8, "column": 2, "offset": 94 } } }, { "type": "svelteElement", "tagName": "p", "properties": [], "selfClosing": false, "children": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 8, "column": 5, "offset": 97 }, "end": { "line": 8, "column": 8, "offset": 100 } }, "expression": { "type": "svelteExpression", "value": "x", "position": { "start": { "line": 8, "column": 6, "offset": 98 }, "end": { "line": 8, "column": 7, "offset": 99 } } } }, { "type": "text", "value": " is less than 5", "position": { "start": { "line": 8, "column": 8, "offset": 100 }, "end": { "line": 8, "column": 23, "offset": 115 } } } ], "position": { "start": { "line": 8, "column": 2, "offset": 94 }, "end": { "line": 8, "column": 27, "offset": 119 } } }, { "type": "text", "value": "\n", "position": { "start": { "line": 8, "column": 27, "offset": 119 }, "end": { "line": 9, "column": 1, "offset": 120 } } } ], "position": { "start": { "line": 7, "column": 1, "offset": 76 }, "end": { "line": 9, "column": 1, "offset": 120 } } }, { "type": "svelteBranch", "name": "else", "expression": { "type": "svelteExpression", "value": "" }, "children": [ { "type": "text", "value": "\n\t", "position": { "start": { "line": 9, "column": 8, "offset": 127 }, "end": { "line": 10, "column": 2, "offset": 129 } } }, { "type": "svelteElement", "tagName": "p", "properties": [], "selfClosing": false, "children": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 10, "column": 5, "offset": 132 }, "end": { "line": 10, "column": 8, "offset": 135 } }, "expression": { "type": "svelteExpression", "value": "x", "position": { "start": { "line": 10, "column": 6, "offset": 133 }, "end": { "line": 10, "column": 7, "offset": 134 } } } }, { "type": "text", "value": " is between 5 and 10", "position": { "start": { "line": 10, "column": 8, "offset": 135 }, "end": { "line": 10, "column": 28, "offset": 155 } } } ], "position": { "start": { "line": 10, "column": 2, "offset": 129 }, "end": { "line": 10, "column": 32, "offset": 159 } } }, { "type": "text", "value": "\n", "position": { "start": { "line": 10, "column": 32, "offset": 159 }, "end": { "line": 11, "column": 1, "offset": 160 } } } ], "position": { "start": { "line": 9, "column": 1, "offset": 120 }, "end": { "line": 11, "column": 1, "offset": 160 } } } ], "position": { "start": { "line": 5, "column": 1, "offset": 32 }, "end": { "line": 11, "column": 6, "offset": 165 } } } ], "position": { "start": { "column": 1, "line": 1, "offset": 0 }, "end": { "line": 11, "column": 6, "offset": 165 } } }