ruby-changes:24735
From: tenderlove <ko1@a...>
Date: Thu, 23 Aug 2012 02:43:39 +0900 (JST)
Subject: [ruby-changes:24735] tenderlove:r36786 (trunk): * ext/syck: removed. Fixes
tenderlove 2012-08-23 02:43:16 +0900 (Thu, 23 Aug 2012) New Revision: 36786 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36786 Log: * ext/syck: removed. Fixes [ruby-core:43360] * test/syck: removed. * lib/yaml.rb: only require psych, show a warning if people try to set the engine to syck. Removed files: trunk/ext/syck/bytecode.c trunk/ext/syck/depend trunk/ext/syck/emitter.c trunk/ext/syck/extconf.rb trunk/ext/syck/gram.c trunk/ext/syck/gram.h trunk/ext/syck/handler.c trunk/ext/syck/implicit.c trunk/ext/syck/lib/syck/baseemitter.rb trunk/ext/syck/lib/syck/basenode.rb trunk/ext/syck/lib/syck/constants.rb trunk/ext/syck/lib/syck/encoding.rb trunk/ext/syck/lib/syck/error.rb trunk/ext/syck/lib/syck/loader.rb trunk/ext/syck/lib/syck/rubytypes.rb trunk/ext/syck/lib/syck/stream.rb trunk/ext/syck/lib/syck/stringio.rb trunk/ext/syck/lib/syck/syck.rb trunk/ext/syck/lib/syck/tag.rb trunk/ext/syck/lib/syck/types.rb trunk/ext/syck/lib/syck/yamlnode.rb trunk/ext/syck/lib/syck/ypath.rb trunk/ext/syck/lib/syck.rb trunk/ext/syck/lib/yaml/syck.rb trunk/ext/syck/node.c trunk/ext/syck/rubyext.c trunk/ext/syck/syck.c trunk/ext/syck/syck.h trunk/ext/syck/token.c trunk/ext/syck/yaml2byte.c trunk/ext/syck/yamlbyte.h trunk/test/syck/test_array.rb trunk/test/syck/test_boolean.rb trunk/test/syck/test_class.rb trunk/test/syck/test_engine_manager.rb trunk/test/syck/test_exception.rb trunk/test/syck/test_hash.rb trunk/test/syck/test_null.rb trunk/test/syck/test_omap.rb trunk/test/syck/test_set.rb trunk/test/syck/test_string.rb trunk/test/syck/test_struct.rb trunk/test/syck/test_symbol.rb trunk/test/syck/test_time.rb trunk/test/syck/test_yaml.rb trunk/test/syck/test_yaml_properties.rb trunk/test/syck/test_yamldbm.rb trunk/test/syck/test_yamlstore.rb Modified files: trunk/ChangeLog trunk/NEWS trunk/ext/Setup trunk/ext/Setup.atheos trunk/ext/Setup.emx trunk/ext/Setup.nacl trunk/ext/Setup.nt trunk/lib/yaml.rb trunk/test/psych/test_engine_manager.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 36785) +++ ChangeLog (revision 36786) @@ -1,3 +1,12 @@ +Thu Aug 23 02:37:35 2012 Aaron Patterson <aaron@t...> + + * ext/syck: removed. Fixes [ruby-core:43360] + + * test/syck: removed. + + * lib/yaml.rb: only require psych, show a warning if people try to set + the engine to syck. + Thu Aug 23 01:46:53 2012 Aaron Patterson <aaron@t...> * insns.def: search up the cf stack for an object that is an instance Index: lib/yaml.rb =================================================================== --- lib/yaml.rb (revision 36785) +++ lib/yaml.rb (revision 36786) @@ -2,75 +2,41 @@ # The YAML module allows you to use one of the two YAML engines that ship with # ruby. By default Psych is used but the old and unmaintained Syck may be # chosen. -# -# See Psych or Syck for usage and documentation. -# -# To set the YAML engine to syck: -# -# YAML::ENGINE.yamler = 'syck' -# -# To set the YAML engine back to psych: -# -# YAML::ENGINE.yamler = 'psych' -module YAML +begin + require 'psych' +rescue LoadError + warn "#{caller[0]}:" + warn "It seems your ruby installation is missing psych (for YAML output)." + warn "To eliminate this warning, please install libyaml and reinstall your ruby." + raise +end + +module Psych class EngineManager # :nodoc: attr_reader :yamler def initialize - @yamler = nil + @yamler = 'psych' end def syck? - 'syck' == @yamler + false end def yamler= engine - raise(ArgumentError, "bad engine") unless %w{syck psych}.include?(engine) + case engine + when 'syck' then warn "syck has been removed" + when 'psych' then @yamler = 'psych' + else + raise(ArgumentError, "bad engine") + end - require engine unless (engine == 'syck' ? Syck : Psych).const_defined?(:VERSION) - - ::Object.class_eval <<-eorb, __FILE__, __LINE__ + 1 - remove_const 'YAML' - YAML = #{engine.capitalize} - remove_method :to_yaml - alias :to_yaml :#{engine}_to_yaml - eorb - - @yamler = engine engine end end - ## - # Allows changing the current YAML engine. See YAML for details. - - ENGINE = YAML::EngineManager.new + ENGINE = EngineManager.new # :nodoc: end -if defined?(Psych) - engine = 'psych' -elsif defined?(Syck) - engine = 'syck' -else - begin - require 'psych' - engine = 'psych' - rescue LoadError - warn "#{caller[0]}:" - warn "It seems your ruby installation is missing psych (for YAML output)." - warn "To eliminate this warning, please install libyaml and reinstall your ruby." - require 'syck' - engine = 'syck' - end -end - -module Syck - ENGINE = YAML::ENGINE -end - -module Psych - ENGINE = YAML::ENGINE -end - -YAML::ENGINE.yamler = engine +YAML = Psych Index: ext/Setup.nt =================================================================== --- ext/Setup.nt (revision 36785) +++ ext/Setup.nt (revision 36786) @@ -25,7 +25,6 @@ socket stringio strscan -syck #syslog #tk win32ole Index: ext/Setup =================================================================== --- ext/Setup (revision 36785) +++ ext/Setup (revision 36786) @@ -24,7 +24,6 @@ #socket #stringio #strscan -#syck #syslog #tk #win32ole Index: ext/Setup.nacl =================================================================== --- ext/Setup.nacl (revision 36785) +++ ext/Setup.nacl (revision 36786) @@ -43,7 +43,6 @@ # #socket # stringio # strscan -# syck # #syslog # #tk # #tk/tkutil Index: ext/Setup.atheos =================================================================== --- ext/Setup.atheos (revision 36785) +++ ext/Setup.atheos (revision 36786) @@ -25,7 +25,6 @@ socket stringio strscan -syck syslog #tk #win32ole Index: ext/Setup.emx =================================================================== --- ext/Setup.emx (revision 36785) +++ ext/Setup.emx (revision 36786) @@ -25,7 +25,6 @@ socket stringio strscan -#syck #syslog #tk #win32ole Index: ext/syck/bytecode.c =================================================================== --- ext/syck/bytecode.c (revision 36785) +++ ext/syck/bytecode.c (revision 36786) @@ -1,1165 +0,0 @@ -/* Generated by re2c 0.9.10 on Mon Sep 19 23:21:26 2005 */ -#line 1 "bytecode.re" -/* - * bytecode.re - * - * $Author$ - * - * Copyright (C) 2003 why the lucky stiff - */ -#include "ruby/ruby.h" -#include "syck.h" -#include "gram.h" - -#define QUOTELEN 128 - -/* - * They do my bidding... - */ -#define YYCTYPE char -#define YYCURSOR parser->cursor -#define YYMARKER parser->marker -#define YYLIMIT parser->limit -#define YYTOKEN parser->token -#define YYTOKTMP parser->toktmp -#define YYLINEPTR parser->lineptr -#define YYLINECTPTR parser->linectptr -#define YYLINE parser->linect -#define YYFILL(n) syck_parser_read(parser) - -extern SyckParser *syck_parser_ptr; - -char *get_inline( SyckParser *parser ); - -/* - * Repositions the cursor at `n' offset from the token start. - * Only works in `Header' and `Document' sections. - */ -#define YYPOS(n) YYCURSOR = YYTOKEN + n - -/* - * Track line numbers - */ -#define CHK_NL(ptr) if ( *( ptr - 1 ) == '\n' && ptr > YYLINECTPTR ) { YYLINEPTR = ptr; YYLINE++; YYLINECTPTR = YYLINEPTR; } - -/* - * I like seeing the level operations as macros... - */ -#define ADD_LEVEL(len, status) syck_parser_add_level( parser, len, status ) -#define POP_LEVEL() syck_parser_pop_level( parser ) -#define CURRENT_LEVEL() syck_parser_current_level( parser ) - -/* - * Force a token next time around sycklex() - */ -#define FORCE_NEXT_TOKEN(tok) parser->force_token = tok; - -/* - * Adding levels in bytecode requires us to make sure - * we've got all our tokens worked out. - */ -#define ADD_BYTE_LEVEL(lvl, len, s ) \ - switch ( lvl->status ) \ - { \ - case syck_lvl_seq: \ - lvl->ncount++; \ - ADD_LEVEL(len, syck_lvl_open); \ - YYPOS(0); \ - return '-'; \ - \ - case syck_lvl_map: \ - lvl->ncount++; \ - ADD_LEVEL(len, s); \ - break; \ - \ - case syck_lvl_open: \ - lvl->status = s; \ - break; \ - \ - default: \ - ADD_LEVEL(len, s); \ - break; \ - } - -/* - * Nice little macro to ensure we're YAML_IOPENed to the current level. - * * Only use this macro in the "Document" section * - */ -#define ENSURE_YAML_IOPEN(last_lvl, lvl_type, to_len, reset) \ - if ( last_lvl->spaces < to_len ) \ - { \ - if ( last_lvl->status == syck_lvl_iseq || last_lvl->status == syck_lvl_imap ) \ - { \ - goto Document; \ - } \ - else \ - { \ - ADD_LEVEL( to_len, lvl_type ); \ - if ( reset == 1 ) YYPOS(0); \ - return YAML_IOPEN; \ - } \ - } - -/* - * Nice little macro to ensure closure of levels. - * * Only use this macro in the "Document" section * - */ -#define ENSURE_YAML_IEND(last_lvl, to_len) \ - if ( last_lvl->spaces > to_len ) \ - { \ - syck_parser_pop_level( parser ); \ - YYPOS(0); \ - return YAML_IEND; \ - } - -/* - * Concatenates string items and manages allocation - * to the string - */ -#define CAT(s, c, i, l) \ - { \ - if ( i + 1 >= c ) \ - { \ - c += QUOTELEN; \ - S_REALLOC_N( s, char, c ); \ - } \ - s[i++] = l; \ - s[i] = '\0'; \ - } - -/* - * Parser for standard YAML Bytecode [UTF-8] - */ -int -sycklex_bytecode_utf8( YYSTYPE *sycklval, SyckParser *parser ) -{ - SyckLevel *lvl; - syck_parser_ptr = parser; - if ( YYCURSOR == NULL ) - { - syck_parser_read( parser ); - } - - if ( parser->force_token != 0 ) - { - int t = parser->force_token; - parser->force_token = 0; - return t; - } - -#line 172 "bytecode.re" - - - lvl = CURRENT_LEVEL(); - if ( lvl->status == syck_lvl_doc ) - { - goto Document; - } - -/* Header: */ - - YYTOKEN = YYCURSOR; - - -#line 165 "<stdout>" -{ - YYCTYPE yych; - unsigned int yyaccept = 0; - goto yy0; - ++YYCURSOR; -yy0: - if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); - yych = *YYCURSOR; - switch(yych){ - case 0x00: goto yy2; - case 'D': goto yy3; - default: goto yy5; - } -yy2: YYCURSOR = YYMARKER; - switch(yyaccept){ - case 0: goto yy4; - } -yy3: yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - switch(yych){ - case 0x0A: goto yy6; - case 0x0D: goto yy8; - default: goto yy4; - } -yy4: -#line 199 "bytecode.re" -{ YYPOS(0); - goto Document; - } -#line 195 "<stdout>" -yy5: yych = *++YYCURSOR; - goto yy4; -yy6: ++YYCURSOR; - goto yy7; -yy7: -#line 186 "bytecode.re" -{ if ( lvl->status == syck_lvl_header ) - { - CHK_NL(YYCURSOR); - goto Directive; - } - else - { - ENSURE_YAML_IEND(lvl, -1); - YYPOS(0); - return 0; - } - } -#line 214 "<stdout>" -yy8: ++YYCURSOR; - switch((yych = *YYCURSOR)) { - case 0x0A: goto yy6; - default: goto yy2; - } -} -#line 203 "bytecode.re" - - -Document: - { - lvl = CURRENT_LEVEL(); - if ( lvl->status == syck_lvl_header ) - { - lvl->status = syck_lvl_doc; - } - - YYTOKEN = YYCURSOR; - - -#line 235 "<stdout>" -{ - YYCTYPE yych; - goto yy9; - ++YYCURSOR; -yy9: - if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); - yych = *YYCURSOR; - switch(yych){ - case 0x00: goto yy30; - case 0x0A: goto yy27; - case 0x0D: goto yy29; - case 'A': goto yy19; - case 'D': goto yy12; - case 'E': goto yy16; - case 'M': goto yy14; - case 'P': goto yy13; - case 'Q': goto yy15; - case 'R': goto yy21; - case 'S': goto yy17; - case 'T': goto yy23; - case 'c': goto yy25; - default: goto yy11; - } -yy11:yy12: yych = *++YYCURSOR; - switch(yych){ - case 0x0A: goto yy41; - case 0x0D: goto yy44; - default: goto yy11; - } -yy13: yych = *++YYCURSOR; - switch(yych){ - case 0x0A: goto yy41; - case 0x0D: goto yy43; - default: goto yy11; - } -yy14: yych = *++YYCURSOR; - switch(yych){ - case 0x0A: goto yy38; - case 0x0D: goto yy40; - default: goto yy11; - } -yy15: yych = *++YYCURSOR; - switch(yych){ - case 0x0A: goto yy35; - case 0x0D: goto yy37; - default: goto yy11; - } -yy16: yych = *++YYCURSOR; - switch(yych){ - case 0x0A: goto yy32; - case 0x0D: goto yy34; - default: goto yy11; - } -yy17: ++YYCURSOR; - goto yy18; -yy18: -#line 288 "bytecode.re" -{ ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_str); - goto Scalar; - } -#line 296 "<stdout>" -yy19: ++YYCURSOR; - goto yy20; -yy20: -#line 292 "bytecode.re" -{ ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_open); - sycklval->name = get_inline( parser ); - syck_hdlr_remove_anchor( parser, sycklval->name ); - CHK_NL(YYCURSOR); - return YAML_ANCHOR; - } -#line 307 "<stdout>" -yy21: ++YYCURSOR; - goto yy22; -yy22: -#line 299 "bytecode.re" -{ ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_str); - sycklval->name = get_inline( parser ); - POP_LEVEL(); - if ( *( YYCURSOR - 1 ) == '\n' ) YYCURSOR--; - return YAML_ALIAS; - } -#line 318 "<stdout>" -yy23: ++YYCURSOR; - goto yy24; -yy24: -#line 306 "bytecode.re" -{ char *qstr; - ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_open); - qstr = get_inline( parser ); - CHK_NL(YYCURSOR); - if ( qstr[0] == '!' ) - { - size_t qidx = strlen( qstr ); - if ( qstr[1] == '\0' ) - { - free( qstr ); - return YAML_ITRANSFER; - } - - lvl = CURRENT_LEVEL(); - - /* - * URL Prefixing - */ - if ( qstr[1] == '^' ) - { - sycklval->name = S_ALLOC_N( char, qidx + strlen( lvl->domain ) ); - sycklval->name[0] = '\0'; - strcat( sycklval->name, lvl->domain ); - strncat( sycklval->name, qstr + 2, qidx - 2 ); - free( qstr ); - } - else - { - char *carat = qstr + 1; - char *qend = qstr + qidx; - while ( (++carat) < qend ) - { - if ( *carat == '^' ) - break; - } - - if ( carat < qend ) - { - free( lvl->domain ); - lvl->domain = syck_strndup( qstr + 1, carat - ( qstr + 1 ) ); - sycklval->name = S_ALLOC_N( char, ( qend - carat ) + strlen( lvl->domain ) ); - sycklval->name[0] = '\0'; - strcat( sycklval->name, lvl->domain ); - strncat( sycklval->name, carat + 1, ( qend - carat ) - 1 ); - free( qstr ); - } - else - { - sycklval->name = S_ALLOC_N( char, strlen( qstr ) ); - sycklval->name[0] = '\0'; - S_MEMCPY( sycklval->name, qstr + 1, char, strlen( qstr ) ); - free( qstr ); - } - } - return YAML_TRANSFER; - } - sycklval->name = qstr; - return YAML_TAGURI; - } -#line 382 "<stdout>" -yy25: ++YYCURSOR; - goto yy26; -yy26: -#line 366 "bytecode.re" -{ goto Comment; } -#line 388 "<stdout>" -yy27: ++YYCURSOR; - goto yy28; -yy28: -#line 368 "bytecode.re" -{ CHK_NL(YYCURSOR); - if ( lvl->status == syck_lvl_seq ) - { - return YAML_INDENT; - } - else if ( lvl->status == syck_lvl_map ) - { - if ( lvl->ncount % 2 == 1 ) return ':'; - else return YAML_INDENT; - } - goto Document; - } -#line 405 "<stdout>" -yy29: yych = *++YYCURSOR; - switch(yych){ - case 0x0A: goto yy27; - default: goto yy11; - } -yy30: ++YYCURSOR; - goto yy31; -yy31: -#line 381 "bytecode.re" -{ ENSURE_YAML_IEND(lvl, -1); - YYPOS(0); - return 0; - } -#line 419 "<stdout>" -yy32: ++YYCURSOR; - goto yy33; -yy33: -#line 252 "bytecode.re" -{ if ( lvl->status == syck_lvl_seq && lvl->ncount == 0 ) - { - lvl->ncount++; - YYPOS(0); - FORCE_NEXT_TOKEN( ']' ); - return '['; - } - else if ( lvl->status == syck_lvl_map && lvl->ncount == 0 ) - { - lvl->ncount++; - YYPOS(0); - FORCE_NEXT_TOKEN( '}' ); - return '{'; - } - - POP_LEVEL(); - lvl = CURRENT_LEVEL(); - if ( lvl->status == syck_lvl_seq ) - { - FORCE_NEXT_TOKEN(YAML_INDENT); - } - else if ( lvl->status == syck_lvl_map ) - { - if ( lvl->ncount % 2 == 1 ) - { - FORCE_NEXT_TOKEN(':'); - } - else - { - FORCE_NEXT_TOKEN(YAML_INDENT); - } - } - CHK_NL(YYCURSOR); - return YAML_IEND; - } -#line 459 "<stdout>" -yy34: yych = *++YYCURSOR; - switch(yych){ - case 0x0A: goto yy32; - default: goto yy11; - } -yy35: ++YYCURSOR; - goto yy36; -yy36: -#line 237 "bytecode.re" -{ int complex = 0; - if ( lvl->ncount % 2 == 0 && ( lvl->status == syck_lvl_map || lvl->status == syck_lvl_seq ) ) - { - complex = 1; - } - ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_seq); - CHK_NL(YYCURSOR); - if ( complex ) - { - FORCE_NEXT_TOKEN( YAML_IOPEN ); - return '?'; - } - return YAML_IOPEN; - } -#line 483 "<stdout>" -yy37: yych = *++YYCURSOR; - switch(yych){ - case 0x0A: goto yy35; - default: goto yy11; - } -yy38: ++YYCURSOR; - goto yy39; -yy39: -#line 222 "bytecode.re" -{ int complex = 0; - if ( lvl->ncount % 2 == 0 && ( lvl->status == syck_lvl_map || lvl->status == syck_lvl_seq ) ) - { - complex = 1; - } - ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_map); - CHK_NL(YYCURSOR); - if ( complex ) - { - FORCE_NEXT_TOKEN( YAML_IOPEN ); - return '?'; - } - return YAML_IOPEN; - } -#line 507 "<stdout>" -yy40: yych = *++YYCURSOR; - switch(yych){ - case 0x0A: goto yy38; - default: goto yy11; - } -yy41: ++YYCURSOR; - goto yy42; -yy42: -#line 217 "bytecode.re" -{ ENSURE_YAML_IEND(lvl, -1); - YYPOS(0); - return 0; - } -#line 521 "<stdout>" -yy43: yych = *++YYCURSOR; - switch(yych){ - case 0x0A: goto yy41; - default: goto yy11; - } -yy44: ++YYCURSOR; - switch((yych = *YYCURSOR)) { - case 0x0A: goto yy41; - default: goto yy11; - } -} -#line 386 "bytecode.re" - - - } - -Directive: - { - YYTOKEN = YYCURSOR; - - -#line 543 "<stdout>" -{ - YYCTYPE yych; - unsigned int yyaccept = 0; - goto yy45; - ++YYCURSOR; -yy45: - if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); - yych = *YYCURSOR; - switch(yych){ - case 0x00: goto yy47; - case 'V': goto yy48; - default: goto yy50; - } -yy47: YYCURSOR = YYMARKER; - switch(yyaccept){ - case 0: goto yy49; - } -yy48: yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - switch(yych){ - case '.': - case '/': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case ':': - case ';': - case '<': - case '=': - case '>': - case '?': - case '@': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '[': - case '\\': - case ']': - case '^': - case '_': case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto yy51; - default: goto yy49; - } -yy49: -#line 399 "bytecode.re" -{ YYCURSOR = YYTOKEN; - return YAML_DOCSEP; - } -#line 646 "<stdout>" -yy50: yych = *++YYCURSOR; - goto yy49; -yy51: ++YYCURSOR; - if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); - yych = *YYCURSOR; - goto yy52; -yy52: switch(yych){ - case '.': - case '/': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': case ';': - case '<': - case '=': - case '>': - case '?': - case '@': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '[': - case '\\': - case ']': - case '^': - case '_': case 'a': - case 'b': - case 'c': - c (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/