diff --git a/packages/svelte/tests/parser-legacy/samples/javascript-comments/output.json b/packages/svelte/tests/parser-legacy/samples/javascript-comments/output.json index 3775c48228..97afe8249d 100644 --- a/packages/svelte/tests/parser-legacy/samples/javascript-comments/output.json +++ b/packages/svelte/tests/parser-legacy/samples/javascript-comments/output.json @@ -880,5 +880,423 @@ ], "sourceType": "module" } - } + }, + "comments": [ + { + "type": "Line", + "value": " a leading comment", + "start": 10, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Line", + "value": " a trailing comment", + "start": 45, + "end": 66, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 35 + } + } + }, + { + "type": "Block", + "value": "* a comment ", + "start": 83, + "end": 99, + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 17 + } + } + }, + { + "type": "Line", + "value": " trailing", + "start": 125, + "end": 136, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + { + "type": "Block", + "value": " leading comment 1 ", + "start": 139, + "end": 162, + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 25 + } + } + }, + { + "type": "Block", + "value": " leading comment 2 ", + "start": 165, + "end": 188, + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 25 + } + } + }, + { + "type": "Block", + "value": " leading comment 3 ", + "start": 191, + "end": 214, + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 25 + } + } + }, + { + "type": "Block", + "value": " trailing comment 1 ", + "start": 224, + "end": 248, + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + { + "type": "Block", + "value": " trailing comment 2 ", + "start": 251, + "end": 275, + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 26 + } + } + }, + { + "type": "Block", + "value": " trailing comment 3 ", + "start": 278, + "end": 302, + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 26 + } + } + }, + { + "type": "Line", + "value": " leading comment 1", + "start": 326, + "end": 346, + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 22 + } + } + }, + { + "type": "Line", + "value": " leading comment 2", + "start": 349, + "end": 369, + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 22 + } + } + }, + { + "type": "Line", + "value": " trailing comment 1", + "start": 375, + "end": 396, + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 26 + } + } + }, + { + "type": "Block", + "value": " trailing comment 2 ", + "start": 399, + "end": 423, + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 26 + } + } + }, + { + "type": "Line", + "value": " leading comment 1", + "start": 449, + "end": 469, + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 22 + } + } + }, + { + "type": "Line", + "value": " leading comment 2", + "start": 472, + "end": 492, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 22 + } + } + }, + { + "type": "Line", + "value": " trailing comment 1", + "start": 501, + "end": 522, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 29 + } + } + }, + { + "type": "Block", + "value": " trailing comment 2 ", + "start": 525, + "end": 549, + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 26 + } + } + }, + { + "type": "Line", + "value": " comment", + "start": 584, + "end": 594, + "loc": { + "start": { + "line": 34, + "column": 11 + }, + "end": { + "line": 34, + "column": 21 + } + } + }, + { + "type": "Block", + "value": " another comment ", + "start": 606, + "end": 627, + "loc": { + "start": { + "line": 36, + "column": 2 + }, + "end": { + "line": 36, + "column": 23 + } + } + }, + { + "type": "Line", + "value": " a trailing comment", + "start": 636, + "end": 657, + "loc": { + "start": { + "line": 37, + "column": 8 + }, + "end": { + "line": 37, + "column": 29 + } + } + }, + { + "type": "Block", + "value": " trailing block comment ", + "start": 660, + "end": 688, + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 38, + "column": 30 + } + } + }, + { + "type": "Block", + "value": " leading block comment ", + "start": 696, + "end": 723, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 28 + } + } + }, + { + "type": "Line", + "value": " leading line comment", + "start": 739, + "end": 762, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 25 + } + } + }, + { + "type": "Line", + "value": " trailing line comment", + "start": 770, + "end": 794, + "loc": { + "start": { + "line": 44, + "column": 7 + }, + "end": { + "line": 44, + "column": 31 + } + } + }, + { + "type": "Block", + "value": " trailing block comment ", + "start": 796, + "end": 824, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 29 + } + } + } + ] } diff --git a/packages/svelte/tests/parser-legacy/samples/script-comment-only/output.json b/packages/svelte/tests/parser-legacy/samples/script-comment-only/output.json index 0f7d0b8465..362979da4d 100644 --- a/packages/svelte/tests/parser-legacy/samples/script-comment-only/output.json +++ b/packages/svelte/tests/parser-legacy/samples/script-comment-only/output.json @@ -51,5 +51,23 @@ } ] } - } + }, + "comments": [ + { + "type": "Line", + "value": " TODO write some code", + "start": 10, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 24 + } + } + } + ] }