From d578f9d32e4c13df9ebf51873ae335c5e5a795ce Mon Sep 17 00:00:00 2001 From: why Date: Tue, 20 Sep 2005 06:50:20 +0000 Subject: * ext/syck/emitter.c (syck_scan_scalar): prevent indicators from appearing alone or at the end of plain scalars. [ruby-core:5826] * ext/syck/emitter.c (syck_emit_scalar): treat typed scalar nodes as complex keys. * lib/syck.h: version 0.60. * lib/yaml/basenode.rb (YAML::BaseNode#at): transform keys during key searches. * ext/syck/rubyext.c: loading of binary-typed nodes. prevent emission of plain strings that look like symbols, but which aren't. * ext/syck/emitter.c (syck_emit): passing an int* value to the long* parameter causes unaligned access on LP64 systems. [ruby-dev:27161] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 16 +++ ext/syck/bytecode.c | 233 ++++++++++++++++++++--------------------- ext/syck/emitter.c | 34 ++++-- ext/syck/handler.c | 1 - ext/syck/implicit.c | 150 +++++++++++++-------------- ext/syck/syck.h | 2 +- ext/syck/token.c | 281 +++++++++++++++++++++++++------------------------- ext/syck/yaml2byte.c | 15 ++- lib/yaml/basenode.rb | 14 +-- lib/yaml/rubytypes.rb | 5 +- 10 files changed, 395 insertions(+), 356 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4962d9696..f00b2ffc80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Tue Sep 20 15:39:40 2005 why the lucky stiff + + * ext/syck/emitter.c (syck_scan_scalar): prevent indicators from + appearing alone or at the end of plain scalars. [ruby-core:5826] + + * ext/syck/emitter.c (syck_emit_scalar): treat typed scalar nodes + as complex keys. + + * lib/syck.h: version 0.60. + + * lib/yaml/basenode.rb (YAML::BaseNode#at): transform keys during + key searches. + + * ext/syck/rubyext.c: loading of binary-typed nodes. prevent + emission of plain strings that look like symbols, but which aren't. + Tue Sep 20 05:48:26 2005 Hirokazu Yamamoto * test/xmlrpc/test_webrick_server.rb (setup_http_server): diff --git a/ext/syck/bytecode.c b/ext/syck/bytecode.c index bae1f4f45e..567aaf52a8 100644 --- a/ext/syck/bytecode.c +++ b/ext/syck/bytecode.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.9.3 on Tue Apr 12 20:34:14 2005 */ +/* Generated by re2c 0.9.10 on Mon Sep 19 23:21:26 2005 */ #line 1 "bytecode.re" /* * bytecode.re @@ -135,7 +135,6 @@ int sycklex_bytecode_utf8( YYSTYPE *sycklval, SyckParser *parser ) { SyckLevel *lvl; - int doc_level = 0; syck_parser_ptr = parser; if ( YYCURSOR == NULL ) { @@ -149,7 +148,7 @@ sycklex_bytecode_utf8( YYSTYPE *sycklval, SyckParser *parser ) return t; } -#line 173 "bytecode.re" +#line 172 "bytecode.re" lvl = CURRENT_LEVEL(); @@ -158,22 +157,22 @@ sycklex_bytecode_utf8( YYSTYPE *sycklval, SyckParser *parser ) goto Document; } -Header: +/* Header: */ YYTOKEN = YYCURSOR; -#line 7 "" +#line 165 "" { YYCTYPE yych; unsigned int yyaccept; goto yy0; -yy1: ++YYCURSOR; + ++YYCURSOR; yy0: if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; switch(yych){ - case '\000': goto yy2; + case 0x00: goto yy2; case 'D': goto yy3; default: goto yy5; } @@ -184,22 +183,22 @@ yy2: YYCURSOR = YYMARKER; yy3: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ - case '\n': goto yy6; - case '\r': goto yy8; + case 0x0A: goto yy6; + case 0x0D: goto yy8; default: goto yy4; } yy4: -#line 200 "bytecode.re" +#line 199 "bytecode.re" { YYPOS(0); goto Document; } -#line 37 "" +#line 195 "" yy5: yych = *++YYCURSOR; goto yy4; yy6: ++YYCURSOR; goto yy7; yy7: -#line 187 "bytecode.re" +#line 186 "bytecode.re" { if ( lvl->status == syck_lvl_header ) { CHK_NL(YYCURSOR); @@ -212,14 +211,14 @@ yy7: return 0; } } -#line 56 "" +#line 214 "" yy8: ++YYCURSOR; switch((yych = *YYCURSOR)) { - case '\n': goto yy6; + case 0x0A: goto yy6; default: goto yy2; } } -#line 204 "bytecode.re" +#line 203 "bytecode.re" Document: @@ -233,19 +232,18 @@ Document: YYTOKEN = YYCURSOR; -#line 65 "" +#line 235 "" { YYCTYPE yych; - unsigned int yyaccept; goto yy9; -yy10: ++YYCURSOR; + ++YYCURSOR; yy9: if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; switch(yych){ - case '\000': goto yy30; - case '\n': goto yy27; - case '\r': goto yy29; + case 0x00: goto yy30; + case 0x0A: goto yy27; + case 0x0D: goto yy29; case 'A': goto yy19; case 'D': goto yy12; case 'E': goto yy16; @@ -260,68 +258,68 @@ yy9: } yy11:yy12: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy41; - case '\r': goto yy44; + case 0x0A: goto yy41; + case 0x0D: goto yy44; default: goto yy11; } yy13: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy41; - case '\r': goto yy43; + case 0x0A: goto yy41; + case 0x0D: goto yy43; default: goto yy11; } yy14: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy38; - case '\r': goto yy40; + case 0x0A: goto yy38; + case 0x0D: goto yy40; default: goto yy11; } yy15: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy35; - case '\r': goto yy37; + case 0x0A: goto yy35; + case 0x0D: goto yy37; default: goto yy11; } yy16: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy32; - case '\r': goto yy34; + case 0x0A: goto yy32; + case 0x0D: goto yy34; default: goto yy11; } yy17: ++YYCURSOR; goto yy18; yy18: -#line 289 "bytecode.re" +#line 288 "bytecode.re" { ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_str); goto Scalar; } -#line 127 "" +#line 296 "" yy19: ++YYCURSOR; goto yy20; yy20: -#line 293 "bytecode.re" +#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 138 "" +#line 307 "" yy21: ++YYCURSOR; goto yy22; yy22: -#line 300 "bytecode.re" +#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 149 "" +#line 318 "" yy23: ++YYCURSOR; goto yy24; yy24: -#line 307 "bytecode.re" +#line 306 "bytecode.re" { char *qstr; ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_open); qstr = get_inline( parser ); @@ -381,17 +379,17 @@ yy24: sycklval->name = qstr; return YAML_TAGURI; } -#line 213 "" +#line 382 "" yy25: ++YYCURSOR; goto yy26; yy26: -#line 367 "bytecode.re" +#line 366 "bytecode.re" { goto Comment; } -#line 219 "" +#line 388 "" yy27: ++YYCURSOR; goto yy28; yy28: -#line 369 "bytecode.re" +#line 368 "bytecode.re" { CHK_NL(YYCURSOR); if ( lvl->status == syck_lvl_seq ) { @@ -404,25 +402,25 @@ yy28: } goto Document; } -#line 236 "" +#line 405 "" yy29: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy27; + case 0x0A: goto yy27; default: goto yy11; } yy30: ++YYCURSOR; goto yy31; yy31: -#line 382 "bytecode.re" +#line 381 "bytecode.re" { ENSURE_YAML_IEND(lvl, -1); YYPOS(0); return 0; } -#line 250 "" +#line 419 "" yy32: ++YYCURSOR; goto yy33; yy33: -#line 253 "bytecode.re" +#line 252 "bytecode.re" { if ( lvl->status == syck_lvl_seq && lvl->ncount == 0 ) { lvl->ncount++; @@ -458,16 +456,16 @@ yy33: CHK_NL(YYCURSOR); return YAML_IEND; } -#line 290 "" +#line 459 "" yy34: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy32; + case 0x0A: goto yy32; default: goto yy11; } yy35: ++YYCURSOR; goto yy36; yy36: -#line 238 "bytecode.re" +#line 237 "bytecode.re" { int complex = 0; if ( lvl->ncount % 2 == 0 && ( lvl->status == syck_lvl_map || lvl->status == syck_lvl_seq ) ) { @@ -482,16 +480,16 @@ yy36: } return YAML_IOPEN; } -#line 314 "" +#line 483 "" yy37: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy35; + case 0x0A: goto yy35; default: goto yy11; } yy38: ++YYCURSOR; goto yy39; yy39: -#line 223 "bytecode.re" +#line 222 "bytecode.re" { int complex = 0; if ( lvl->ncount % 2 == 0 && ( lvl->status == syck_lvl_map || lvl->status == syck_lvl_seq ) ) { @@ -506,33 +504,33 @@ yy39: } return YAML_IOPEN; } -#line 338 "" +#line 507 "" yy40: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy38; + case 0x0A: goto yy38; default: goto yy11; } yy41: ++YYCURSOR; goto yy42; yy42: -#line 218 "bytecode.re" +#line 217 "bytecode.re" { ENSURE_YAML_IEND(lvl, -1); YYPOS(0); return 0; } -#line 352 "" +#line 521 "" yy43: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy41; + case 0x0A: goto yy41; default: goto yy11; } yy44: ++YYCURSOR; switch((yych = *YYCURSOR)) { - case '\n': goto yy41; + case 0x0A: goto yy41; default: goto yy11; } } -#line 387 "bytecode.re" +#line 386 "bytecode.re" } @@ -542,17 +540,17 @@ Directive: YYTOKEN = YYCURSOR; -#line 366 "" +#line 543 "" { YYCTYPE yych; unsigned int yyaccept; goto yy45; -yy46: ++YYCURSOR; + ++YYCURSOR; yy45: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; switch(yych){ - case '\000': goto yy47; + case 0x00: goto yy47; case 'V': goto yy48; default: goto yy50; } @@ -641,15 +639,15 @@ yy48: yyaccept = 0; default: goto yy49; } yy49: -#line 400 "bytecode.re" +#line 399 "bytecode.re" { YYCURSOR = YYTOKEN; return YAML_DOCSEP; } -#line 469 "" +#line 646 "" yy50: yych = *++YYCURSOR; goto yy49; yy51: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; goto yy52; yy52: switch(yych){ @@ -809,12 +807,12 @@ yy53: yych = *++YYCURSOR; default: goto yy47; } yy54: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; goto yy55; yy55: switch(yych){ - case '\n': goto yy56; - case '\r': goto yy58; + case 0x0A: goto yy56; + case 0x0D: goto yy58; case '.': case '/': case '0': @@ -895,17 +893,17 @@ yy55: switch(yych){ yy56: ++YYCURSOR; goto yy57; yy57: -#line 397 "bytecode.re" +#line 396 "bytecode.re" { CHK_NL(YYCURSOR); goto Directive; } -#line 724 "" +#line 899 "" yy58: ++YYCURSOR; switch((yych = *YYCURSOR)) { - case '\n': goto yy56; + case 0x0A: goto yy56; default: goto yy47; } } -#line 403 "bytecode.re" +#line 402 "bytecode.re" } @@ -915,44 +913,43 @@ Comment: YYTOKEN = YYCURSOR; -#line 733 "" +#line 916 "" { YYCTYPE yych; - unsigned int yyaccept; goto yy59; -yy60: ++YYCURSOR; + ++YYCURSOR; yy59: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; switch(yych){ - case '\000': goto yy61; - case '\n': goto yy62; - case '\r': goto yy64; + case 0x00: goto yy61; + case 0x0A: goto yy62; + case 0x0D: goto yy64; default: goto yy66; } yy61:yy62: ++YYCURSOR; goto yy63; yy63: -#line 413 "bytecode.re" +#line 412 "bytecode.re" { CHK_NL(YYCURSOR); goto Document; } -#line 754 "" +#line 936 "" yy64: ++YYCURSOR; switch((yych = *YYCURSOR)) { - case '\n': goto yy67; + case 0x0A: goto yy67; default: goto yy65; } yy65: -#line 416 "bytecode.re" +#line 415 "bytecode.re" { goto Comment; } -#line 763 "" +#line 945 "" yy66: yych = *++YYCURSOR; goto yy65; yy67: ++YYCURSOR; yych = *YYCURSOR; goto yy63; } -#line 418 "bytecode.re" +#line 417 "bytecode.re" } @@ -970,19 +967,18 @@ Scalar2: tok = YYCURSOR; -#line 771 "" +#line 970 "" { YYCTYPE yych; - unsigned int yyaccept; goto yy68; -yy69: ++YYCURSOR; + ++YYCURSOR; yy68: if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; switch(yych){ - case '\000': goto yy74; - case '\n': goto yy70; - case '\r': goto yy72; + case 0x00: goto yy74; + case 0x0A: goto yy70; + case 0x0D: goto yy72; default: goto yy76; } yy70: ++YYCURSOR; @@ -993,30 +989,30 @@ yy70: ++YYCURSOR; default: goto yy71; } yy71: -#line 462 "bytecode.re" +#line 461 "bytecode.re" { YYCURSOR = tok; goto ScalarEnd; } -#line 798 "" +#line 996 "" yy72: ++YYCURSOR; switch((yych = *YYCURSOR)) { - case '\n': goto yy77; + case 0x0A: goto yy77; default: goto yy73; } yy73: -#line 470 "bytecode.re" +#line 469 "bytecode.re" { CAT(str, cap, idx, tok[0]); goto Scalar2; } -#line 809 "" +#line 1007 "" yy74: ++YYCURSOR; goto yy75; yy75: -#line 466 "bytecode.re" +#line 465 "bytecode.re" { YYCURSOR = tok; goto ScalarEnd; } -#line 817 "" +#line 1015 "" yy76: yych = *++YYCURSOR; goto yy73; yy77: yych = *++YYCURSOR; @@ -1029,10 +1025,10 @@ yy77: yych = *++YYCURSOR; yy78: ++YYCURSOR; goto yy79; yy79: -#line 436 "bytecode.re" +#line 435 "bytecode.re" { CHK_NL(tok+1); goto Scalar2; } -#line 833 "" +#line 1031 "" yy80: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; @@ -1051,7 +1047,7 @@ yy81: switch(yych){ default: goto yy82; } yy82: -#line 439 "bytecode.re" +#line 438 "bytecode.re" { CHK_NL(tok+1); if ( tok + 2 < YYCURSOR ) { @@ -1069,18 +1065,18 @@ yy82: } goto Scalar2; } -#line 871 "" +#line 1068 "" yy83: ++YYCURSOR; goto yy84; yy84: -#line 457 "bytecode.re" +#line 456 "bytecode.re" { CHK_NL(tok+1); CAT(str, cap, idx, '\0'); goto Scalar2; } -#line 880 "" +#line 1077 "" } -#line 474 "bytecode.re" +#line 473 "bytecode.re" ScalarEnd: @@ -1115,54 +1111,53 @@ Inline: tok = YYCURSOR; -#line 884 "" +#line 1114 "" { YYCTYPE yych; - unsigned int yyaccept; goto yy85; -yy86: ++YYCURSOR; + ++YYCURSOR; yy85: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; switch(yych){ - case '\000': goto yy91; - case '\n': goto yy87; - case '\r': goto yy89; + case 0x00: goto yy91; + case 0x0A: goto yy87; + case 0x0D: goto yy89; default: goto yy93; } yy87: ++YYCURSOR; goto yy88; yy88: -#line 509 "bytecode.re" +#line 508 "bytecode.re" { CHK_NL(YYCURSOR); return str; } -#line 905 "" +#line 1134 "" yy89: ++YYCURSOR; switch((yych = *YYCURSOR)) { - case '\n': goto yy94; + case 0x0A: goto yy94; default: goto yy90; } yy90: -#line 516 "bytecode.re" +#line 515 "bytecode.re" { CAT(str, cap, idx, tok[0]); goto Inline; } -#line 916 "" +#line 1145 "" yy91: ++YYCURSOR; goto yy92; yy92: -#line 512 "bytecode.re" +#line 511 "bytecode.re" { YYCURSOR = tok; return str; } -#line 924 "" +#line 1153 "" yy93: yych = *++YYCURSOR; goto yy90; yy94: ++YYCURSOR; yych = *YYCURSOR; goto yy88; } -#line 520 "bytecode.re" +#line 519 "bytecode.re" } diff --git a/ext/syck/emitter.c b/ext/syck/emitter.c index 6a5e43c9ee..f5de4b841a 100644 --- a/ext/syck/emitter.c +++ b/ext/syck/emitter.c @@ -359,7 +359,8 @@ syck_emit( SyckEmitter *e, st_data_t n ) { SYMID oid; char *anchor_name = NULL; - int indent = 0, x = 0; + int indent = 0; + long x = 0; SyckLevel *lvl = syck_emitter_current_level( e ); /* @@ -559,7 +560,8 @@ syck_scan_scalar( int req_width, char *cursor, long len ) } if ( ( cursor[0] == '-' || cursor[0] == ':' || cursor[0] == '?' || cursor[0] == ',' ) && - cursor[1] == ' ' ) { + ( cursor[1] == ' ' || cursor[1] == '\n' || len == 1 ) ) + { flags |= SCAN_INDIC_S; } @@ -618,11 +620,13 @@ syck_scan_scalar( int req_width, char *cursor, long len ) } /* remember, if plain collections get implemented, to add nb-plain-flow-char */ else if ( ( cursor[i] == ' ' && cursor[i+1] == '#' ) || - ( cursor[i] == ':' && cursor[i+1] == ' ' ) ) + ( cursor[i] == ':' && + ( cursor[i+1] == ' ' || cursor[i+1] == '\n' || i == len - 1 ) ) ) { flags |= SCAN_INDIC_C; } - else if ( cursor[i] == ',' && cursor[i+1] == ' ' ) + else if ( cursor[i] == ',' && + ( cursor[i+1] == ' ' || cursor[i+1] == '\n' || i == len - 1 ) ) { flags |= SCAN_FLOWMAP; flags |= SCAN_FLOWSEQ; @@ -642,7 +646,7 @@ void syck_emit_scalar( SyckEmitter *e, char *tag, enum scalar_style force_style, enum scalar_style favor_style = scalar_literal; SyckLevel *parent = syck_emitter_parent_level( e ); SyckLevel *lvl = syck_emitter_current_level( e ); - int scan; + int scan = 0; char *implicit; if ( str == NULL ) str = ""; @@ -663,6 +667,14 @@ void syck_emit_scalar( SyckEmitter *e, char *tag, enum scalar_style force_style, if ( syck_tagcmp( tag, implicit ) != 0 && syck_tagcmp( tag, "tag:yaml.org,2002:str" ) == 0 ) { force_style = scalar_2quote; } else { + /* complex key */ + if ( parent->status == syck_lvl_map && parent->ncount % 2 == 1 && + ( !( tag == NULL || + ( implicit != NULL && syck_tagcmp( tag, implicit ) == 0 && e->explicit_typing == 0 ) ) ) ) + { + syck_emitter_write( e, "? ", 2 ); + parent->status = syck_lvl_mapx; + } syck_emit_tag( e, tag, implicit ); } S_FREE( implicit ); @@ -710,7 +722,7 @@ void syck_emit_scalar( SyckEmitter *e, char *tag, enum scalar_style force_style, } /* For now, all ambiguous keys are going to be double-quoted */ - if ( parent->status == syck_lvl_map && parent->ncount % 2 == 1 ) { + if ( ( parent->status == syck_lvl_map || parent->status == syck_lvl_mapx ) && parent->ncount % 2 == 1 ) { if ( force_style != scalar_plain ) { force_style = scalar_2quote; } @@ -737,6 +749,7 @@ void syck_emit_scalar( SyckEmitter *e, char *tag, enum scalar_style force_style, syck_emit_1quoted( e, force_width, str, len ); break; + case scalar_none: case scalar_2quote: syck_emit_2quoted( e, force_width, str, len ); break; @@ -753,6 +766,11 @@ void syck_emit_scalar( SyckEmitter *e, char *tag, enum scalar_style force_style, syck_emitter_write( e, str, len ); break; } + + if ( parent->status == syck_lvl_mapx ) + { + syck_emitter_write( e, "\n", 1 ); + } } void @@ -1122,6 +1140,8 @@ void syck_emit_item( SyckEmitter *e, st_data_t n ) } } break; + + default: break; } lvl->ncount++; @@ -1162,6 +1182,8 @@ void syck_emit_end( SyckEmitter *e ) case syck_lvl_imap: syck_emitter_write( e, "}\n", 1 ); break; + + default: break; } } diff --git a/ext/syck/handler.c b/ext/syck/handler.c index d070efa8e5..56fe838fbd 100644 --- a/ext/syck/handler.c +++ b/ext/syck/handler.c @@ -31,7 +31,6 @@ syck_hdlr_add_node( SyckParser *p, SyckNode *n ) SyckNode * syck_hdlr_add_anchor( SyckParser *p, char *a, SyckNode *n ) { - char *atmp = NULL; SyckNode *ntmp = NULL; n->anchor = a; diff --git a/ext/syck/implicit.c b/ext/syck/implicit.c index cce7a9f4e3..d8016986b4 100644 --- a/ext/syck/implicit.c +++ b/ext/syck/implicit.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.9.3 on Wed Mar 30 08:27:25 2005 */ +/* Generated by re2c 0.9.10 on Mon Sep 19 21:46:50 2005 */ #line 1 "implicit.re" /* * implicit.re @@ -52,17 +52,17 @@ char *syck_match_implicit( char *str, size_t len ) limit = str + len; -#line 6 "" +#line 55 "" { YYCTYPE yych; unsigned int yyaccept; goto yy0; -yy1: ++YYCURSOR; + ++YYCURSOR; yy0: if((YYLIMIT - YYCURSOR) < 26) YYFILL(26); yych = *YYCURSOR; switch(yych){ - case '\000': goto yy6; + case 0x00: goto yy6; case '+': goto yy16; case '-': goto yy17; case '.': goto yy20; @@ -92,12 +92,12 @@ yy0: default: goto yy23; } yy2: ++YYCURSOR; - if((yych = *YYCURSOR) <= '\000') goto yy6; + if((yych = *YYCURSOR) <= 0x00) goto yy6; goto yy3; yy3: #line 123 "implicit.re" { return "str"; } -#line 51 "" +#line 100 "" yy4: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ @@ -118,7 +118,7 @@ yy6: ++YYCURSOR; yy7: #line 85 "implicit.re" { return "null"; } -#line 72 "" +#line 121 "" yy8: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ @@ -208,7 +208,7 @@ yy17: yyaccept = 0; yy18: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ - case '\000': goto yy52; + case 0x00: goto yy52; case ',': goto yy142; case '.': goto yy50; case '0': @@ -228,7 +228,7 @@ yy18: yyaccept = 0; yy19: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ - case '\000': goto yy52; + case 0x00: goto yy52; case ',': goto yy47; case '.': goto yy50; case '0': @@ -254,7 +254,7 @@ yy20: yyaccept = 0; default: goto yy3; } yy21: yych = *++YYCURSOR; - if(yych <= '\000') goto yy28; + if(yych <= 0x00) goto yy28; goto yy3; yy22: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); @@ -265,7 +265,7 @@ yy22: yyaccept = 0; yy23: yych = *++YYCURSOR; goto yy3; yy24: yych = *++YYCURSOR; - if(yych <= '\000') goto yy26; + if(yych <= 0x00) goto yy26; goto yy25; yy25: YYCURSOR = YYMARKER; switch(yyaccept){ @@ -276,13 +276,13 @@ yy26: ++YYCURSOR; yy27: #line 121 "implicit.re" { return "merge"; } -#line 230 "" +#line 279 "" yy28: ++YYCURSOR; goto yy29; yy29: #line 119 "implicit.re" { return "default"; } -#line 236 "" +#line 285 "" yy30: yych = *++YYCURSOR; switch(yych){ case 'a': goto yy45; @@ -316,14 +316,14 @@ yy35: yych = *++YYCURSOR; default: goto yy25; } yy36: yych = *++YYCURSOR; - if(yych >= '\001') goto yy25; + if(yych >= 0x01) goto yy25; goto yy37; yy37: ++YYCURSOR; goto yy38; yy38: #line 105 "implicit.re" { return "float#inf"; } -#line 277 "" +#line 326 "" yy39: yych = *++YYCURSOR; switch(yych){ case 'f': goto yy36; @@ -340,14 +340,14 @@ yy41: yych = *++YYCURSOR; default: goto yy25; } yy42: yych = *++YYCURSOR; - if(yych >= '\001') goto yy25; + if(yych >= 0x01) goto yy25; goto yy43; yy43: ++YYCURSOR; goto yy44; yy44: #line 109 "implicit.re" { return "float#nan"; } -#line 301 "" +#line 350 "" yy45: yych = *++YYCURSOR; switch(yych){ case 'n': goto yy42; @@ -372,7 +372,7 @@ yy47: ++YYCURSOR; yych = *YYCURSOR; goto yy48; yy48: switch(yych){ - case '\000': goto yy52; + case 0x00: goto yy52; case ',': case '0': case '1': case '2': @@ -404,11 +404,11 @@ yy49: ++YYCURSOR; default: goto yy25; } yy50: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; goto yy51; yy51: switch(yych){ - case '\000': goto yy56; + case 0x00: goto yy56; case ',': goto yy54; case '.': goto yy58; case '0': @@ -429,13 +429,13 @@ yy52: ++YYCURSOR; yy53: #line 97 "implicit.re" { return "int"; } -#line 386 "" +#line 432 "" yy54: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy55; yy55: switch(yych){ - case '\000': goto yy56; + case 0x00: goto yy56; case ',': case '0': case '1': case '2': @@ -453,9 +453,9 @@ yy56: ++YYCURSOR; yy57: #line 99 "implicit.re" { return "float#fix"; } -#line 411 "" +#line 456 "" yy58: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; goto yy59; yy59: switch(yych){ @@ -478,14 +478,14 @@ yy60: yych = *++YYCURSOR; default: goto yy25; } yy61: yych = *++YYCURSOR; - if(yych <= '\000') goto yy25; + if(yych <= 0x00) goto yy25; goto yy63; yy62: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy63; yy63: switch(yych){ - case '\000': goto yy64; + case 0x00: goto yy64; case '0': case '1': case '2': @@ -503,12 +503,12 @@ yy64: ++YYCURSOR; yy65: #line 101 "implicit.re" { return "float#exp"; } -#line 463 "" +#line 506 "" yy66: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; switch(yych){ - case '\000': goto yy70; + case 0x00: goto yy70; case '.': goto yy68; case '0': case '1': @@ -527,7 +527,7 @@ yy67: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; switch(yych){ - case '\000': goto yy70; + case 0x00: goto yy70; case '.': goto yy68; case ':': goto yy49; default: goto yy25; @@ -537,7 +537,7 @@ yy68: ++YYCURSOR; yych = *YYCURSOR; goto yy69; yy69: switch(yych){ - case '\000': goto yy72; + case 0x00: goto yy72; case ',': case '0': case '1': case '2': @@ -555,13 +555,13 @@ yy70: ++YYCURSOR; yy71: #line 95 "implicit.re" { return "int#base60"; } -#line 518 "" +#line 558 "" yy72: ++YYCURSOR; goto yy73; yy73: #line 103 "implicit.re" { return "float#base60"; } -#line 524 "" +#line 564 "" yy74: yych = *++YYCURSOR; switch(yych){ case '0': @@ -644,7 +644,7 @@ yy80: yych = *++YYCURSOR; } yy81: yych = *++YYCURSOR; switch(yych){ - case '\000': goto yy82; + case 0x00: goto yy82; case '0': case '1': case '2': @@ -664,7 +664,7 @@ yy82: ++YYCURSOR; yy83: #line 111 "implicit.re" { return "timestamp#ymd"; } -#line 627 "" +#line 667 "" yy84: yych = *++YYCURSOR; switch(yych){ case '0': @@ -694,11 +694,11 @@ yy85: yych = *++YYCURSOR; default: goto yy25; } yy86: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 9) YYFILL(9); yych = *YYCURSOR; goto yy87; yy87: switch(yych){ - case '\t': case ' ': goto yy86; + case 0x09: case ' ': goto yy86; case '0': case '1': case '2': @@ -793,7 +793,7 @@ yy94: yych = *++YYCURSOR; } yy95: yych = *++YYCURSOR; switch(yych){ - case '\t': case ' ': goto yy98; + case 0x09: case ' ': goto yy98; case '.': goto yy96; default: goto yy25; } @@ -802,7 +802,7 @@ yy96: ++YYCURSOR; yych = *YYCURSOR; goto yy97; yy97: switch(yych){ - case '\t': case ' ': goto yy98; + case 0x09: case ' ': goto yy98; case '0': case '1': case '2': @@ -816,17 +816,17 @@ yy97: switch(yych){ default: goto yy25; } yy98: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 7) YYFILL(7); yych = *YYCURSOR; goto yy99; yy99: switch(yych){ - case '\t': case ' ': goto yy98; + case 0x09: case ' ': goto yy98; case '+': case '-': goto yy101; case 'Z': goto yy100; default: goto yy25; } yy100: yych = *++YYCURSOR; - if(yych <= '\000') goto yy105; + if(yych <= 0x00) goto yy105; goto yy25; yy101: yych = *++YYCURSOR; switch(yych){ @@ -858,7 +858,7 @@ yy102: yych = *++YYCURSOR; } yy103: yych = *++YYCURSOR; switch(yych){ - case '\000': goto yy105; + case 0x00: goto yy105; case ':': goto yy104; default: goto yy25; } @@ -881,7 +881,7 @@ yy105: ++YYCURSOR; yy106: #line 115 "implicit.re" { return "timestamp#spaced"; } -#line 847 "" +#line 884 "" yy107: yych = *++YYCURSOR; switch(yych){ case '0': @@ -992,7 +992,7 @@ yy115: yych = *++YYCURSOR; default: goto yy117; } yy116: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 7) YYFILL(7); yych = *YYCURSOR; goto yy117; yy117: switch(yych){ @@ -1011,7 +1011,7 @@ yy117: switch(yych){ default: goto yy25; } yy118: yych = *++YYCURSOR; - if(yych <= '\000') goto yy123; + if(yych <= 0x00) goto yy123; goto yy25; yy119: yych = *++YYCURSOR; switch(yych){ @@ -1043,7 +1043,7 @@ yy120: yych = *++YYCURSOR; } yy121: yych = *++YYCURSOR; switch(yych){ - case '\000': goto yy123; + case 0x00: goto yy123; case ':': goto yy122; default: goto yy25; } @@ -1066,7 +1066,7 @@ yy123: ++YYCURSOR; yy124: #line 113 "implicit.re" { return "timestamp#iso8601"; } -#line 1033 "" +#line 1069 "" yy125: yych = *++YYCURSOR; switch(yych){ case '0': @@ -1197,7 +1197,7 @@ yy135: switch(yych){ default: goto yy25; } yy136: yych = *++YYCURSOR; - if(yych >= '\001') goto yy25; + if(yych >= 0x01) goto yy25; goto yy137; yy137: yych = *++YYCURSOR; goto yy124; @@ -1253,7 +1253,7 @@ yy142: ++YYCURSOR; yych = *YYCURSOR; goto yy143; yy143: switch(yych){ - case '\000': goto yy149; + case 0x00: goto yy149; case ',': case '0': case '1': case '2': @@ -1269,14 +1269,14 @@ yy143: switch(yych){ default: goto yy25; } yy144: yych = *++YYCURSOR; - if(yych <= '\000') goto yy25; + if(yych <= 0x00) goto yy25; goto yy146; yy145: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; goto yy146; yy146: switch(yych){ - case '\000': goto yy147; + case 0x00: goto yy147; case ',': case '0': case '1': case '2': @@ -1304,13 +1304,13 @@ yy147: ++YYCURSOR; yy148: #line 91 "implicit.re" { return "int#hex"; } -#line 1275 "" +#line 1307 "" yy149: ++YYCURSOR; goto yy150; yy150: #line 93 "implicit.re" { return "int#oct"; } -#line 1281 "" +#line 1313 "" yy151: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; @@ -1376,7 +1376,7 @@ yy157: yych = *++YYCURSOR; } yy158: yych = *++YYCURSOR; switch(yych){ - case '\000': goto yy52; + case 0x00: goto yy52; case 'x': goto yy144; default: goto yy143; } @@ -1402,14 +1402,14 @@ yy162: yych = *++YYCURSOR; default: goto yy25; } yy163: yych = *++YYCURSOR; - if(yych >= '\001') goto yy25; + if(yych >= 0x01) goto yy25; goto yy164; yy164: ++YYCURSOR; goto yy165; yy165: #line 107 "implicit.re" { return "float#neginf"; } -#line 1381 "" +#line 1412 "" yy166: yych = *++YYCURSOR; switch(yych){ case 'f': goto yy163; @@ -1442,14 +1442,14 @@ yy171: yych = *++YYCURSOR; default: goto yy25; } yy172: yych = *++YYCURSOR; - if(yych >= '\001') goto yy25; + if(yych >= 0x01) goto yy25; goto yy173; yy173: ++YYCURSOR; goto yy174; yy174: #line 89 "implicit.re" { return "bool#no"; } -#line 1421 "" +#line 1452 "" yy175: yych = *++YYCURSOR; switch(yych){ case 'S': goto yy176; @@ -1486,14 +1486,14 @@ yy181: yych = *++YYCURSOR; default: goto yy25; } yy182: yych = *++YYCURSOR; - if(yych >= '\001') goto yy25; + if(yych >= 0x01) goto yy25; goto yy183; yy183: ++YYCURSOR; goto yy184; yy184: #line 87 "implicit.re" { return "bool#yes"; } -#line 1465 "" +#line 1496 "" yy185: yych = *++YYCURSOR; switch(yych){ case 'f': goto yy172; @@ -1560,7 +1560,7 @@ yy197: yych = *++YYCURSOR; default: goto yy25; } yy198: yych = *++YYCURSOR; - if(yych <= '\000') goto yy6; + if(yych <= 0x00) goto yy6; goto yy25; yy199: yych = *++YYCURSOR; switch(yych){ @@ -1617,17 +1617,17 @@ syck_type_id_to_uri( char *type_id ) limit = type_id + strlen( type_id ); -#line 1552 "" +#line 1620 "" { YYCTYPE yych; unsigned int yyaccept; goto yy202; -yy203: ++YYCURSOR; + ++YYCURSOR; yy202: - if((YYLIMIT - YYCURSOR) < 21) YYFILL(21); + if((YYLIMIT - YYCURSOR) < 11) YYFILL(11); yych = *YYCURSOR; switch(yych){ - case '\000': goto yy204; + case 0x00: goto yy204; case '!': goto yy208; case '0': case '1': @@ -1765,7 +1765,7 @@ yy205: yyaccept = 0; yy206: #line 202 "implicit.re" { return syck_taguri( YAML_DOMAIN, type_id, strlen( type_id ) ); } -#line 1700 "" +#line 1768 "" yy207: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ @@ -1839,7 +1839,7 @@ yy208: ++YYCURSOR; yy209: #line 176 "implicit.re" { return syck_xprivate( type_id + 1, strlen( type_id ) - 1 ); } -#line 1774 "" +#line 1842 "" yy210: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ @@ -1980,7 +1980,7 @@ yy213: switch(yych){ default: goto yy204; } yy214: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; goto yy215; yy215: switch(yych){ @@ -2146,9 +2146,9 @@ yy219: S_FREE( domain ); return uri; } -#line 2084 "" +#line 2149 "" yy220: ++YYCURSOR; - if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + if((YYLIMIT - YYCURSOR) < 12) YYFILL(12); yych = *YYCURSOR; goto yy221; yy221: switch(yych){ @@ -2362,7 +2362,7 @@ yy230: S_FREE( domain ); return uri; } -#line 2302 "" +#line 2365 "" yy231: yych = *++YYCURSOR; switch(yych){ case '0': @@ -2482,7 +2482,7 @@ yy244: ++YYCURSOR; yy245: #line 174 "implicit.re" { return type_id; } -#line 2422 "" +#line 2485 "" yy246: yych = *++YYCURSOR; switch(yych){ case ',': goto yy216; @@ -2507,7 +2507,7 @@ yy248: yych = *++YYCURSOR; default: goto yy250; } yy249: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; goto yy250; yy250: switch(yych){ @@ -2725,7 +2725,7 @@ yy254: ++YYCURSOR; default: goto yy204; } yy255: ++YYCURSOR; - if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + if((YYLIMIT - YYCURSOR) < 12) YYFILL(12); yych = *YYCURSOR; goto yy256; yy256: switch(yych){ @@ -2929,7 +2929,7 @@ yy264: ++YYCURSOR; yy265: #line 172 "implicit.re" { return type_id; } -#line 2874 "" +#line 2932 "" yy266: yych = *++YYCURSOR; switch(yych){ case '0': diff --git a/ext/syck/syck.h b/ext/syck/syck.h index 02ffe240f8..4d65095e23 100644 --- a/ext/syck/syck.h +++ b/ext/syck/syck.h @@ -13,7 +13,7 @@ #define SYCK_YAML_MAJOR 1 #define SYCK_YAML_MINOR 0 -#define SYCK_VERSION "0.55" +#define SYCK_VERSION "0.60" #define YAML_DOMAIN "yaml.org,2002" #include diff --git a/ext/syck/token.c b/ext/syck/token.c index 8644058bd5..57a7910168 100644 --- a/ext/syck/token.c +++ b/ext/syck/token.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.9.10 on Sat Sep 17 00:51:29 2005 */ +/* Generated by re2c 0.9.10 on Mon Sep 19 23:23:24 2005 */ #line 1 "token.re" /* * token.re @@ -268,6 +268,7 @@ sycklex( YYSTYPE *sycklval, SyckParser *parser ) case syck_bytecode_utf8: return sycklex_bytecode_utf8( sycklval, parser ); } + return YAML_DOCSEP; } /* @@ -290,7 +291,7 @@ sycklex_yaml_utf8( YYSTYPE *sycklval, SyckParser *parser ) return t; } -#line 314 "token.re" +#line 315 "token.re" if ( YYLINEPTR != YYCURSOR ) @@ -303,7 +304,7 @@ Header: YYTOKEN = YYCURSOR; -#line 306 "" +#line 307 "" { YYCTYPE yych; unsigned int yyaccept; @@ -329,11 +330,11 @@ yy2: yyaccept = 0; default: goto yy3; } yy3: -#line 373 "token.re" +#line 374 "token.re" { YYPOS(0); goto Document; } -#line 336 "" +#line 337 "" yy4: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ @@ -343,30 +344,30 @@ yy4: yyaccept = 0; yy5: ++YYCURSOR; goto yy6; yy6: -#line 355 "token.re" +#line 356 "token.re" { eat_comments( parser ); goto Header; } -#line 350 "" +#line 351 "" yy7: ++YYCURSOR; goto yy8; yy8: -#line 359 "token.re" +#line 360 "token.re" { SyckLevel *lvl = CURRENT_LEVEL(); ENSURE_YAML_IEND(lvl, -1); YYPOS(0); return 0; } -#line 360 "" +#line 361 "" yy9: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); goto yy18; yy10: -#line 365 "token.re" +#line 366 "token.re" { GOBBLE_UP_YAML_INDENT( doc_level, YYTOKEN ); goto Header; } -#line 369 "" +#line 370 "" yy11: yych = *++YYCURSOR; switch(yych){ case 0x0A: goto yy17; @@ -376,11 +377,11 @@ yy12: ++YYCURSOR; yych = *YYCURSOR; goto yy16; yy13: -#line 369 "token.re" +#line 370 "token.re" { doc_level = YYCURSOR - YYLINEPTR; goto Header; } -#line 383 "" +#line 384 "" yy14: yych = *++YYCURSOR; goto yy3; yy15: ++YYCURSOR; @@ -428,7 +429,7 @@ yy22: yych = *++YYCURSOR; yy23: ++YYCURSOR; goto yy24; yy24: -#line 341 "token.re" +#line 342 "token.re" { SyckLevel *lvl = CURRENT_LEVEL(); if ( lvl->status == syck_lvl_header ) { @@ -442,7 +443,7 @@ yy24: } return 0; } -#line 445 "" +#line 446 "" yy25: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; @@ -471,7 +472,7 @@ yy29: yych = *++YYCURSOR; yy30: ++YYCURSOR; goto yy31; yy31: -#line 327 "token.re" +#line 328 "token.re" { SyckLevel *lvl = CURRENT_LEVEL(); if ( lvl->status == syck_lvl_header ) { @@ -485,7 +486,7 @@ yy31: return 0; } } -#line 488 "" +#line 489 "" yy32: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; @@ -500,7 +501,7 @@ yy34: ++YYCURSOR; default: goto yy20; } } -#line 377 "token.re" +#line 378 "token.re" Document: @@ -514,7 +515,7 @@ Document: YYTOKEN = YYCURSOR; -#line 517 "" +#line 518 "" { YYCTYPE yych; unsigned int yyaccept; @@ -546,7 +547,7 @@ yy37: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); goto yy92; yy38: -#line 391 "token.re" +#line 392 "token.re" { /* Isolate spaces */ int indt_len; GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN ); @@ -574,46 +575,46 @@ yy38: } return YAML_INDENT; } -#line 577 "" +#line 578 "" yy39: ++YYCURSOR; switch((yych = *YYCURSOR)) { case 0x0A: goto yy91; default: goto yy40; } yy40: -#line 495 "token.re" +#line 496 "token.re" { ENSURE_YAML_IOPEN(lvl, doc_level, 1); goto Plain; } -#line 588 "" +#line 589 "" yy41: ++YYCURSOR; goto yy42; yy42: -#line 419 "token.re" +#line 420 "token.re" { ENSURE_YAML_IOPEN(lvl, doc_level, 1); lvl = CURRENT_LEVEL(); ADD_LEVEL(lvl->spaces + 1, syck_lvl_iseq); return YYTOKEN[0]; } -#line 598 "" +#line 599 "" yy43: ++YYCURSOR; goto yy44; yy44: -#line 425 "token.re" +#line 426 "token.re" { ENSURE_YAML_IOPEN(lvl, doc_level, 1); lvl = CURRENT_LEVEL(); ADD_LEVEL(lvl->spaces + 1, syck_lvl_imap); return YYTOKEN[0]; } -#line 608 "" +#line 609 "" yy45: ++YYCURSOR; goto yy46; yy46: -#line 431 "token.re" +#line 432 "token.re" { POP_LEVEL(); return YYTOKEN[0]; } -#line 616 "" +#line 617 "" yy47: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ @@ -761,23 +762,23 @@ yy50: yych = *++YYCURSOR; yy51: ++YYCURSOR; goto yy52; yy52: -#line 469 "token.re" +#line 470 "token.re" { goto TransferMethod; } -#line 766 "" +#line 767 "" yy53: ++YYCURSOR; goto yy54; yy54: -#line 471 "token.re" +#line 472 "token.re" { ENSURE_YAML_IOPEN(lvl, doc_level, 1); goto SingleQuote; } -#line 773 "" +#line 774 "" yy55: ++YYCURSOR; goto yy56; yy56: -#line 474 "token.re" +#line 475 "token.re" { ENSURE_YAML_IOPEN(lvl, doc_level, 1); goto DoubleQuote; } -#line 780 "" +#line 781 "" yy57: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ @@ -799,27 +800,27 @@ yy57: yyaccept = 1; yy58: ++YYCURSOR; goto yy59; yy59: -#line 484 "token.re" +#line 485 "token.re" { eat_comments( parser ); goto Document; } -#line 806 "" +#line 807 "" yy60: ++YYCURSOR; yych = *YYCURSOR; goto yy66; yy61: -#line 488 "token.re" +#line 489 "token.re" { goto Document; } -#line 813 "" +#line 814 "" yy62: ++YYCURSOR; goto yy63; yy63: -#line 490 "token.re" +#line 491 "token.re" { ENSURE_YAML_IEND(lvl, -1); YYPOS(0); return 0; } -#line 822 "" +#line 823 "" yy64: yych = *++YYCURSOR; goto yy40; yy65: ++YYCURSOR; @@ -858,14 +859,14 @@ yy69: YYCURSOR = YYMARKER; yy70: ++YYCURSOR; goto yy71; yy71: -#line 477 "token.re" +#line 478 "token.re" { if ( is_newline( YYCURSOR - 1 ) ) { YYCURSOR--; } goto ScalarBlock; } -#line 868 "" +#line 869 "" yy72: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; @@ -947,12 +948,12 @@ yy76: switch(yych){ default: goto yy77; } yy77: -#line 464 "token.re" +#line 465 "token.re" { ENSURE_YAML_IOPEN(lvl, doc_level, 1); sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 ); return YAML_ALIAS; } -#line 955 "" +#line 956 "" yy78: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; @@ -1021,7 +1022,7 @@ yy79: switch(yych){ default: goto yy80; } yy80: -#line 453 "token.re" +#line 454 "token.re" { sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 ); /* @@ -1032,11 +1033,11 @@ yy80: syck_hdlr_remove_anchor(parser, sycklval->name); return YAML_ANCHOR; } -#line 1035 "" +#line 1036 "" yy81: ++YYCURSOR; goto yy82; yy82: -#line 439 "token.re" +#line 440 "token.re" { ENSURE_YAML_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1); FORCE_NEXT_TOKEN(YAML_IOPEN); if ( *YYCURSOR == '#' || is_newline( YYCURSOR ) || is_newline( YYCURSOR - 1 ) ) @@ -1050,7 +1051,7 @@ yy82: } return YYTOKEN[0]; } -#line 1053 "" +#line 1054 "" yy83: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; @@ -1067,11 +1068,11 @@ yy85: yych = *++YYCURSOR; yy86: ++YYCURSOR; goto yy87; yy87: -#line 435 "token.re" +#line 436 "token.re" { YYPOS(1); return YYTOKEN[0]; } -#line 1074 "" +#line 1075 "" yy88: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; @@ -1103,7 +1104,7 @@ yy93: ++YYCURSOR; default: goto yy69; } } -#line 499 "token.re" +#line 500 "token.re" } @@ -1112,7 +1113,7 @@ Directive: YYTOKTMP = YYCURSOR; -#line 1115 "" +#line 1116 "" { YYCTYPE yych; unsigned int yyaccept; @@ -1212,18 +1213,18 @@ yy97: yyaccept = 0; default: goto yy98; } yy98: -#line 512 "token.re" +#line 513 "token.re" { YYCURSOR = YYTOKTMP; return YAML_DOCSEP; } -#line 1219 "" +#line 1220 "" yy99: ++YYCURSOR; yych = *YYCURSOR; goto yy103; yy100: -#line 510 "token.re" +#line 511 "token.re" { goto Directive; } -#line 1226 "" +#line 1227 "" yy101: yych = *++YYCURSOR; goto yy98; yy102: ++YYCURSOR; @@ -1477,11 +1478,11 @@ yy108: switch(yych){ default: goto yy109; } yy109: -#line 508 "token.re" +#line 509 "token.re" { goto Directive; } -#line 1482 "" +#line 1483 "" } -#line 515 "token.re" +#line 516 "token.re" } @@ -1504,7 +1505,7 @@ Plain2: Plain3: -#line 1507 "" +#line 1508 "" { YYCTYPE yych; unsigned int yyaccept; @@ -1529,7 +1530,7 @@ yy112: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); goto yy142; yy113: -#line 538 "token.re" +#line 539 "token.re" { int indt_len, nl_count = 0; SyckLevel *lvl; char *tok = YYTOKEN; @@ -1543,8 +1544,8 @@ yy113: while ( YYTOKEN < YYCURSOR ) { - int nl_len = 0; - if ( nl_len = newline_len( YYTOKEN++ ) ) + int nl_len = newline_len( YYTOKEN++ ); + if ( nl_len ) { nl_count++; YYTOKEN += nl_len - 1; @@ -1565,18 +1566,18 @@ yy113: goto Plain2; } -#line 1568 "" +#line 1569 "" yy114: ++YYCURSOR; switch((yych = *YYCURSOR)) { case 0x0A: goto yy141; default: goto yy115; } yy115: -#line 625 "token.re" +#line 626 "token.re" { QUOTECATS(qstr, qcapa, qidx, YYTOKEN, YYCURSOR - YYTOKEN); goto Plain2; } -#line 1579 "" +#line 1580 "" yy116: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ @@ -1596,7 +1597,7 @@ yy117: yyaccept = 1; yy118: ++YYCURSOR; goto yy119; yy119: -#line 587 "token.re" +#line 588 "token.re" { if ( plvl->status != syck_lvl_imap ) { PLAIN_NOT_INL(); @@ -1607,11 +1608,11 @@ yy119: } RETURN_IMPLICIT(); } -#line 1610 "" +#line 1611 "" yy120: ++YYCURSOR; goto yy121; yy121: -#line 598 "token.re" +#line 599 "token.re" { if ( plvl->status != syck_lvl_iseq ) { PLAIN_NOT_INL(); @@ -1622,14 +1623,14 @@ yy121: } RETURN_IMPLICIT(); } -#line 1625 "" +#line 1626 "" yy122: ++YYCURSOR; switch((yych = *YYCURSOR)) { case '#': goto yy128; default: goto yy123; } yy123: -#line 615 "token.re" +#line 616 "token.re" { if ( qidx == 0 ) { goto Plain2; @@ -1639,13 +1640,13 @@ yy123: goto Plain3; } } -#line 1642 "" +#line 1643 "" yy124: ++YYCURSOR; goto yy125; yy125: -#line 613 "token.re" +#line 614 "token.re" { RETURN_IMPLICIT(); } -#line 1648 "" +#line 1649 "" yy126: yych = *++YYCURSOR; goto yy123; yy127: yych = *++YYCURSOR; @@ -1653,15 +1654,15 @@ yy127: yych = *++YYCURSOR; yy128: ++YYCURSOR; goto yy129; yy129: -#line 609 "token.re" +#line 610 "token.re" { eat_comments( parser ); RETURN_IMPLICIT(); } -#line 1660 "" +#line 1661 "" yy130: ++YYCURSOR; goto yy131; yy131: -#line 576 "token.re" +#line 577 "token.re" { if ( plvl->status != syck_lvl_iseq && plvl->status != syck_lvl_imap ) { PLAIN_NOT_INL(); @@ -1672,7 +1673,7 @@ yy131: } RETURN_IMPLICIT(); } -#line 1675 "" +#line 1676 "" yy132: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; @@ -1694,9 +1695,9 @@ yy135: YYCURSOR = YYMARKER; yy136: ++YYCURSOR; goto yy137; yy137: -#line 574 "token.re" +#line 575 "token.re" { RETURN_IMPLICIT(); } -#line 1699 "" +#line 1700 "" yy138: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; @@ -1728,7 +1729,7 @@ yy143: ++YYCURSOR; default: goto yy135; } } -#line 629 "token.re" +#line 630 "token.re" } @@ -1742,7 +1743,7 @@ SingleQuote2: YYTOKEN = YYCURSOR; -#line 1745 "" +#line 1746 "" { YYCTYPE yych; unsigned int yyaccept; @@ -1762,7 +1763,7 @@ yy146: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); goto yy157; yy147: -#line 643 "token.re" +#line 644 "token.re" { int indt_len; int nl_count = 0; SyckLevel *lvl; @@ -1780,8 +1781,8 @@ yy147: while ( YYTOKEN < YYCURSOR ) { - int nl_len = 0; - if ( nl_len = newline_len( YYTOKEN++ ) ) + int nl_len = newline_len( YYTOKEN++ ); + if ( nl_len ) { nl_count++; YYTOKEN += nl_len - 1; @@ -1802,25 +1803,25 @@ yy147: goto SingleQuote2; } -#line 1805 "" +#line 1806 "" yy148: ++YYCURSOR; switch((yych = *YYCURSOR)) { case 0x0A: goto yy156; default: goto yy149; } yy149: -#line 710 "token.re" +#line 711 "token.re" { QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1)); goto SingleQuote2; } -#line 1816 "" +#line 1817 "" yy150: ++YYCURSOR; switch((yych = *YYCURSOR)) { case '\'': goto yy154; default: goto yy151; } yy151: -#line 687 "token.re" +#line 688 "token.re" { SyckLevel *lvl; SyckNode *n = syck_alloc_str(); lvl = CURRENT_LEVEL(); @@ -1843,7 +1844,7 @@ yy151: sycklval->nodeData = n; return YAML_PLAIN; } -#line 1846 "" +#line 1847 "" yy152: yych = *++YYCURSOR; goto yy151; yy153: yych = *++YYCURSOR; @@ -1851,11 +1852,11 @@ yy153: yych = *++YYCURSOR; yy154: ++YYCURSOR; goto yy155; yy155: -#line 683 "token.re" +#line 684 "token.re" { QUOTECAT(qstr, qcapa, qidx, '\''); goto SingleQuote2; } -#line 1858 "" +#line 1859 "" yy156: yyaccept = 0; YYMARKER = ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -1878,7 +1879,7 @@ yy159: YYCURSOR = YYMARKER; case 0: goto yy147; } } -#line 714 "token.re" +#line 715 "token.re" } @@ -1896,7 +1897,7 @@ DoubleQuote2: -#line 1899 "" +#line 1900 "" { YYCTYPE yych; unsigned int yyaccept; @@ -1917,7 +1918,7 @@ yy162: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); goto yy184; yy163: -#line 732 "token.re" +#line 733 "token.re" { int indt_len; int nl_count = 0; SyckLevel *lvl; @@ -1937,8 +1938,8 @@ yy163: { while ( YYTOKEN < YYCURSOR ) { - int nl_len = 0; - if ( nl_len = newline_len( YYTOKEN++ ) ) + int nl_len = newline_len( YYTOKEN++ ); + if ( nl_len ) { nl_count++; YYTOKEN += nl_len - 1; @@ -1961,18 +1962,18 @@ yy163: keep_nl = 1; goto DoubleQuote2; } -#line 1964 "" +#line 1965 "" yy164: ++YYCURSOR; switch((yych = *YYCURSOR)) { case 0x0A: goto yy183; default: goto yy165; } yy165: -#line 818 "token.re" +#line 819 "token.re" { QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1)); goto DoubleQuote2; } -#line 1975 "" +#line 1976 "" yy166: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ @@ -1988,7 +1989,7 @@ yy166: yyaccept = 1; yy167: ++YYCURSOR; goto yy168; yy168: -#line 795 "token.re" +#line 796 "token.re" { SyckLevel *lvl; SyckNode *n = syck_alloc_str(); lvl = CURRENT_LEVEL(); @@ -2011,7 +2012,7 @@ yy168: sycklval->nodeData = n; return YAML_PLAIN; } -#line 2014 "" +#line 2015 "" yy169: yych = *++YYCURSOR; goto yy168; yy170: yych = *++YYCURSOR; @@ -2034,12 +2035,12 @@ yy173: YYCURSOR = YYMARKER; yy174: ++YYCURSOR; goto yy175; yy175: -#line 790 "token.re" +#line 791 "token.re" { keep_nl = 0; YYCURSOR--; goto DoubleQuote2; } -#line 2042 "" +#line 2043 "" yy176: yych = *++YYCURSOR; switch(yych){ case 0x0A: goto yy174; @@ -2072,12 +2073,12 @@ yy177: yych = *++YYCURSOR; yy178: ++YYCURSOR; goto yy179; yy179: -#line 776 "token.re" +#line 777 "token.re" { char ch = *( YYCURSOR - 1 ); QUOTECAT(qstr, qcapa, qidx, escape_seq( ch )); goto DoubleQuote2; } -#line 2080 "" +#line 2081 "" yy180: yych = *++YYCURSOR; switch(yych){ case '0': @@ -2105,7 +2106,7 @@ yy180: yych = *++YYCURSOR; yy181: ++YYCURSOR; goto yy182; yy182: -#line 781 "token.re" +#line 782 "token.re" { long ch; char *chr_text = syck_strndup( YYTOKEN, 4 ); chr_text[0] = '0'; @@ -2114,7 +2115,7 @@ yy182: QUOTECAT(qstr, qcapa, qidx, ch); goto DoubleQuote2; } -#line 2117 "" +#line 2118 "" yy183: yyaccept = 0; YYMARKER = ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -2133,7 +2134,7 @@ yy185: ++YYCURSOR; default: goto yy173; } } -#line 822 "token.re" +#line 823 "token.re" } @@ -2147,7 +2148,7 @@ TransferMethod2: YYTOKTMP = YYCURSOR; -#line 2150 "" +#line 2151 "" { YYCTYPE yych; unsigned int yyaccept; @@ -2167,7 +2168,7 @@ yy186: yy188: ++YYCURSOR; goto yy189; yy189: -#line 836 "token.re" +#line 837 "token.re" { SyckLevel *lvl; YYCURSOR = YYTOKTMP; if ( YYCURSOR == YYTOKEN + 1 ) @@ -2217,7 +2218,7 @@ yy189: return YAML_TRANSFER; } -#line 2220 "" +#line 2221 "" yy190: yych = *++YYCURSOR; goto yy189; yy191: yych = *++YYCURSOR; @@ -2228,11 +2229,11 @@ yy192: ++YYCURSOR; default: goto yy193; } yy193: -#line 903 "token.re" +#line 904 "token.re" { QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1)); goto TransferMethod2; } -#line 2235 "" +#line 2236 "" yy194: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ @@ -2275,12 +2276,12 @@ yy197: YYCURSOR = YYMARKER; yy198: ++YYCURSOR; goto yy199; yy199: -#line 889 "token.re" +#line 890 "token.re" { char ch = *( YYCURSOR - 1 ); QUOTECAT(qstr, qcapa, qidx, escape_seq( ch )); goto TransferMethod2; } -#line 2283 "" +#line 2284 "" yy200: yych = *++YYCURSOR; switch(yych){ case '0': @@ -2308,7 +2309,7 @@ yy200: yych = *++YYCURSOR; yy201: ++YYCURSOR; goto yy202; yy202: -#line 894 "token.re" +#line 895 "token.re" { long ch; char *chr_text = syck_strndup( YYTOKTMP, 4 ); chr_text[0] = '0'; @@ -2317,7 +2318,7 @@ yy202: QUOTECAT(qstr, qcapa, qidx, ch); goto TransferMethod2; } -#line 2320 "" +#line 2321 "" yy203: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; @@ -2327,7 +2328,7 @@ yy204: switch(yych){ default: goto yy189; } } -#line 908 "token.re" +#line 909 "token.re" } @@ -2374,7 +2375,7 @@ ScalarBlock2: YYTOKEN = YYCURSOR; -#line 2377 "" +#line 2378 "" { YYCTYPE yych; unsigned int yyaccept; @@ -2395,7 +2396,7 @@ yy207: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); goto yy226; yy208: -#line 955 "token.re" +#line 956 "token.re" { char *pacer; char *tok = YYTOKEN; int indt_len = 0, nl_count = 0, fold_nl = 0, nl_begin = 0; @@ -2428,8 +2429,8 @@ yy208: pacer = YYTOKEN; while ( pacer < YYCURSOR ) { - int nl_len = 0; - if ( nl_len = newline_len( pacer++ ) ) + int nl_len = newline_len( pacer++ ); + if ( nl_len ) { nl_count++; pacer += nl_len - 1; @@ -2465,22 +2466,22 @@ yy208: } goto ScalarBlock2; } -#line 2468 "" +#line 2469 "" yy209: ++YYCURSOR; switch((yych = *YYCURSOR)) { case 0x0A: goto yy225; default: goto yy210; } yy210: -#line 1064 "token.re" +#line 1065 "token.re" { QUOTECAT(qstr, qcapa, qidx, *YYTOKEN); goto ScalarBlock2; } -#line 2479 "" +#line 2480 "" yy211: ++YYCURSOR; goto yy212; yy212: -#line 1026 "token.re" +#line 1027 "token.re" { lvl = CURRENT_LEVEL(); if ( lvl->status != syck_lvl_block ) { @@ -2493,16 +2494,16 @@ yy212: } goto ScalarBlock2; } -#line 2496 "" +#line 2497 "" yy213: ++YYCURSOR; goto yy214; yy214: -#line 1040 "token.re" +#line 1041 "token.re" { YYCURSOR--; POP_LEVEL(); RETURN_YAML_BLOCK(); } -#line 2505 "" +#line 2506 "" yy215: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ @@ -2531,7 +2532,7 @@ yy219: yych = *++YYCURSOR; yy220: ++YYCURSOR; goto yy221; yy221: -#line 1045 "token.re" +#line 1046 "token.re" { if ( YYTOKEN == YYLINEPTR ) { if ( blockType == BLOCK_FOLD && qidx > 0 ) @@ -2550,7 +2551,7 @@ yy221: goto ScalarBlock2; } } -#line 2553 "" +#line 2554 "" yy222: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; @@ -2582,7 +2583,7 @@ yy227: ++YYCURSOR; default: goto yy218; } } -#line 1069 "token.re" +#line 1070 "token.re" } @@ -2598,7 +2599,7 @@ Comment: YYTOKEN = YYCURSOR; -#line 2601 "" +#line 2602 "" { YYCTYPE yych; unsigned int yyaccept; @@ -2616,11 +2617,11 @@ yy228: yy230: ++YYCURSOR; goto yy231; yy231: -#line 1085 "token.re" +#line 1086 "token.re" { YYCURSOR = YYTOKEN; return; } -#line 2623 "" +#line 2624 "" yy232: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); goto yy237; @@ -2630,10 +2631,10 @@ yy233: ++YYCURSOR; default: goto yy234; } yy234: -#line 1089 "token.re" +#line 1090 "token.re" { goto Comment; } -#line 2636 "" +#line 2637 "" yy235: yych = *++YYCURSOR; goto yy234; yy236: yyaccept = 0; @@ -2658,7 +2659,7 @@ yy239: YYCURSOR = YYMARKER; case 0: goto yy231; } } -#line 1092 "token.re" +#line 1093 "token.re" } diff --git a/ext/syck/yaml2byte.c b/ext/syck/yaml2byte.c index 46173e861e..61cd8c8eac 100644 --- a/ext/syck/yaml2byte.c +++ b/ext/syck/yaml2byte.c @@ -226,12 +226,17 @@ syck_yaml2byte(char *yamlstr) syck_parser_implicit_typing( parser, 1 ); syck_parser_taguri_expansion( parser, 1 ); oid = syck_parse( parser ); - syck_lookup_sym( parser, oid, (char **)&sav ); - ret = S_ALLOC_N( char, strlen( sav->buffer ) + 3 ); - ret[0] = '\0'; - strcat( ret, "D\n" ); - strcat( ret, sav->buffer ); + if ( syck_lookup_sym( parser, oid, (char **)&sav ) == 1 ) { + ret = S_ALLOC_N( char, strlen( sav->buffer ) + 3 ); + ret[0] = '\0'; + strcat( ret, "D\n" ); + strcat( ret, sav->buffer ); + } + else + { + ret = NULL; + } syck_free_parser( parser ); return ret; diff --git a/lib/yaml/basenode.rb b/lib/yaml/basenode.rb index a98f6d890a..7072b1dcd6 100644 --- a/lib/yaml/basenode.rb +++ b/lib/yaml/basenode.rb @@ -67,8 +67,8 @@ module YAML end def at( seg ) - if Hash === @value and @value.has_key?( seg ) - @value[seg][1] + if Hash === @value + self[seg] elsif Array === @value and seg =~ /\A\d+\Z/ and @value[seg.to_i] @value[seg.to_i] end @@ -99,8 +99,8 @@ module YAML @value.collect { |v| idx += 1 if Hash === @value - match_init = [v[0], v[1][1]] - match_deep = v[1][1].match_segment( ypath, depth ) + match_init = [v[0].transform, v[1]] + match_deep = v[1].match_segment( ypath, depth ) else match_init = [idx, v] match_deep = v.match_segment( ypath, depth ) @@ -127,7 +127,7 @@ module YAML @value.collect { |h| idx += 1 if Hash === @value - [h[0], h[1][1]] + [h[0].transform, h[1]] else [idx, h] end @@ -182,9 +182,9 @@ module YAML # We want the node to act like as Hash # if it is. # - def []( *k ) + def []( *key ) if Hash === @value - v = @value.[]( *k ) + v = @value.detect { |k,v| k.transform == key.first } v[1] if v elsif Array === @value @value.[]( *k ) diff --git a/lib/yaml/rubytypes.rb b/lib/yaml/rubytypes.rb index 29be1b96fc..10516d7557 100644 --- a/lib/yaml/rubytypes.rb +++ b/lib/yaml/rubytypes.rb @@ -137,6 +137,7 @@ end class String yaml_as "tag:ruby.yaml.org,2002:string" + yaml_as "tag:yaml.org,2002:binary" yaml_as "tag:yaml.org,2002:str" def is_complex_yaml? to_yaml_style or not to_yaml_properties.empty? or self =~ /\n.+/ @@ -145,6 +146,7 @@ class String ( self.count( "^ -~", "^\r\n" ) / self.size > 0.3 || self.count( "\x00" ) > 0 ) unless empty? end def String.yaml_new( klass, tag, val ) + val = val.unpack("m")[0] if tag == "tag:yaml.org,2002:binary" val = { 'str' => val } if String === val if Hash === val s = klass.allocate @@ -163,7 +165,7 @@ class String if is_binary_data? out.scalar( "tag:yaml.org,2002:binary", [self].pack("m"), :literal ) elsif to_yaml_properties.empty? - out.scalar( taguri, self, to_yaml_style ) + out.scalar( taguri, self, self =~ /^:/ ? :quote2 : to_yaml_style ) else out.map( taguri, to_yaml_style ) do |map| map.add( 'str', "#{self}" ) @@ -179,7 +181,6 @@ end class Symbol yaml_as "tag:ruby.yaml.org,2002:symbol" yaml_as "tag:ruby.yaml.org,2002:sym" - # yaml_implicit /^:/, :yaml_new def Symbol.yaml_new( klass, tag, val ) if String === val val.intern -- cgit v1.2.1