psych 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +11 -0
- data/Rakefile +3 -1
- data/ext/psych/psych.h +0 -3
- data/ext/psych/psych_emitter.c +6 -22
- data/ext/psych/psych_parser.c +0 -29
- data/ext/psych/psych_to_ruby.c +0 -4
- data/ext/psych/yaml/emitter.c +4 -4
- data/ext/psych/yaml/loader.c +2 -2
- data/ext/psych/yaml/parser.c +1 -1
- data/ext/psych/yaml/reader.c +3 -3
- data/ext/psych/yaml/scanner.c +24 -24
- data/ext/psych/yaml/writer.c +1 -1
- data/lib/psych.rb +1 -3
- data/lib/psych/versions.rb +6 -1
- data/psych.gemspec +8 -6
- metadata +3 -7
- data/ext/java/PsychEmitter.java +0 -345
- data/ext/java/PsychLibrary.java +0 -93
- data/ext/java/PsychParser.java +0 -399
- data/ext/java/PsychToRuby.java +0 -79
- data/ext/java/PsychYamlTree.java +0 -55
- data/lib/psych_jars.rb +0 -6
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: b3d0517189a9d9a831b2732d0a6d8392b20292f7
         | 
| 4 | 
            +
              data.tar.gz: '068f28a7615fb785fffb794bd67c4cff126c65a3'
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 8a6b72ff59c6604e90ca759bbdd3cc634c390587bed67bca04d8858db26a1fe58f8521b2d4cc1e6c2ac9e22844da6c6daf2e02a1be5141526c707193bb780e32
         | 
| 7 | 
            +
              data.tar.gz: ef4f1e582bdfb0e088a75db018e642f6e387aee4fb271ad1ad69e9d8f1b42d81893f0524e2b984b25b734ecef83818ec114871f9242ba204fe47ea2e1e663613
         | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/Rakefile
    CHANGED
    
    | @@ -1,3 +1,5 @@ | |
| 1 | 
            +
            $LOAD_PATH.unshift './lib'
         | 
| 2 | 
            +
            load 'psych/versions.rb'
         | 
| 1 3 | 
             
            require "bundler/gem_tasks"
         | 
| 2 4 | 
             
            require "rake/testtask"
         | 
| 3 5 |  | 
| @@ -15,7 +17,7 @@ if RUBY_PLATFORM =~ /java/ | |
| 15 17 | 
             
                # and tell maven via system properties the snakeyaml version
         | 
| 16 18 | 
             
                # this is basically the same as running from the commandline:
         | 
| 17 19 | 
             
                # rmvn dependency:build-classpath -Dsnakeyaml.version='use version from Psych::DEFAULT_SNAKEYAML_VERSION here'
         | 
| 18 | 
            -
                Maven::Ruby::Maven.new.exec( | 
| 20 | 
            +
                Maven::Ruby::Maven.new.exec('dependency:build-classpath', "-Dsnakeyaml.version=#{Psych::DEFAULT_SNAKEYAML_VERSION}", '-Dverbose=true')
         | 
| 19 21 | 
             
                ext.source_version = '1.7'
         | 
| 20 22 | 
             
                ext.target_version = '1.7'
         | 
| 21 23 | 
             
                ext.classpath = File.read('pkg/classpath')
         | 
    
        data/ext/psych/psych.h
    CHANGED
    
    
    
        data/ext/psych/psych_emitter.c
    CHANGED
    
    | @@ -8,6 +8,7 @@ | |
| 8 8 | 
             
            #endif
         | 
| 9 9 |  | 
| 10 10 | 
             
            VALUE cPsychEmitter;
         | 
| 11 | 
            +
            static ID id_io;
         | 
| 11 12 | 
             
            static ID id_write;
         | 
| 12 13 | 
             
            static ID id_line_width;
         | 
| 13 14 | 
             
            static ID id_indentation;
         | 
| @@ -21,12 +22,8 @@ static void emit(yaml_emitter_t * emitter, yaml_event_t * event) | |
| 21 22 |  | 
| 22 23 | 
             
            static int writer(void *ctx, unsigned char *buffer, size_t size)
         | 
| 23 24 | 
             
            {
         | 
| 24 | 
            -
                VALUE  | 
| 25 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 25 | 
            +
                VALUE self = (VALUE)ctx, io = rb_attr_get(self, id_io);
         | 
| 26 26 | 
             
                VALUE str = rb_enc_str_new((const char *)buffer, (long)size, rb_utf8_encoding());
         | 
| 27 | 
            -
            #else
         | 
| 28 | 
            -
                VALUE str = rb_str_new((const char *)buffer, (long)size);
         | 
| 29 | 
            -
            #endif
         | 
| 30 27 | 
             
                VALUE wrote = rb_funcall(io, id_write, 1, str);
         | 
| 31 28 | 
             
                return (int)NUM2INT(wrote);
         | 
| 32 29 | 
             
            }
         | 
| @@ -94,7 +91,8 @@ static VALUE initialize(int argc, VALUE *argv, VALUE self) | |
| 94 91 | 
             
            	yaml_emitter_set_canonical(emitter, Qtrue == canonical ? 1 : 0);
         | 
| 95 92 | 
             
                }
         | 
| 96 93 |  | 
| 97 | 
            -
                 | 
| 94 | 
            +
                rb_ivar_set(self, id_io, io);
         | 
| 95 | 
            +
                yaml_emitter_set_output(emitter, writer, (void *)self);
         | 
| 98 96 |  | 
| 99 97 | 
             
                return self;
         | 
| 100 98 | 
             
            }
         | 
| @@ -168,9 +166,7 @@ static VALUE start_document(VALUE self, VALUE version, VALUE tags, VALUE imp) | |
| 168 166 | 
             
                if(RTEST(tags)) {
         | 
| 169 167 | 
             
            	long i = 0;
         | 
| 170 168 | 
             
            	long len;
         | 
| 171 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 172 169 | 
             
            	rb_encoding * encoding = rb_utf8_encoding();
         | 
| 173 | 
            -
            #endif
         | 
| 174 170 |  | 
| 175 171 | 
             
            	Check_Type(tags, T_ARRAY);
         | 
| 176 172 |  | 
| @@ -193,10 +189,8 @@ static VALUE start_document(VALUE self, VALUE version, VALUE tags, VALUE imp) | |
| 193 189 | 
             
            	    value = RARRAY_AREF(tuple, 1);
         | 
| 194 190 | 
             
            	    StringValue(name);
         | 
| 195 191 | 
             
            	    StringValue(value);
         | 
| 196 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 197 192 | 
             
            	    name = rb_str_export_to_enc(name, encoding);
         | 
| 198 193 | 
             
            	    value = rb_str_export_to_enc(value, encoding);
         | 
| 199 | 
            -
            #endif
         | 
| 200 194 |  | 
| 201 195 | 
             
            	    tail->handle = (yaml_char_t *)RSTRING_PTR(name);
         | 
| 202 196 | 
             
            	    tail->prefix = (yaml_char_t *)RSTRING_PTR(value);
         | 
| @@ -257,14 +251,11 @@ static VALUE scalar( | |
| 257 251 | 
             
            	) {
         | 
| 258 252 | 
             
                yaml_emitter_t * emitter;
         | 
| 259 253 | 
             
                yaml_event_t event;
         | 
| 260 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 261 254 | 
             
                rb_encoding *encoding;
         | 
| 262 | 
            -
            #endif
         | 
| 263 255 | 
             
                TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
         | 
| 264 256 |  | 
| 265 257 | 
             
                Check_Type(value, T_STRING);
         | 
| 266 258 |  | 
| 267 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 268 259 | 
             
                encoding = rb_utf8_encoding();
         | 
| 269 260 |  | 
| 270 261 | 
             
                value = rb_str_export_to_enc(value, encoding);
         | 
| @@ -278,7 +269,6 @@ static VALUE scalar( | |
| 278 269 | 
             
            	Check_Type(tag, T_STRING);
         | 
| 279 270 | 
             
            	tag = rb_str_export_to_enc(tag, encoding);
         | 
| 280 271 | 
             
                }
         | 
| 281 | 
            -
            #endif
         | 
| 282 272 |  | 
| 283 273 | 
             
                yaml_scalar_event_initialize(
         | 
| 284 274 | 
             
            	    &event,
         | 
| @@ -313,7 +303,6 @@ static VALUE start_sequence( | |
| 313 303 | 
             
                yaml_emitter_t * emitter;
         | 
| 314 304 | 
             
                yaml_event_t event;
         | 
| 315 305 |  | 
| 316 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 317 306 | 
             
                rb_encoding * encoding = rb_utf8_encoding();
         | 
| 318 307 |  | 
| 319 308 | 
             
                if(!NIL_P(anchor)) {
         | 
| @@ -325,7 +314,6 @@ static VALUE start_sequence( | |
| 325 314 | 
             
            	Check_Type(tag, T_STRING);
         | 
| 326 315 | 
             
            	tag = rb_str_export_to_enc(tag, encoding);
         | 
| 327 316 | 
             
                }
         | 
| 328 | 
            -
            #endif
         | 
| 329 317 |  | 
| 330 318 | 
             
                TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
         | 
| 331 319 |  | 
| @@ -377,12 +365,10 @@ static VALUE start_mapping( | |
| 377 365 | 
             
            	) {
         | 
| 378 366 | 
             
                yaml_emitter_t * emitter;
         | 
| 379 367 | 
             
                yaml_event_t event;
         | 
| 380 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 381 368 | 
             
                rb_encoding *encoding;
         | 
| 382 | 
            -
             | 
| 369 | 
            +
             | 
| 383 370 | 
             
                TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
         | 
| 384 371 |  | 
| 385 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 386 372 | 
             
                encoding = rb_utf8_encoding();
         | 
| 387 373 |  | 
| 388 374 | 
             
                if(!NIL_P(anchor)) {
         | 
| @@ -394,7 +380,6 @@ static VALUE start_mapping( | |
| 394 380 | 
             
            	Check_Type(tag, T_STRING);
         | 
| 395 381 | 
             
            	tag = rb_str_export_to_enc(tag, encoding);
         | 
| 396 382 | 
             
                }
         | 
| 397 | 
            -
            #endif
         | 
| 398 383 |  | 
| 399 384 | 
             
                yaml_mapping_start_event_initialize(
         | 
| 400 385 | 
             
            	    &event,
         | 
| @@ -440,12 +425,10 @@ static VALUE alias(VALUE self, VALUE anchor) | |
| 440 425 | 
             
                yaml_event_t event;
         | 
| 441 426 | 
             
                TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
         | 
| 442 427 |  | 
| 443 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 444 428 | 
             
                if(!NIL_P(anchor)) {
         | 
| 445 429 | 
             
            	Check_Type(anchor, T_STRING);
         | 
| 446 430 | 
             
            	anchor = rb_str_export_to_enc(anchor, rb_utf8_encoding());
         | 
| 447 431 | 
             
                }
         | 
| 448 | 
            -
            #endif
         | 
| 449 432 |  | 
| 450 433 | 
             
                yaml_alias_event_initialize(
         | 
| 451 434 | 
             
            	    &event,
         | 
| @@ -562,6 +545,7 @@ void Init_psych_emitter(void) | |
| 562 545 | 
             
                rb_define_method(cPsychEmitter, "line_width", line_width, 0);
         | 
| 563 546 | 
             
                rb_define_method(cPsychEmitter, "line_width=", set_line_width, 1);
         | 
| 564 547 |  | 
| 548 | 
            +
                id_io          = rb_intern("io");
         | 
| 565 549 | 
             
                id_write       = rb_intern("write");
         | 
| 566 550 | 
             
                id_line_width  = rb_intern("line_width");
         | 
| 567 551 | 
             
                id_indentation = rb_intern("indentation");
         | 
    
        data/ext/psych/psych_parser.c
    CHANGED
    
    | @@ -93,7 +93,6 @@ static VALUE make_exception(yaml_parser_t * parser, VALUE path) | |
| 93 93 | 
             
            	    parser->context ? rb_usascii_str_new2(parser->context) : Qnil);
         | 
| 94 94 | 
             
            }
         | 
| 95 95 |  | 
| 96 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 97 96 | 
             
            static VALUE transcode_string(VALUE src, int * parser_encoding)
         | 
| 98 97 | 
             
            {
         | 
| 99 98 | 
             
                int utf8    = rb_utf8_encindex();
         | 
| @@ -171,8 +170,6 @@ static VALUE transcode_io(VALUE src, int * parser_encoding) | |
| 171 170 | 
             
                return src;
         | 
| 172 171 | 
             
            }
         | 
| 173 172 |  | 
| 174 | 
            -
            #endif
         | 
| 175 | 
            -
             | 
| 176 173 | 
             
            static VALUE protected_start_stream(VALUE pointer)
         | 
| 177 174 | 
             
            {
         | 
| 178 175 | 
             
                VALUE *args = (VALUE *)pointer;
         | 
| @@ -253,10 +250,8 @@ static VALUE parse(int argc, VALUE *argv, VALUE self) | |
| 253 250 | 
             
                int tainted = 0;
         | 
| 254 251 | 
             
                int state = 0;
         | 
| 255 252 | 
             
                int parser_encoding = YAML_ANY_ENCODING;
         | 
| 256 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 257 253 | 
             
                int encoding = rb_utf8_encindex();
         | 
| 258 254 | 
             
                rb_encoding * internal_enc = rb_default_internal_encoding();
         | 
| 259 | 
            -
            #endif
         | 
| 260 255 | 
             
                VALUE handler = rb_iv_get(self, "@handler");
         | 
| 261 256 |  | 
| 262 257 | 
             
                if (rb_scan_args(argc, argv, "11", &yaml, &path) == 1) {
         | 
| @@ -274,18 +269,14 @@ static VALUE parse(int argc, VALUE *argv, VALUE self) | |
| 274 269 | 
             
                if (OBJ_TAINTED(yaml)) tainted = 1;
         | 
| 275 270 |  | 
| 276 271 | 
             
                if (rb_respond_to(yaml, id_read)) {
         | 
| 277 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 278 272 | 
             
            	yaml = transcode_io(yaml, &parser_encoding);
         | 
| 279 273 | 
             
            	yaml_parser_set_encoding(parser, parser_encoding);
         | 
| 280 | 
            -
            #endif
         | 
| 281 274 | 
             
            	yaml_parser_set_input(parser, io_reader, (void *)yaml);
         | 
| 282 275 | 
             
            	if (RTEST(rb_obj_is_kind_of(yaml, rb_cIO))) tainted = 1;
         | 
| 283 276 | 
             
                } else {
         | 
| 284 277 | 
             
            	StringValue(yaml);
         | 
| 285 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 286 278 | 
             
            	yaml = transcode_string(yaml, &parser_encoding);
         | 
| 287 279 | 
             
            	yaml_parser_set_encoding(parser, parser_encoding);
         | 
| 288 | 
            -
            #endif
         | 
| 289 280 | 
             
            	yaml_parser_set_input_string(
         | 
| 290 281 | 
             
            		parser,
         | 
| 291 282 | 
             
            		(const unsigned char *)RSTRING_PTR(yaml),
         | 
| @@ -338,17 +329,13 @@ static VALUE parse(int argc, VALUE *argv, VALUE self) | |
| 338 329 | 
             
            			if(start->handle) {
         | 
| 339 330 | 
             
            			    handle = rb_str_new2((const char *)start->handle);
         | 
| 340 331 | 
             
            			    if (tainted) OBJ_TAINT(handle);
         | 
| 341 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 342 332 | 
             
            			    PSYCH_TRANSCODE(handle, encoding, internal_enc);
         | 
| 343 | 
            -
            #endif
         | 
| 344 333 | 
             
            			}
         | 
| 345 334 |  | 
| 346 335 | 
             
            			if(start->prefix) {
         | 
| 347 336 | 
             
            			    prefix = rb_str_new2((const char *)start->prefix);
         | 
| 348 337 | 
             
            			    if (tainted) OBJ_TAINT(prefix);
         | 
| 349 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 350 338 | 
             
            			    PSYCH_TRANSCODE(prefix, encoding, internal_enc);
         | 
| 351 | 
            -
            #endif
         | 
| 352 339 | 
             
            			}
         | 
| 353 340 |  | 
| 354 341 | 
             
            			rb_ary_push(tag_directives, rb_ary_new3((long)2, handle, prefix));
         | 
| @@ -377,9 +364,7 @@ static VALUE parse(int argc, VALUE *argv, VALUE self) | |
| 377 364 | 
             
            		if(event.data.alias.anchor) {
         | 
| 378 365 | 
             
            		    alias = rb_str_new2((const char *)event.data.alias.anchor);
         | 
| 379 366 | 
             
            		    if (tainted) OBJ_TAINT(alias);
         | 
| 380 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 381 367 | 
             
            		    PSYCH_TRANSCODE(alias, encoding, internal_enc);
         | 
| 382 | 
            -
            #endif
         | 
| 383 368 | 
             
            		}
         | 
| 384 369 |  | 
| 385 370 | 
             
            		args[0] = handler;
         | 
| @@ -399,24 +384,18 @@ static VALUE parse(int argc, VALUE *argv, VALUE self) | |
| 399 384 | 
             
            		    );
         | 
| 400 385 | 
             
            		if (tainted) OBJ_TAINT(val);
         | 
| 401 386 |  | 
| 402 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 403 387 | 
             
            		PSYCH_TRANSCODE(val, encoding, internal_enc);
         | 
| 404 | 
            -
            #endif
         | 
| 405 388 |  | 
| 406 389 | 
             
            		if(event.data.scalar.anchor) {
         | 
| 407 390 | 
             
            		    anchor = rb_str_new2((const char *)event.data.scalar.anchor);
         | 
| 408 391 | 
             
            		    if (tainted) OBJ_TAINT(anchor);
         | 
| 409 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 410 392 | 
             
            		    PSYCH_TRANSCODE(anchor, encoding, internal_enc);
         | 
| 411 | 
            -
            #endif
         | 
| 412 393 | 
             
            		}
         | 
| 413 394 |  | 
| 414 395 | 
             
            		if(event.data.scalar.tag) {
         | 
| 415 396 | 
             
            		    tag = rb_str_new2((const char *)event.data.scalar.tag);
         | 
| 416 397 | 
             
            		    if (tainted) OBJ_TAINT(tag);
         | 
| 417 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 418 398 | 
             
            		    PSYCH_TRANSCODE(tag, encoding, internal_enc);
         | 
| 419 | 
            -
            #endif
         | 
| 420 399 | 
             
            		}
         | 
| 421 400 |  | 
| 422 401 | 
             
            		plain_implicit =
         | 
| @@ -446,18 +425,14 @@ static VALUE parse(int argc, VALUE *argv, VALUE self) | |
| 446 425 | 
             
            		if(event.data.sequence_start.anchor) {
         | 
| 447 426 | 
             
            		    anchor = rb_str_new2((const char *)event.data.sequence_start.anchor);
         | 
| 448 427 | 
             
            		    if (tainted) OBJ_TAINT(anchor);
         | 
| 449 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 450 428 | 
             
            		    PSYCH_TRANSCODE(anchor, encoding, internal_enc);
         | 
| 451 | 
            -
            #endif
         | 
| 452 429 | 
             
            		}
         | 
| 453 430 |  | 
| 454 431 | 
             
            		tag = Qnil;
         | 
| 455 432 | 
             
            		if(event.data.sequence_start.tag) {
         | 
| 456 433 | 
             
            		    tag = rb_str_new2((const char *)event.data.sequence_start.tag);
         | 
| 457 434 | 
             
            		    if (tainted) OBJ_TAINT(tag);
         | 
| 458 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 459 435 | 
             
            		    PSYCH_TRANSCODE(tag, encoding, internal_enc);
         | 
| 460 | 
            -
            #endif
         | 
| 461 436 | 
             
            		}
         | 
| 462 437 |  | 
| 463 438 | 
             
            		implicit =
         | 
| @@ -486,17 +461,13 @@ static VALUE parse(int argc, VALUE *argv, VALUE self) | |
| 486 461 | 
             
            		if(event.data.mapping_start.anchor) {
         | 
| 487 462 | 
             
            		    anchor = rb_str_new2((const char *)event.data.mapping_start.anchor);
         | 
| 488 463 | 
             
            		    if (tainted) OBJ_TAINT(anchor);
         | 
| 489 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 490 464 | 
             
            		    PSYCH_TRANSCODE(anchor, encoding, internal_enc);
         | 
| 491 | 
            -
            #endif
         | 
| 492 465 | 
             
            		}
         | 
| 493 466 |  | 
| 494 467 | 
             
            		if(event.data.mapping_start.tag) {
         | 
| 495 468 | 
             
            		    tag = rb_str_new2((const char *)event.data.mapping_start.tag);
         | 
| 496 469 | 
             
            		    if (tainted) OBJ_TAINT(tag);
         | 
| 497 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 498 470 | 
             
            		    PSYCH_TRANSCODE(tag, encoding, internal_enc);
         | 
| 499 | 
            -
            #endif
         | 
| 500 471 | 
             
            		}
         | 
| 501 472 |  | 
| 502 473 | 
             
            		implicit =
         | 
    
        data/ext/psych/psych_to_ruby.c
    CHANGED
    
    | @@ -21,11 +21,7 @@ static VALUE build_exception(VALUE self, VALUE klass, VALUE mesg) | |
| 21 21 | 
             
             */
         | 
| 22 22 | 
             
            static VALUE path2class(VALUE self, VALUE path)
         | 
| 23 23 | 
             
            {
         | 
| 24 | 
            -
            #ifdef HAVE_RUBY_ENCODING_H
         | 
| 25 24 | 
             
                return rb_path_to_class(path);
         | 
| 26 | 
            -
            #else
         | 
| 27 | 
            -
                return rb_path2class(StringValuePtr(path));
         | 
| 28 | 
            -
            #endif
         | 
| 29 25 | 
             
            }
         | 
| 30 26 |  | 
| 31 27 | 
             
            void Init_psych_to_ruby(void)
         | 
    
        data/ext/psych/yaml/emitter.c
    CHANGED
    
    | @@ -517,7 +517,7 @@ yaml_emitter_emit_stream_start(yaml_emitter_t *emitter, | |
| 517 517 | 
             
                    if (emitter->best_width < 0) {
         | 
| 518 518 | 
             
                        emitter->best_width = INT_MAX;
         | 
| 519 519 | 
             
                    }
         | 
| 520 | 
            -
             | 
| 520 | 
            +
             | 
| 521 521 | 
             
                    if (!emitter->line_break) {
         | 
| 522 522 | 
             
                        emitter->line_break = YAML_LN_BREAK;
         | 
| 523 523 | 
             
                    }
         | 
| @@ -607,7 +607,7 @@ yaml_emitter_emit_document_start(yaml_emitter_t *emitter, | |
| 607 607 | 
             
                        if (!yaml_emitter_write_indent(emitter))
         | 
| 608 608 | 
             
                            return 0;
         | 
| 609 609 | 
             
                    }
         | 
| 610 | 
            -
             | 
| 610 | 
            +
             | 
| 611 611 | 
             
                    if (event->data.document_start.tag_directives.start
         | 
| 612 612 | 
             
                            != event->data.document_start.tag_directives.end) {
         | 
| 613 613 | 
             
                        implicit = 0;
         | 
| @@ -721,7 +721,7 @@ yaml_emitter_emit_document_end(yaml_emitter_t *emitter, | |
| 721 721 | 
             
            }
         | 
| 722 722 |  | 
| 723 723 | 
             
            /*
         | 
| 724 | 
            -
             * | 
| 724 | 
            +
             *
         | 
| 725 725 | 
             
             * Expect a flow item node.
         | 
| 726 726 | 
             
             */
         | 
| 727 727 |  | 
| @@ -1402,7 +1402,7 @@ yaml_emitter_analyze_anchor(yaml_emitter_t *emitter, | |
| 1402 1402 | 
             
            {
         | 
| 1403 1403 | 
             
                size_t anchor_length;
         | 
| 1404 1404 | 
             
                yaml_string_t string;
         | 
| 1405 | 
            -
             | 
| 1405 | 
            +
             | 
| 1406 1406 | 
             
                anchor_length = strlen((char *)anchor);
         | 
| 1407 1407 | 
             
                STRING_ASSIGN(string, anchor, anchor_length);
         | 
| 1408 1408 |  | 
    
        data/ext/psych/yaml/loader.c
    CHANGED
    
    | @@ -239,8 +239,8 @@ yaml_parser_register_anchor(yaml_parser_t *parser, | |
| 239 239 | 
             
                    if (strcmp((char *)alias_data->anchor, (char *)anchor) == 0) {
         | 
| 240 240 | 
             
                        yaml_free(anchor);
         | 
| 241 241 | 
             
                        return yaml_parser_set_composer_error_context(parser,
         | 
| 242 | 
            -
                                "found duplicate anchor; first  | 
| 243 | 
            -
                                alias_data->mark, "second  | 
| 242 | 
            +
                                "found duplicate anchor; first occurrence",
         | 
| 243 | 
            +
                                alias_data->mark, "second occurrence", data.mark);
         | 
| 244 244 | 
             
                    }
         | 
| 245 245 | 
             
                }
         | 
| 246 246 |  | 
    
        data/ext/psych/yaml/parser.c
    CHANGED
    
    | @@ -1295,7 +1295,7 @@ yaml_parser_process_directives(yaml_parser_t *parser, | |
| 1295 1295 | 
             
                    token = PEEK_TOKEN(parser);
         | 
| 1296 1296 | 
             
                    if (!token) goto error;
         | 
| 1297 1297 | 
             
                }
         | 
| 1298 | 
            -
             | 
| 1298 | 
            +
             | 
| 1299 1299 | 
             
                for (default_tag_directive = default_tag_directives;
         | 
| 1300 1300 | 
             
                        default_tag_directive->handle; default_tag_directive++) {
         | 
| 1301 1301 | 
             
                    if (!yaml_parser_append_tag_directive(parser, *default_tag_directive, 1,
         | 
    
        data/ext/psych/yaml/reader.c
    CHANGED
    
    | @@ -52,7 +52,7 @@ yaml_parser_determine_encoding(yaml_parser_t *parser) | |
| 52 52 | 
             
            {
         | 
| 53 53 | 
             
                /* Ensure that we had enough bytes in the raw buffer. */
         | 
| 54 54 |  | 
| 55 | 
            -
                while (!parser->eof | 
| 55 | 
            +
                while (!parser->eof
         | 
| 56 56 | 
             
                        && parser->raw_buffer.last - parser->raw_buffer.pointer < 3) {
         | 
| 57 57 | 
             
                    if (!yaml_parser_update_raw_buffer(parser)) {
         | 
| 58 58 | 
             
                        return 0;
         | 
| @@ -295,7 +295,7 @@ yaml_parser_update_buffer(yaml_parser_t *parser, size_t length) | |
| 295 295 | 
             
                                            parser->offset, value);
         | 
| 296 296 |  | 
| 297 297 | 
             
                                break;
         | 
| 298 | 
            -
             | 
| 298 | 
            +
             | 
| 299 299 | 
             
                            case YAML_UTF16LE_ENCODING:
         | 
| 300 300 | 
             
                            case YAML_UTF16BE_ENCODING:
         | 
| 301 301 |  | 
| @@ -318,7 +318,7 @@ yaml_parser_update_buffer(yaml_parser_t *parser, size_t length) | |
| 318 318 | 
             
                                 *
         | 
| 319 319 | 
             
                                 * The following formulas are used for decoding
         | 
| 320 320 | 
             
                                 * and encoding characters using surrogate pairs:
         | 
| 321 | 
            -
                                 * | 
| 321 | 
            +
                                 *
         | 
| 322 322 | 
             
                                 *  U  = U' + 0x10000   (0x01 00 00 <= U <= 0x10 FF FF)
         | 
| 323 323 | 
             
                                 *  U' = yyyyyyyyyyxxxxxxxxxx   (0 <= U' <= 0x0F FF FF)
         | 
| 324 324 | 
             
                                 *  W1 = 110110yyyyyyyyyy
         | 
    
        data/ext/psych/yaml/scanner.c
    CHANGED
    
    | @@ -70,7 +70,7 @@ | |
| 70 70 | 
             
             *      %TAG    !yaml!  tag:yaml.org,2002:
         | 
| 71 71 | 
             
             *      ---
         | 
| 72 72 | 
             
             *
         | 
| 73 | 
            -
             * The  | 
| 73 | 
            +
             * The corresponding sequence of tokens:
         | 
| 74 74 | 
             
             *
         | 
| 75 75 | 
             
             *      STREAM-START(utf-8)
         | 
| 76 76 | 
             
             *      VERSION-DIRECTIVE(1,1)
         | 
| @@ -762,7 +762,7 @@ yaml_parser_scan(yaml_parser_t *parser, yaml_token_t *token) | |
| 762 762 | 
             
                }
         | 
| 763 763 |  | 
| 764 764 | 
             
                /* Fetch the next token from the queue. */
         | 
| 765 | 
            -
             | 
| 765 | 
            +
             | 
| 766 766 | 
             
                *token = DEQUEUE(parser, parser->tokens);
         | 
| 767 767 | 
             
                parser->token_available = 0;
         | 
| 768 768 | 
             
                parser->tokens_parsed ++;
         | 
| @@ -1114,7 +1114,7 @@ yaml_parser_save_simple_key(yaml_parser_t *parser) | |
| 1114 1114 | 
             
                    yaml_simple_key_t simple_key;
         | 
| 1115 1115 | 
             
                    simple_key.possible = 1;
         | 
| 1116 1116 | 
             
                    simple_key.required = required;
         | 
| 1117 | 
            -
                    simple_key.token_number = | 
| 1117 | 
            +
                    simple_key.token_number =
         | 
| 1118 1118 | 
             
                        parser->tokens_parsed + (parser->tokens.tail - parser->tokens.head);
         | 
| 1119 1119 | 
             
                    simple_key.mark = parser->mark;
         | 
| 1120 1120 |  | 
| @@ -1200,7 +1200,7 @@ yaml_parser_decrease_flow_level(yaml_parser_t *parser) | |
| 1200 1200 | 
             
             * Push the current indentation level to the stack and set the new level
         | 
| 1201 1201 | 
             
             * the current column is greater than the indentation level.  In this case,
         | 
| 1202 1202 | 
             
             * append or insert the specified token into the token queue.
         | 
| 1203 | 
            -
             * | 
| 1203 | 
            +
             *
         | 
| 1204 1204 | 
             
             */
         | 
| 1205 1205 |  | 
| 1206 1206 | 
             
            static int
         | 
| @@ -1251,7 +1251,7 @@ yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column, | |
| 1251 1251 |  | 
| 1252 1252 | 
             
            /*
         | 
| 1253 1253 | 
             
             * Pop indentation levels from the indents stack until the current level
         | 
| 1254 | 
            -
             * becomes less or equal to the column.  For each  | 
| 1254 | 
            +
             * becomes less or equal to the column.  For each indentation level, append
         | 
| 1255 1255 | 
             
             * the BLOCK-END token.
         | 
| 1256 1256 | 
             
             */
         | 
| 1257 1257 |  | 
| @@ -1266,7 +1266,7 @@ yaml_parser_unroll_indent(yaml_parser_t *parser, ptrdiff_t column) | |
| 1266 1266 | 
             
                if (parser->flow_level)
         | 
| 1267 1267 | 
             
                    return 1;
         | 
| 1268 1268 |  | 
| 1269 | 
            -
                /* Loop through the  | 
| 1269 | 
            +
                /* Loop through the indentation levels in the stack. */
         | 
| 1270 1270 |  | 
| 1271 1271 | 
             
                while (parser->indent > column)
         | 
| 1272 1272 | 
             
                {
         | 
| @@ -1938,7 +1938,7 @@ yaml_parser_scan_to_next_token(yaml_parser_t *parser) | |
| 1938 1938 | 
             
                     *
         | 
| 1939 1939 | 
             
                     *  - in the flow context;
         | 
| 1940 1940 | 
             
                     *  - in the block context, but not at the beginning of the line or
         | 
| 1941 | 
            -
                     *  after '-', '?', or ':' (complex value). | 
| 1941 | 
            +
                     *  after '-', '?', or ':' (complex value).
         | 
| 1942 1942 | 
             
                     */
         | 
| 1943 1943 |  | 
| 1944 1944 | 
             
                    if (!CACHE(parser, 1)) return 0;
         | 
| @@ -2053,7 +2053,7 @@ yaml_parser_scan_directive(yaml_parser_t *parser, yaml_token_t *token) | |
| 2053 2053 | 
             
                else
         | 
| 2054 2054 | 
             
                {
         | 
| 2055 2055 | 
             
                    yaml_parser_set_scanner_error(parser, "while scanning a directive",
         | 
| 2056 | 
            -
                            start_mark, "found  | 
| 2056 | 
            +
                            start_mark, "found unknown directive name");
         | 
| 2057 2057 | 
             
                    goto error;
         | 
| 2058 2058 | 
             
                }
         | 
| 2059 2059 |  | 
| @@ -2775,15 +2775,15 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token, | |
| 2775 2775 |  | 
| 2776 2776 | 
             
                    if (IS_DIGIT(parser->buffer))
         | 
| 2777 2777 | 
             
                    {
         | 
| 2778 | 
            -
                        /* Check that the  | 
| 2778 | 
            +
                        /* Check that the indentation is greater than 0. */
         | 
| 2779 2779 |  | 
| 2780 2780 | 
             
                        if (CHECK(parser->buffer, '0')) {
         | 
| 2781 2781 | 
             
                            yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
         | 
| 2782 | 
            -
                                    start_mark, "found an  | 
| 2782 | 
            +
                                    start_mark, "found an indentation indicator equal to 0");
         | 
| 2783 2783 | 
             
                            goto error;
         | 
| 2784 2784 | 
             
                        }
         | 
| 2785 2785 |  | 
| 2786 | 
            -
                        /* Get the  | 
| 2786 | 
            +
                        /* Get the indentation level and eat the indicator. */
         | 
| 2787 2787 |  | 
| 2788 2788 | 
             
                        increment = AS_DIGIT(parser->buffer);
         | 
| 2789 2789 |  | 
| @@ -2797,7 +2797,7 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token, | |
| 2797 2797 | 
             
                {
         | 
| 2798 2798 | 
             
                    if (CHECK(parser->buffer, '0')) {
         | 
| 2799 2799 | 
             
                        yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
         | 
| 2800 | 
            -
                                start_mark, "found an  | 
| 2800 | 
            +
                                start_mark, "found an indentation indicator equal to 0");
         | 
| 2801 2801 | 
             
                        goto error;
         | 
| 2802 2802 | 
             
                    }
         | 
| 2803 2803 |  | 
| @@ -2847,7 +2847,7 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token, | |
| 2847 2847 |  | 
| 2848 2848 | 
             
                end_mark = parser->mark;
         | 
| 2849 2849 |  | 
| 2850 | 
            -
                /* Set the  | 
| 2850 | 
            +
                /* Set the indentation level if it was specified. */
         | 
| 2851 2851 |  | 
| 2852 2852 | 
             
                if (increment) {
         | 
| 2853 2853 | 
             
                    indent = parser->indent >= 0 ? parser->indent+increment : increment;
         | 
| @@ -2913,7 +2913,7 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token, | |
| 2913 2913 |  | 
| 2914 2914 | 
             
                    if (!READ_LINE(parser, leading_break)) goto error;
         | 
| 2915 2915 |  | 
| 2916 | 
            -
                    /* Eat the following  | 
| 2916 | 
            +
                    /* Eat the following indentation spaces and line breaks. */
         | 
| 2917 2917 |  | 
| 2918 2918 | 
             
                    if (!yaml_parser_scan_block_scalar_breaks(parser,
         | 
| 2919 2919 | 
             
                                &indent, &trailing_breaks, start_mark, &end_mark)) goto error;
         | 
| @@ -2948,8 +2948,8 @@ error: | |
| 2948 2948 | 
             
            }
         | 
| 2949 2949 |  | 
| 2950 2950 | 
             
            /*
         | 
| 2951 | 
            -
             * Scan  | 
| 2952 | 
            -
             *  | 
| 2951 | 
            +
             * Scan indentation spaces and line breaks for a block scalar.  Determine the
         | 
| 2952 | 
            +
             * indentation level if needed.
         | 
| 2953 2953 | 
             
             */
         | 
| 2954 2954 |  | 
| 2955 2955 | 
             
            static int
         | 
| @@ -2961,11 +2961,11 @@ yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser, | |
| 2961 2961 |  | 
| 2962 2962 | 
             
                *end_mark = parser->mark;
         | 
| 2963 2963 |  | 
| 2964 | 
            -
                /* Eat the  | 
| 2964 | 
            +
                /* Eat the indentation spaces and line breaks. */
         | 
| 2965 2965 |  | 
| 2966 2966 | 
             
                while (1)
         | 
| 2967 2967 | 
             
                {
         | 
| 2968 | 
            -
                    /* Eat the  | 
| 2968 | 
            +
                    /* Eat the indentation spaces. */
         | 
| 2969 2969 |  | 
| 2970 2970 | 
             
                    if (!CACHE(parser, 1)) return 0;
         | 
| 2971 2971 |  | 
| @@ -2978,12 +2978,12 @@ yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser, | |
| 2978 2978 | 
             
                    if ((int)parser->mark.column > max_indent)
         | 
| 2979 2979 | 
             
                        max_indent = (int)parser->mark.column;
         | 
| 2980 2980 |  | 
| 2981 | 
            -
                    /* Check for a tab character messing the  | 
| 2981 | 
            +
                    /* Check for a tab character messing the indentation. */
         | 
| 2982 2982 |  | 
| 2983 2983 | 
             
                    if ((!*indent || (int)parser->mark.column < *indent)
         | 
| 2984 2984 | 
             
                            && IS_TAB(parser->buffer)) {
         | 
| 2985 2985 | 
             
                        return yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
         | 
| 2986 | 
            -
                                start_mark, "found a tab character where an  | 
| 2986 | 
            +
                                start_mark, "found a tab character where an indentation space is expected");
         | 
| 2987 2987 | 
             
                    }
         | 
| 2988 2988 |  | 
| 2989 2989 | 
             
                    /* Have we found a non-empty line? */
         | 
| @@ -3007,7 +3007,7 @@ yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser, | |
| 3007 3007 | 
             
                        *indent = 1;
         | 
| 3008 3008 | 
             
                }
         | 
| 3009 3009 |  | 
| 3010 | 
            -
               return 1; | 
| 3010 | 
            +
               return 1;
         | 
| 3011 3011 | 
             
            }
         | 
| 3012 3012 |  | 
| 3013 3013 | 
             
            /*
         | 
| @@ -3504,12 +3504,12 @@ yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token) | |
| 3504 3504 | 
             
                    {
         | 
| 3505 3505 | 
             
                        if (IS_BLANK(parser->buffer))
         | 
| 3506 3506 | 
             
                        {
         | 
| 3507 | 
            -
                            /* Check for tab character that abuse  | 
| 3507 | 
            +
                            /* Check for tab character that abuse indentation. */
         | 
| 3508 3508 |  | 
| 3509 3509 | 
             
                            if (leading_blanks && (int)parser->mark.column < indent
         | 
| 3510 3510 | 
             
                                    && IS_TAB(parser->buffer)) {
         | 
| 3511 3511 | 
             
                                yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",
         | 
| 3512 | 
            -
                                        start_mark, "found a tab character that violate  | 
| 3512 | 
            +
                                        start_mark, "found a tab character that violate indentation");
         | 
| 3513 3513 | 
             
                                goto error;
         | 
| 3514 3514 | 
             
                            }
         | 
| 3515 3515 |  | 
| @@ -3542,7 +3542,7 @@ yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token) | |
| 3542 3542 | 
             
                        if (!CACHE(parser, 1)) goto error;
         | 
| 3543 3543 | 
             
                    }
         | 
| 3544 3544 |  | 
| 3545 | 
            -
                    /* Check  | 
| 3545 | 
            +
                    /* Check indentation level. */
         | 
| 3546 3546 |  | 
| 3547 3547 | 
             
                    if (!parser->flow_level && (int)parser->mark.column < indent)
         | 
| 3548 3548 | 
             
                        break;
         |