YAML: support non-scalar keys
parent
43f9318489
commit
eb1987924e
|
@ -35,3 +35,13 @@ CONSTANT: test-represented-string """--- !!seq
|
||||||
${ test-obj } [ $ test-string yaml> ] unit-test
|
${ test-obj } [ $ test-string yaml> ] unit-test
|
||||||
${ test-represented-string } [ $ test-obj >yaml ] unit-test
|
${ test-represented-string } [ $ test-obj >yaml ] unit-test
|
||||||
${ test-represented-string } [ $ test-represented-string yaml> >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
|
||||||
|
|
|
@ -34,9 +34,12 @@ DEFER: parse-mapping
|
||||||
YAML_MAPPING_END_EVENT = [
|
YAML_MAPPING_END_EVENT = [
|
||||||
t done! f f
|
t done! f f
|
||||||
] [
|
] [
|
||||||
event event>scalar t
|
event ?scalar-value
|
||||||
] if
|
] 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 ;
|
] H{ } make ;
|
||||||
:: parse-sequence ( parser event -- seq ) [
|
:: parse-sequence ( parser event -- seq ) [
|
||||||
f :> done!
|
f :> done!
|
||||||
|
|
Loading…
Reference in New Issue