YAML: simple error when constructing undefined anchors
parent
514d3f72f9
commit
107e67194a
|
@ -95,6 +95,9 @@ CONSTANT: test-anchors-obj {
|
||||||
${ test-anchors-obj } [ $ test-anchors yaml> ] unit-test
|
${ test-anchors-obj } [ $ test-anchors yaml> ] unit-test
|
||||||
${ test-anchors-obj } [ $ test-anchors-obj >yaml yaml> ] unit-test
|
${ test-anchors-obj } [ $ test-anchors-obj >yaml yaml> ] unit-test
|
||||||
|
|
||||||
|
! Missing anchors
|
||||||
|
[ "*foo" yaml> ] [ "No previous anchor" = ] must-fail-with
|
||||||
|
|
||||||
! Lifted from pyyaml
|
! Lifted from pyyaml
|
||||||
! http://pyyaml.org/browser/pyyaml/trunk/tests/data
|
! http://pyyaml.org/browser/pyyaml/trunk/tests/data
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,8 @@ SYMBOL: anchors
|
||||||
: ?register-anchor ( obj event -- obj )
|
: ?register-anchor ( obj event -- obj )
|
||||||
dupd anchor>> [ anchors get set-at ] [ drop ] if* ;
|
dupd anchor>> [ anchors get set-at ] [ drop ] if* ;
|
||||||
: deref-anchor ( event -- obj )
|
: deref-anchor ( event -- obj )
|
||||||
data>> alias>> anchor>> anchors get at ;
|
data>> alias>> anchor>> anchors get at*
|
||||||
|
[ "No previous anchor" throw ] unless ;
|
||||||
|
|
||||||
: event>scalar ( event -- obj )
|
: event>scalar ( event -- obj )
|
||||||
data>> scalar>>
|
data>> scalar>>
|
||||||
|
|
Loading…
Reference in New Issue