From b626aff40da287707d03c8d451989fb91ac5f9c3 Mon Sep 17 00:00:00 2001 From: SPGoding <15277496+SPGoding@users.noreply.github.com> Date: Fri, 17 May 2024 08:11:37 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Allow=20single=20quotes=20in=20N?= =?UTF-8?q?BT=20paths=20(#1150)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../packages/nbt/test-out/parser/path.spec.js | 11 +---------- packages/nbt/src/parser/path.ts | 5 +++-- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/__snapshots__/packages/nbt/test-out/parser/path.spec.js b/__snapshots__/packages/nbt/test-out/parser/path.spec.js index da22f937c..88e97dbb6 100644 --- a/__snapshots__/packages/nbt/test-out/parser/path.spec.js +++ b/__snapshots__/packages/nbt/test-out/parser/path.spec.js @@ -82,16 +82,7 @@ exports['nbt path() Parse "\'foo\'" 1'] = { "end": 5 } }, - "errors": [ - { - "range": { - "start": 0, - "end": 0 - }, - "message": "Only “\"” can be used to quote strings here", - "severity": 3 - } - ] + "errors": [] } exports['nbt path() Parse "[ ]" 1'] = { diff --git a/packages/nbt/src/parser/path.ts b/packages/nbt/src/parser/path.ts index 3e112068d..c0db21d48 100644 --- a/packages/nbt/src/parser/path.ts +++ b/packages/nbt/src/parser/path.ts @@ -87,8 +87,9 @@ const key: PartParser = (children, src, ctx) => { const node = core.string({ colorTokenType: 'property', escapable: {}, - // No single quotes: https://bugs.mojang.com/browse/MC-175504 - quotes: ['"'], + // Single quotes supported since 1.20 Pre-release 2 (roughly pack format 15) + // https://bugs.mojang.com/browse/MC-175504 + quotes: ['"', "'"], unquotable: { blockList: new Set([ '\n',