diff --git a/__snapshots__/packages/core/test-out/parser/util.spec.js b/__snapshots__/packages/core/test-out/parser/util.spec.js index bc2cd9e9a..b9c3785ee 100644 --- a/__snapshots__/packages/core/test-out/parser/util.spec.js +++ b/__snapshots__/packages/core/test-out/parser/util.spec.js @@ -197,6 +197,18 @@ exports['concatOnTrailingBackslash() Parse "tru⧵↓e" 1'] = { "errors": [] } +exports['concatOnTrailingBackslash() Parse "tru⧵↓↓e" 1'] = { + "node": { + "type": "boolean", + "range": { + "start": 0, + "end": 7 + }, + "value": true + }, + "errors": [] +} + exports['dumpErrors() should not output errors when wrapped with `dumpErrors()` 1'] = { "node": { "type": "boolean", diff --git a/__snapshots__/packages/java-edition/test-out/mcfunction/parser/argument/minecraftComponent.spec.js b/__snapshots__/packages/java-edition/test-out/mcfunction/parser/argument/minecraftComponent.spec.js index 77af2d2b5..3e18c5e13 100644 --- a/__snapshots__/packages/java-edition/test-out/mcfunction/parser/argument/minecraftComponent.spec.js +++ b/__snapshots__/packages/java-edition/test-out/mcfunction/parser/argument/minecraftComponent.spec.js @@ -170,6 +170,68 @@ exports['mcfunction argument minecraft:component Parse "["hello ⧵ ↓world"]" "errors": [] } +exports['mcfunction argument minecraft:component Parse "["hello⧵↓↓world"]" 1'] = { + "node": { + "type": "json:array", + "range": { + "start": 0, + "end": 17 + }, + "children": [ + { + "type": "item", + "range": { + "start": 1, + "end": 16 + }, + "children": [ + { + "type": "json:string", + "range": { + "start": 1, + "end": 16 + }, + "value": "helloworld", + "valueMap": [ + { + "inner": { + "start": 0, + "end": 0 + }, + "outer": { + "start": 2, + "end": 2 + } + } + ] + } + ], + "value": { + "type": "json:string", + "range": { + "start": 1, + "end": 16 + }, + "value": "helloworld", + "valueMap": [ + { + "inner": { + "start": 0, + "end": 0 + }, + "outer": { + "start": 2, + "end": 2 + } + } + ] + } + } + ] + }, + "errors": [] +} + exports['mcfunction argument minecraft:component Parse "["⧵u12⧵ ↓ 34"]" 1'] = { "node": { "type": "json:array", diff --git a/__snapshots__/packages/mcfunction/test-out/parser/command.spec.js b/__snapshots__/packages/mcfunction/test-out/parser/command.spec.js index b21a9b1fc..06c0358c9 100644 --- a/__snapshots__/packages/mcfunction/test-out/parser/command.spec.js +++ b/__snapshots__/packages/mcfunction/test-out/parser/command.spec.js @@ -677,6 +677,60 @@ exports['mcfunction parser command() Parse "sa⧵↓y hi" 1'] = { "errors": [] } +exports['mcfunction parser command() Parse "sa⧵↓↓y h⧵ ↓ i" 1'] = { + "node": { + "type": "mcfunction:command", + "range": { + "start": 0, + "end": 13 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 0, + "end": 6 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 0, + "end": 6 + }, + "value": "say" + } + ], + "path": [ + "say" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 7, + "end": 13 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 7, + "end": 13 + }, + "value": "hi" + } + ], + "path": [ + "say", + "hi" + ] + } + ] + }, + "errors": [] +} + exports['mcfunction parser command() Should not exceed max call stack 1'] = { "node": "OMITTED", "errors": [ diff --git a/packages/core/test/parser/util.spec.ts b/packages/core/test/parser/util.spec.ts index 5375db823..93d867526 100644 --- a/packages/core/test/parser/util.spec.ts +++ b/packages/core/test/parser/util.spec.ts @@ -145,6 +145,7 @@ describe('concatOnTrailingBackslash()', () => { { content: 'tru\\ \n e' }, { content: 'tru\\ \n \\\n e' }, { content: 'tru\\e \\ \n e' }, + { content: 'tru\\\n\ne' }, ], }, ] diff --git a/packages/java-edition/test/mcfunction/parser/argument.spec.ts b/packages/java-edition/test/mcfunction/parser/argument.spec.ts index d62433302..52544cb9c 100644 --- a/packages/java-edition/test/mcfunction/parser/argument.spec.ts +++ b/packages/java-edition/test/mcfunction/parser/argument.spec.ts @@ -80,6 +80,7 @@ const Suites: Partial< '{"text":"hello world"}', '[""]', '["hello \\ \nworld"]', + '["hello\\\n\nworld"]', '["\\u12\\ \n 34"]', '["\\uab\\ \n nd"]', ], diff --git a/packages/mcfunction/test/parser/command.spec.ts b/packages/mcfunction/test/parser/command.spec.ts index df2a4e756..d41f4f91b 100644 --- a/packages/mcfunction/test/parser/command.spec.ts +++ b/packages/mcfunction/test/parser/command.spec.ts @@ -53,6 +53,7 @@ describe('mcfunction parser command()', () => { { content: 'sa\\\ny hi' }, { content: 'sa\\ \n y hi' }, { content: 'sa\\ \n y h\\ \n i' }, + { content: 'sa\\\n\ny h\\ \n i' }, ] for (const { content } of cases) { it(`Parse "${showWhitespaceGlyph(content)}"`, () => {