mirror of https://github.com/sveltejs/svelte
feat: loose parser mode (#14691)
* add loose option * handle unclosed tags * handle unclosed blocks * handle unclosed opening tags * handle invalid expressions * handle invalid blocks * oops * more robust expression parsing * changeset * more unclosed tag handling * types * Update packages/svelte/src/compiler/phases/1-parse/state/element.js --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/14710/head
parent
af9b071622
commit
f0af633263
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': minor
|
||||
---
|
||||
|
||||
feat: provide loose parser mode
|
@ -0,0 +1,13 @@
|
||||
{#if }
|
||||
{:else if }
|
||||
{:else }
|
||||
{/if}
|
||||
|
||||
{#each }
|
||||
{/each}
|
||||
|
||||
{#snippet }
|
||||
{/snippet}
|
||||
|
||||
{#snippet foo}
|
||||
{/snippet}
|
@ -0,0 +1,107 @@
|
||||
{
|
||||
"html": {
|
||||
"type": "Fragment",
|
||||
"start": 0,
|
||||
"end": 102,
|
||||
"children": [
|
||||
{
|
||||
"type": "IfBlock",
|
||||
"start": 0,
|
||||
"end": 33,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 5,
|
||||
"end": 5,
|
||||
"name": ""
|
||||
},
|
||||
"children": [],
|
||||
"else": {
|
||||
"type": "ElseBlock",
|
||||
"start": 18,
|
||||
"end": 28,
|
||||
"children": [
|
||||
{
|
||||
"type": "IfBlock",
|
||||
"start": 18,
|
||||
"end": 33,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 17,
|
||||
"end": 17,
|
||||
"name": ""
|
||||
},
|
||||
"children": [],
|
||||
"else": {
|
||||
"type": "ElseBlock",
|
||||
"start": 27,
|
||||
"end": 28,
|
||||
"children": []
|
||||
},
|
||||
"elseif": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 33,
|
||||
"end": 35,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "EachBlock",
|
||||
"start": 35,
|
||||
"end": 51,
|
||||
"children": [],
|
||||
"context": null,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 42,
|
||||
"end": 42,
|
||||
"name": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 51,
|
||||
"end": 53,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "SnippetBlock",
|
||||
"start": 53,
|
||||
"end": 75,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 63,
|
||||
"end": 63,
|
||||
"name": ""
|
||||
},
|
||||
"parameters": [],
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 75,
|
||||
"end": 77,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "SnippetBlock",
|
||||
"start": 77,
|
||||
"end": 102,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 87,
|
||||
"end": 90,
|
||||
"name": "foo"
|
||||
},
|
||||
"parameters": [],
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<div {}></div>
|
||||
<div foo={}></div>
|
||||
|
||||
<div foo={a.}></div>
|
||||
<div foo={'hi}'.}></div>
|
||||
<Component onclick={() => x.} />
|
||||
|
||||
<input bind:value={a.} />
|
||||
|
||||
asd{a.}asd
|
||||
{foo[bar.]}
|
@ -0,0 +1,242 @@
|
||||
{
|
||||
"html": {
|
||||
"type": "Fragment",
|
||||
"start": 0,
|
||||
"end": 164,
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 0,
|
||||
"end": 14,
|
||||
"name": "div",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 5,
|
||||
"end": 7,
|
||||
"name": "",
|
||||
"value": [
|
||||
{
|
||||
"type": "AttributeShorthand",
|
||||
"start": 6,
|
||||
"end": 6,
|
||||
"expression": {
|
||||
"start": 6,
|
||||
"end": 6,
|
||||
"type": "Identifier",
|
||||
"name": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 14,
|
||||
"end": 15,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 15,
|
||||
"end": 33,
|
||||
"name": "div",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 20,
|
||||
"end": 26,
|
||||
"name": "foo",
|
||||
"value": [
|
||||
{
|
||||
"type": "MustacheTag",
|
||||
"start": 24,
|
||||
"end": 26,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 25,
|
||||
"end": 25,
|
||||
"name": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 33,
|
||||
"end": 35,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 35,
|
||||
"end": 55,
|
||||
"name": "div",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 40,
|
||||
"end": 48,
|
||||
"name": "foo",
|
||||
"value": [
|
||||
{
|
||||
"type": "MustacheTag",
|
||||
"start": 44,
|
||||
"end": 48,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 45,
|
||||
"end": 47,
|
||||
"name": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 55,
|
||||
"end": 56,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 56,
|
||||
"end": 80,
|
||||
"name": "div",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 61,
|
||||
"end": 73,
|
||||
"name": "foo",
|
||||
"value": [
|
||||
{
|
||||
"type": "MustacheTag",
|
||||
"start": 65,
|
||||
"end": 73,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 66,
|
||||
"end": 72,
|
||||
"name": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 80,
|
||||
"end": 81,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
},
|
||||
{
|
||||
"type": "InlineComponent",
|
||||
"start": 81,
|
||||
"end": 113,
|
||||
"name": "Component",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 92,
|
||||
"end": 110,
|
||||
"name": "onclick",
|
||||
"value": [
|
||||
{
|
||||
"type": "MustacheTag",
|
||||
"start": 100,
|
||||
"end": 110,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 101,
|
||||
"end": 109,
|
||||
"name": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 113,
|
||||
"end": 115,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 115,
|
||||
"end": 140,
|
||||
"name": "input",
|
||||
"attributes": [
|
||||
{
|
||||
"start": 122,
|
||||
"end": 137,
|
||||
"type": "Binding",
|
||||
"name": "value",
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 134,
|
||||
"end": 136,
|
||||
"name": ""
|
||||
},
|
||||
"modifiers": []
|
||||
}
|
||||
],
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 140,
|
||||
"end": 145,
|
||||
"raw": "\n\nasd",
|
||||
"data": "\n\nasd"
|
||||
},
|
||||
{
|
||||
"type": "MustacheTag",
|
||||
"start": 145,
|
||||
"end": 149,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 146,
|
||||
"end": 148,
|
||||
"name": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 149,
|
||||
"end": 153,
|
||||
"raw": "asd\n",
|
||||
"data": "asd\n"
|
||||
},
|
||||
{
|
||||
"type": "MustacheTag",
|
||||
"start": 153,
|
||||
"end": 164,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 154,
|
||||
"end": 163,
|
||||
"name": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<div>
|
||||
{#if foo}
|
||||
</div>
|
||||
|
||||
<Comp>
|
||||
{#key bar}
|
||||
</Comp>
|
||||
|
||||
<div>
|
||||
{#if foo}
|
||||
{#if bar}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if foo}
|
||||
{#key bar}
|
||||
{/if}
|
||||
|
||||
{#each x as y}
|
||||
<p>hi</p>
|
@ -0,0 +1,276 @@
|
||||
{
|
||||
"html": {
|
||||
"type": "Fragment",
|
||||
"start": 0,
|
||||
"end": 150,
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 0,
|
||||
"end": 23,
|
||||
"name": "div",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 5,
|
||||
"end": 7,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
},
|
||||
{
|
||||
"type": "IfBlock",
|
||||
"start": 7,
|
||||
"end": 17,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 12,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 23,
|
||||
"end": 25,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "InlineComponent",
|
||||
"start": 25,
|
||||
"end": 51,
|
||||
"name": "Comp",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 31,
|
||||
"end": 33,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
},
|
||||
{
|
||||
"type": "KeyBlock",
|
||||
"start": 33,
|
||||
"end": 44,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 39,
|
||||
"end": 42,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 10
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
},
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 51,
|
||||
"end": 53,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 53,
|
||||
"end": 95,
|
||||
"name": "div",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 58,
|
||||
"end": 60,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
},
|
||||
{
|
||||
"type": "IfBlock",
|
||||
"start": 60,
|
||||
"end": 89,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 65,
|
||||
"end": 68,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 10,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 10,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "IfBlock",
|
||||
"start": 72,
|
||||
"end": 88,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 77,
|
||||
"end": 80,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 11,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 11,
|
||||
"column": 10
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
},
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 95,
|
||||
"end": 97,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "IfBlock",
|
||||
"start": 97,
|
||||
"end": 124,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 102,
|
||||
"end": 105,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 15,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 15,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "KeyBlock",
|
||||
"start": 108,
|
||||
"end": 119,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 114,
|
||||
"end": 117,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 10
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
},
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 124,
|
||||
"end": 126,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "EachBlock",
|
||||
"start": 126,
|
||||
"end": 150,
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 141,
|
||||
"end": 150,
|
||||
"name": "p",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 144,
|
||||
"end": 146,
|
||||
"raw": "hi",
|
||||
"data": "hi"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"context": {
|
||||
"type": "Identifier",
|
||||
"name": "y",
|
||||
"start": 138,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 19,
|
||||
"column": 12,
|
||||
"character": 138
|
||||
},
|
||||
"end": {
|
||||
"line": 19,
|
||||
"column": 13,
|
||||
"character": 139
|
||||
}
|
||||
},
|
||||
"end": 139
|
||||
},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 133,
|
||||
"end": 134,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 19,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 19,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"name": "x"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<div>
|
||||
<Comp foo={bar}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span foo={bar}
|
||||
</div>
|
||||
|
||||
{#if foo}
|
||||
<Comp foo={bar}
|
||||
{/if}
|
||||
|
||||
{#if foo}
|
||||
<Comp foo={bar}
|
||||
{#if bar}
|
||||
{bar}
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<div foo={bar}
|
@ -0,0 +1,349 @@
|
||||
{
|
||||
"html": {
|
||||
"type": "Fragment",
|
||||
"start": 0,
|
||||
"end": 170,
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 0,
|
||||
"end": 29,
|
||||
"name": "div",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 5,
|
||||
"end": 7,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
},
|
||||
{
|
||||
"type": "InlineComponent",
|
||||
"start": 7,
|
||||
"end": 23,
|
||||
"name": "Comp",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 13,
|
||||
"end": 22,
|
||||
"name": "foo",
|
||||
"value": [
|
||||
{
|
||||
"type": "MustacheTag",
|
||||
"start": 17,
|
||||
"end": 22,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 18,
|
||||
"end": 21,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 29,
|
||||
"end": 31,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 31,
|
||||
"end": 60,
|
||||
"name": "div",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 36,
|
||||
"end": 38,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 38,
|
||||
"end": 54,
|
||||
"name": "span",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 44,
|
||||
"end": 53,
|
||||
"name": "foo",
|
||||
"value": [
|
||||
{
|
||||
"type": "MustacheTag",
|
||||
"start": 48,
|
||||
"end": 53,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 49,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 60,
|
||||
"end": 62,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "IfBlock",
|
||||
"start": 62,
|
||||
"end": 94,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 67,
|
||||
"end": 70,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 9,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "InlineComponent",
|
||||
"start": 73,
|
||||
"end": 89,
|
||||
"name": "Comp",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 79,
|
||||
"end": 88,
|
||||
"name": "foo",
|
||||
"value": [
|
||||
{
|
||||
"type": "MustacheTag",
|
||||
"start": 83,
|
||||
"end": 88,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 84,
|
||||
"end": 87,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 10,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 10,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 94,
|
||||
"end": 96,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "IfBlock",
|
||||
"start": 96,
|
||||
"end": 154,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 101,
|
||||
"end": 104,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 13,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 13,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "InlineComponent",
|
||||
"start": 107,
|
||||
"end": 124,
|
||||
"name": "Comp",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 113,
|
||||
"end": 122,
|
||||
"name": "foo",
|
||||
"value": [
|
||||
{
|
||||
"type": "MustacheTag",
|
||||
"start": 117,
|
||||
"end": 122,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 118,
|
||||
"end": 121,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 14,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"type": "IfBlock",
|
||||
"start": 124,
|
||||
"end": 148,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 129,
|
||||
"end": 132,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 15,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 15,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "MustacheTag",
|
||||
"start": 136,
|
||||
"end": 141,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 137,
|
||||
"end": 140,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 6
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 154,
|
||||
"end": 156,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 156,
|
||||
"end": 170,
|
||||
"name": "div",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 161,
|
||||
"end": 170,
|
||||
"name": "foo",
|
||||
"value": [
|
||||
{
|
||||
"type": "MustacheTag",
|
||||
"start": 165,
|
||||
"end": 170,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 166,
|
||||
"end": 169,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 20,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 20,
|
||||
"column": 13
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<div>
|
||||
<Comp>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Comp foo={bar}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span
|
||||
</div>
|
||||
|
||||
{#if foo}
|
||||
<div>
|
||||
{/if}
|
||||
|
||||
{#if foo}
|
||||
<Comp foo={bar}
|
||||
{/if}
|
||||
|
||||
<div>
|
||||
<p>hi</p>
|
||||
|
||||
<open-ended
|
@ -0,0 +1,301 @@
|
||||
{
|
||||
"html": {
|
||||
"type": "Fragment",
|
||||
"start": 0,
|
||||
"end": 160,
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 0,
|
||||
"end": 20,
|
||||
"name": "div",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 5,
|
||||
"end": 7,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
},
|
||||
{
|
||||
"type": "InlineComponent",
|
||||
"start": 7,
|
||||
"end": 14,
|
||||
"name": "Comp",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 13,
|
||||
"end": 14,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 20,
|
||||
"end": 22,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 22,
|
||||
"end": 51,
|
||||
"name": "div",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 27,
|
||||
"end": 29,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
},
|
||||
{
|
||||
"type": "InlineComponent",
|
||||
"start": 29,
|
||||
"end": 45,
|
||||
"name": "Comp",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 35,
|
||||
"end": 44,
|
||||
"name": "foo",
|
||||
"value": [
|
||||
{
|
||||
"type": "MustacheTag",
|
||||
"start": 39,
|
||||
"end": 44,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 40,
|
||||
"end": 43,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 51,
|
||||
"end": 53,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 53,
|
||||
"end": 72,
|
||||
"name": "div",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 58,
|
||||
"end": 60,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 60,
|
||||
"end": 66,
|
||||
"name": "span",
|
||||
"attributes": [],
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 72,
|
||||
"end": 74,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "IfBlock",
|
||||
"start": 74,
|
||||
"end": 96,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 79,
|
||||
"end": 82,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 13,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 13,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 85,
|
||||
"end": 91,
|
||||
"name": "div",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 90,
|
||||
"end": 91,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 96,
|
||||
"end": 98,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "IfBlock",
|
||||
"start": 98,
|
||||
"end": 130,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 103,
|
||||
"end": 106,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 17,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 17,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "InlineComponent",
|
||||
"start": 109,
|
||||
"end": 125,
|
||||
"name": "Comp",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 115,
|
||||
"end": 124,
|
||||
"name": "foo",
|
||||
"value": [
|
||||
{
|
||||
"type": "MustacheTag",
|
||||
"start": 119,
|
||||
"end": 124,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 120,
|
||||
"end": 123,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 18,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 18,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 130,
|
||||
"end": 132,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 132,
|
||||
"end": 160,
|
||||
"name": "div",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 137,
|
||||
"end": 138,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 138,
|
||||
"end": 147,
|
||||
"name": "p",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 141,
|
||||
"end": 143,
|
||||
"raw": "hi",
|
||||
"data": "hi"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 147,
|
||||
"end": 149,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"start": 149,
|
||||
"end": 160,
|
||||
"name": "open-ended",
|
||||
"attributes": [],
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
{#if }
|
||||
{:else if }
|
||||
{:else }
|
||||
{/if}
|
||||
|
||||
{#each }
|
||||
{/each}
|
||||
|
||||
{#snippet }
|
||||
{/snippet}
|
||||
|
||||
{#snippet foo}
|
||||
{/snippet}
|
@ -0,0 +1,171 @@
|
||||
{
|
||||
"css": null,
|
||||
"js": [],
|
||||
"start": 0,
|
||||
"end": 102,
|
||||
"type": "Root",
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "IfBlock",
|
||||
"elseif": false,
|
||||
"start": 0,
|
||||
"end": 33,
|
||||
"test": {
|
||||
"type": "Identifier",
|
||||
"start": 5,
|
||||
"end": 5,
|
||||
"name": ""
|
||||
},
|
||||
"consequent": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 6,
|
||||
"end": 7,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
}
|
||||
]
|
||||
},
|
||||
"alternate": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"start": 7,
|
||||
"end": 33,
|
||||
"type": "IfBlock",
|
||||
"elseif": true,
|
||||
"test": {
|
||||
"type": "Identifier",
|
||||
"start": 17,
|
||||
"end": 17,
|
||||
"name": ""
|
||||
},
|
||||
"consequent": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 18,
|
||||
"end": 19,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
}
|
||||
]
|
||||
},
|
||||
"alternate": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 27,
|
||||
"end": 28,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 33,
|
||||
"end": 35,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "EachBlock",
|
||||
"start": 35,
|
||||
"end": 51,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 42,
|
||||
"end": 42,
|
||||
"name": ""
|
||||
},
|
||||
"body": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 43,
|
||||
"end": 44,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
}
|
||||
]
|
||||
},
|
||||
"context": null
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 51,
|
||||
"end": 53,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "SnippetBlock",
|
||||
"start": 53,
|
||||
"end": 75,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 63,
|
||||
"end": 63,
|
||||
"name": ""
|
||||
},
|
||||
"parameters": [],
|
||||
"body": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 64,
|
||||
"end": 65,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 75,
|
||||
"end": 77,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "SnippetBlock",
|
||||
"start": 77,
|
||||
"end": 102,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 87,
|
||||
"end": 90,
|
||||
"name": "foo"
|
||||
},
|
||||
"parameters": [],
|
||||
"body": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 91,
|
||||
"end": 92,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": null
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<div {}></div>
|
||||
<div foo={}></div>
|
||||
|
||||
<div foo={a.}></div>
|
||||
<div foo={'hi}'.}></div>
|
||||
<Component onclick={() => x.} />
|
||||
|
||||
<input bind:value={a.} />
|
||||
|
||||
asd{a.}asd
|
||||
{foo[bar.]}
|
@ -0,0 +1,254 @@
|
||||
{
|
||||
"css": null,
|
||||
"js": [],
|
||||
"start": 0,
|
||||
"end": 164,
|
||||
"type": "Root",
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "RegularElement",
|
||||
"start": 0,
|
||||
"end": 14,
|
||||
"name": "div",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 5,
|
||||
"end": 7,
|
||||
"name": "",
|
||||
"value": {
|
||||
"type": "ExpressionTag",
|
||||
"start": 6,
|
||||
"end": 6,
|
||||
"expression": {
|
||||
"start": 6,
|
||||
"end": 6,
|
||||
"type": "Identifier",
|
||||
"name": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 14,
|
||||
"end": 15,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
},
|
||||
{
|
||||
"type": "RegularElement",
|
||||
"start": 15,
|
||||
"end": 33,
|
||||
"name": "div",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 20,
|
||||
"end": 26,
|
||||
"name": "foo",
|
||||
"value": {
|
||||
"type": "ExpressionTag",
|
||||
"start": 24,
|
||||
"end": 26,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 25,
|
||||
"end": 25,
|
||||
"name": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 33,
|
||||
"end": 35,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "RegularElement",
|
||||
"start": 35,
|
||||
"end": 55,
|
||||
"name": "div",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 40,
|
||||
"end": 48,
|
||||
"name": "foo",
|
||||
"value": {
|
||||
"type": "ExpressionTag",
|
||||
"start": 44,
|
||||
"end": 48,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 45,
|
||||
"end": 47,
|
||||
"name": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 55,
|
||||
"end": 56,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
},
|
||||
{
|
||||
"type": "RegularElement",
|
||||
"start": 56,
|
||||
"end": 80,
|
||||
"name": "div",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 61,
|
||||
"end": 73,
|
||||
"name": "foo",
|
||||
"value": {
|
||||
"type": "ExpressionTag",
|
||||
"start": 65,
|
||||
"end": 73,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 66,
|
||||
"end": 72,
|
||||
"name": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 80,
|
||||
"end": 81,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
},
|
||||
{
|
||||
"type": "Component",
|
||||
"start": 81,
|
||||
"end": 113,
|
||||
"name": "Component",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 92,
|
||||
"end": 110,
|
||||
"name": "onclick",
|
||||
"value": {
|
||||
"type": "ExpressionTag",
|
||||
"start": 100,
|
||||
"end": 110,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 101,
|
||||
"end": 109,
|
||||
"name": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 113,
|
||||
"end": 115,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "RegularElement",
|
||||
"start": 115,
|
||||
"end": 140,
|
||||
"name": "input",
|
||||
"attributes": [
|
||||
{
|
||||
"start": 122,
|
||||
"end": 137,
|
||||
"type": "BindDirective",
|
||||
"name": "value",
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 134,
|
||||
"end": 136,
|
||||
"name": ""
|
||||
},
|
||||
"modifiers": []
|
||||
}
|
||||
],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 140,
|
||||
"end": 145,
|
||||
"raw": "\n\nasd",
|
||||
"data": "\n\nasd"
|
||||
},
|
||||
{
|
||||
"type": "ExpressionTag",
|
||||
"start": 145,
|
||||
"end": 149,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 146,
|
||||
"end": 148,
|
||||
"name": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 149,
|
||||
"end": 153,
|
||||
"raw": "asd\n",
|
||||
"data": "asd\n"
|
||||
},
|
||||
{
|
||||
"type": "ExpressionTag",
|
||||
"start": 153,
|
||||
"end": 164,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 154,
|
||||
"end": 163,
|
||||
"name": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": null
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<div>
|
||||
<Comp foo={bar}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span foo={bar}
|
||||
</div>
|
||||
|
||||
{#if foo}
|
||||
<Comp foo={bar}
|
||||
{/if}
|
||||
|
||||
{#if foo}
|
||||
<Comp foo={bar}
|
||||
{#if bar}
|
||||
{bar}
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<div foo={bar}
|
@ -0,0 +1,414 @@
|
||||
{
|
||||
"css": null,
|
||||
"js": [],
|
||||
"start": 0,
|
||||
"end": 170,
|
||||
"type": "Root",
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "RegularElement",
|
||||
"start": 0,
|
||||
"end": 29,
|
||||
"name": "div",
|
||||
"attributes": [],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 5,
|
||||
"end": 7,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
},
|
||||
{
|
||||
"type": "Component",
|
||||
"start": 7,
|
||||
"end": 23,
|
||||
"name": "Comp",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 13,
|
||||
"end": 22,
|
||||
"name": "foo",
|
||||
"value": {
|
||||
"type": "ExpressionTag",
|
||||
"start": 17,
|
||||
"end": 22,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 18,
|
||||
"end": 21,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 29,
|
||||
"end": 31,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "RegularElement",
|
||||
"start": 31,
|
||||
"end": 60,
|
||||
"name": "div",
|
||||
"attributes": [],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 36,
|
||||
"end": 38,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
},
|
||||
{
|
||||
"type": "RegularElement",
|
||||
"start": 38,
|
||||
"end": 54,
|
||||
"name": "span",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 44,
|
||||
"end": 53,
|
||||
"name": "foo",
|
||||
"value": {
|
||||
"type": "ExpressionTag",
|
||||
"start": 48,
|
||||
"end": 53,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 49,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 60,
|
||||
"end": 62,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "IfBlock",
|
||||
"elseif": false,
|
||||
"start": 62,
|
||||
"end": 94,
|
||||
"test": {
|
||||
"type": "Identifier",
|
||||
"start": 67,
|
||||
"end": 70,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 9,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"consequent": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 71,
|
||||
"end": 73,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
},
|
||||
{
|
||||
"type": "Component",
|
||||
"start": 73,
|
||||
"end": 89,
|
||||
"name": "Comp",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 79,
|
||||
"end": 88,
|
||||
"name": "foo",
|
||||
"value": {
|
||||
"type": "ExpressionTag",
|
||||
"start": 83,
|
||||
"end": 88,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 84,
|
||||
"end": 87,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 10,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 10,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"alternate": null
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 94,
|
||||
"end": 96,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "IfBlock",
|
||||
"elseif": false,
|
||||
"start": 96,
|
||||
"end": 154,
|
||||
"test": {
|
||||
"type": "Identifier",
|
||||
"start": 101,
|
||||
"end": 104,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 13,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 13,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"consequent": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 105,
|
||||
"end": 107,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
},
|
||||
{
|
||||
"type": "Component",
|
||||
"start": 107,
|
||||
"end": 124,
|
||||
"name": "Comp",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 113,
|
||||
"end": 122,
|
||||
"name": "foo",
|
||||
"value": {
|
||||
"type": "ExpressionTag",
|
||||
"start": 117,
|
||||
"end": 122,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 118,
|
||||
"end": 121,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 14,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "IfBlock",
|
||||
"elseif": false,
|
||||
"start": 124,
|
||||
"end": 148,
|
||||
"test": {
|
||||
"type": "Identifier",
|
||||
"start": 129,
|
||||
"end": 132,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 15,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 15,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
},
|
||||
"consequent": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 133,
|
||||
"end": 136,
|
||||
"raw": "\n\t\t",
|
||||
"data": "\n\t\t"
|
||||
},
|
||||
{
|
||||
"type": "ExpressionTag",
|
||||
"start": 136,
|
||||
"end": 141,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 137,
|
||||
"end": 140,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 6
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 141,
|
||||
"end": 143,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
}
|
||||
]
|
||||
},
|
||||
"alternate": null
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 148,
|
||||
"end": 149,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
}
|
||||
]
|
||||
},
|
||||
"alternate": null
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 154,
|
||||
"end": 156,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "RegularElement",
|
||||
"start": 156,
|
||||
"end": 170,
|
||||
"name": "div",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 161,
|
||||
"end": 170,
|
||||
"name": "foo",
|
||||
"value": {
|
||||
"type": "ExpressionTag",
|
||||
"start": 165,
|
||||
"end": 170,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 166,
|
||||
"end": 169,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 20,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 20,
|
||||
"column": 13
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": null
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<div>
|
||||
<Comp>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Comp foo={bar}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span
|
||||
</div>
|
||||
|
||||
{#if foo}
|
||||
<div>
|
||||
{/if}
|
||||
|
||||
{#if foo}
|
||||
<Comp foo={bar}
|
||||
{/if}
|
||||
|
||||
<div>
|
||||
<p>hi</p>
|
||||
|
||||
<open-ended
|
@ -0,0 +1,358 @@
|
||||
{
|
||||
"css": null,
|
||||
"js": [],
|
||||
"start": 0,
|
||||
"end": 160,
|
||||
"type": "Root",
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "RegularElement",
|
||||
"start": 0,
|
||||
"end": 20,
|
||||
"name": "div",
|
||||
"attributes": [],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 5,
|
||||
"end": 7,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
},
|
||||
{
|
||||
"type": "Component",
|
||||
"start": 7,
|
||||
"end": 14,
|
||||
"name": "Comp",
|
||||
"attributes": [],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 13,
|
||||
"end": 14,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 20,
|
||||
"end": 22,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "RegularElement",
|
||||
"start": 22,
|
||||
"end": 51,
|
||||
"name": "div",
|
||||
"attributes": [],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 27,
|
||||
"end": 29,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
},
|
||||
{
|
||||
"type": "Component",
|
||||
"start": 29,
|
||||
"end": 45,
|
||||
"name": "Comp",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 35,
|
||||
"end": 44,
|
||||
"name": "foo",
|
||||
"value": {
|
||||
"type": "ExpressionTag",
|
||||
"start": 39,
|
||||
"end": 44,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 40,
|
||||
"end": 43,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 51,
|
||||
"end": 53,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "RegularElement",
|
||||
"start": 53,
|
||||
"end": 72,
|
||||
"name": "div",
|
||||
"attributes": [],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 58,
|
||||
"end": 60,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
},
|
||||
{
|
||||
"type": "RegularElement",
|
||||
"start": 60,
|
||||
"end": 66,
|
||||
"name": "span",
|
||||
"attributes": [],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 72,
|
||||
"end": 74,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "IfBlock",
|
||||
"elseif": false,
|
||||
"start": 74,
|
||||
"end": 96,
|
||||
"test": {
|
||||
"type": "Identifier",
|
||||
"start": 79,
|
||||
"end": 82,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 13,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 13,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"consequent": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 83,
|
||||
"end": 85,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
},
|
||||
{
|
||||
"type": "RegularElement",
|
||||
"start": 85,
|
||||
"end": 91,
|
||||
"name": "div",
|
||||
"attributes": [],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 90,
|
||||
"end": 91,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"alternate": null
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 96,
|
||||
"end": 98,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "IfBlock",
|
||||
"elseif": false,
|
||||
"start": 98,
|
||||
"end": 130,
|
||||
"test": {
|
||||
"type": "Identifier",
|
||||
"start": 103,
|
||||
"end": 106,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 17,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 17,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"consequent": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 107,
|
||||
"end": 109,
|
||||
"raw": "\n\t",
|
||||
"data": "\n\t"
|
||||
},
|
||||
{
|
||||
"type": "Component",
|
||||
"start": 109,
|
||||
"end": 125,
|
||||
"name": "Comp",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"start": 115,
|
||||
"end": 124,
|
||||
"name": "foo",
|
||||
"value": {
|
||||
"type": "ExpressionTag",
|
||||
"start": 119,
|
||||
"end": 124,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 120,
|
||||
"end": 123,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 18,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 18,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"alternate": null
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 130,
|
||||
"end": 132,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "RegularElement",
|
||||
"start": 132,
|
||||
"end": 160,
|
||||
"name": "div",
|
||||
"attributes": [],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 137,
|
||||
"end": 138,
|
||||
"raw": "\n",
|
||||
"data": "\n"
|
||||
},
|
||||
{
|
||||
"type": "RegularElement",
|
||||
"start": 138,
|
||||
"end": 147,
|
||||
"name": "p",
|
||||
"attributes": [],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 141,
|
||||
"end": 143,
|
||||
"raw": "hi",
|
||||
"data": "hi"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 147,
|
||||
"end": 149,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "RegularElement",
|
||||
"start": 149,
|
||||
"end": 160,
|
||||
"name": "open-ended",
|
||||
"attributes": [],
|
||||
"fragment": {
|
||||
"type": "Fragment",
|
||||
"nodes": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": null
|
||||
}
|
Loading…
Reference in new issue