YAML: simple error when constructing undefined anchors

db4
Jon Harper 2014-04-05 11:20:13 +02:00 committed by John Benediktsson
parent 514d3f72f9
commit 107e67194a
2 changed files with 5 additions and 1 deletions

View File

@ -95,6 +95,9 @@ CONSTANT: test-anchors-obj {
${ test-anchors-obj } [ $ test-anchors 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
! http://pyyaml.org/browser/pyyaml/trunk/tests/data

View File

@ -16,7 +16,8 @@ SYMBOL: anchors
: ?register-anchor ( obj event -- obj )
dupd anchor>> [ anchors get set-at ] [ drop ] if* ;
: 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 )
data>> scalar>>