From 1f2651730840b161339285e64b397d70995bb0f3 Mon Sep 17 00:00:00 2001 From: Florian Loitsch Date: Mon, 22 Apr 2024 07:19:39 +0200 Subject: [PATCH] Fix implicit yaml key. (#2241) --- lib/encoding/yaml/parser.toit | 2 +- tests/yaml-test.toit | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/encoding/yaml/parser.toit b/lib/encoding/yaml/parser.toit index 44437f4d6..c1ff53b2a 100644 --- a/lib/encoding/yaml/parser.toit +++ b/lib/encoding/yaml/parser.toit @@ -1016,7 +1016,7 @@ class Parser_ extends PegParserBase_: return null ns-plain-safe c/int -> int?: - if c == FLOW-OUT_ or c == BLOCK-OUT_: return ns-plain-safe-out + if c == FLOW-OUT_ or c == BLOCK-KEY_: return ns-plain-safe-out return ns-plain-safe-in ns-plain-safe-out: return ns-char diff --git a/tests/yaml-test.toit b/tests/yaml-test.toit index cb695b614..3b127a687 100644 --- a/tests/yaml-test.toit +++ b/tests/yaml-test.toit @@ -23,6 +23,7 @@ main: test-value-converter test-reserved test-indented-block + test-implicit-key test-stringify: expect-equals "testing" (yaml.stringify "testing") @@ -627,3 +628,11 @@ test-indented-block: } } } result + +test-implicit-key: + result := yaml.parse """ + foo/{bar}: the '{' and '}' is valid in an implicit key. + """ + expect-structural-equals { + "foo/{bar}": "the '{' and '}' is valid in an implicit key." + } result