Skip to content

Commit

Permalink
Fix implicit yaml key. (#2241)
Browse files Browse the repository at this point in the history
  • Loading branch information
floitsch authored Apr 22, 2024
1 parent 174f997 commit 1f26517
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/encoding/yaml/parser.toit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions tests/yaml-test.toit
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ main:
test-value-converter
test-reserved
test-indented-block
test-implicit-key

test-stringify:
expect-equals "testing" (yaml.stringify "testing")
Expand Down Expand Up @@ -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

0 comments on commit 1f26517

Please sign in to comment.