YAML: support non-scalar keys

db4
Jon Harper 2014-02-15 18:28:15 +01:00 committed by John Benediktsson
parent 43f9318489
commit eb1987924e
2 changed files with 15 additions and 2 deletions

View File

@ -35,3 +35,13 @@ CONSTANT: test-represented-string """--- !!seq
${ test-obj } [ $ test-string yaml> ] unit-test
${ test-represented-string } [ $ test-obj >yaml ] unit-test
${ test-represented-string } [ $ test-represented-string yaml> >yaml ] unit-test
CONSTANT: complex-key H{ { { "4" } "3" } }
CONSTANT: complex-key-represented """--- !!map
? !!seq
- !!str 4
: !!str 3
...
"""
${ complex-key } [ $ complex-key-represented yaml> ] unit-test

View File

@ -34,9 +34,12 @@ DEFER: parse-mapping
YAML_MAPPING_END_EVENT = [
t done! f f
] [
event event>scalar t
event ?scalar-value
] if
] with-destructors [ parser event next-value swap ,, ] [ drop ] if ] until
] with-destructors 2dup or [
[ nip [ parser event ] dip next-complex-value ] when*
parser event next-value swap ,,
] [ 2drop ] if ] until
] H{ } make ;
:: parse-sequence ( parser event -- seq ) [
f :> done!