diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2009-09-27 15:20:14 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2009-09-27 15:20:14 -0700 |
commit | e01fc9ede64a82bcd1fc60ba5aba6c02e892e2f6 (patch) | |
tree | 6ca6ff72dc51b29ea3d90ba139078cb5678784d5 | |
parent | 56c5edfd2141145f2c3aa1f7010cf2e41a7e8662 (diff) | |
download | psych-e01fc9ede64a82bcd1fc60ba5aba6c02e892e2f6.zip |
end_sequence supported
-rw-r--r-- | ext/psych/parser.c | 3 | ||||
-rw-r--r-- | lib/psych/parser/handler.rb | 5 | ||||
-rw-r--r-- | test/psych/test_parser.rb | 5 |
3 files changed, 13 insertions, 0 deletions
diff --git a/ext/psych/parser.c b/ext/psych/parser.c index 4c4ccbb..9ba5f16 100644 --- a/ext/psych/parser.c +++ b/ext/psych/parser.c @@ -118,6 +118,9 @@ static VALUE parse_string(VALUE self, VALUE string) anchor, tag, implicit, style); } break; + case YAML_SEQUENCE_END_EVENT: + rb_funcall(handler, rb_intern("end_sequence"), 0); + break; case YAML_STREAM_END_EVENT: rb_funcall(handler, rb_intern("end_stream"), 0); done = 1; diff --git a/lib/psych/parser/handler.rb b/lib/psych/parser/handler.rb index b2706c1..4c87fff 100644 --- a/lib/psych/parser/handler.rb +++ b/lib/psych/parser/handler.rb @@ -36,6 +36,11 @@ module Psych end ### + # Called when a sequence ends. + def end_sequence + end + + ### # Called when the YAML stream ends def end_stream end diff --git a/test/psych/test_parser.rb b/test/psych/test_parser.rb index 4ad7b6a..61c2510 100644 --- a/test/psych/test_parser.rb +++ b/test/psych/test_parser.rb @@ -24,6 +24,11 @@ module Psych @parser = Psych::Parser.new EventCatcher.new end + def test_sequence_end + @parser.parse("---\n&A [1, 2]") + assert_called :end_sequence + end + def test_sequence_start_anchor @parser.parse("---\n&A [1, 2]") assert_called :start_sequence, ["A", true, FLOW_SEQUENCE_STYLE] |