diff options
author | why <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-05-22 05:41:06 +0000 |
---|---|---|
committer | why <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-05-22 05:41:06 +0000 |
commit | 5e1c96af5323f757c9875ea1fb5b754e4dd257cd (patch) | |
tree | 22bbba2734e272dfcc0c3a452358aeb23fc17929 | |
parent | a2cd1bbf3e70dfa1be172851ffd4b6bad3190560 (diff) | |
download | ruby-5e1c96af5323f757c9875ea1fb5b754e4dd257cd.tar.gz |
* ext/syck/rubyext.c (syck_parser_load): root-level false was returning
nil.
* ext/syck/token.c: root-level transfer method bug.
* ext/syck/gram.c: root-level empty gave a parse error.
* lib/yaml/rubytypes.rb: Symbol#to_yaml generating method call error.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | ext/syck/gram.c | 136 | ||||
-rw-r--r-- | ext/syck/rubyext.c | 7 | ||||
-rw-r--r-- | ext/syck/token.c | 89 | ||||
-rw-r--r-- | lib/yaml/rubytypes.rb | 8 |
5 files changed, 132 insertions, 119 deletions
@@ -1,3 +1,14 @@ +Thu May 22 05:43:24 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net> + + * ext/syck/rubyext.c (syck_parser_load): root-level false was returning + nil. + + * ext/syck/token.c: root-level transfer method bug. + + * ext/syck/gram.c: root-level empty gave a parse error. + + * lib/yaml/rubytypes.rb: Symbol#to_yaml generating method call error. + Thu May 22 02:46:38 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net> * eval.c (rb_eval): splat NODE_RESTARY. [ruby-dev:20268] diff --git a/ext/syck/gram.c b/ext/syck/gram.c index 310e6e129b..8b52d62a6e 100644 --- a/ext/syck/gram.c +++ b/ext/syck/gram.c @@ -228,8 +228,8 @@ union yyalloc #endif /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 32 -#define YYLAST 198 +#define YYFINAL 33 +#define YYLAST 196 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 23 @@ -295,7 +295,7 @@ static const unsigned char yyprhs[] = /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yysigned_char yyrhs[] = { - 24, 0, -1, 32, -1, 10, 25, -1, -1, 31, + 24, 0, -1, 32, -1, 10, 26, -1, -1, 31, -1, 32, -1, 3, 25, -1, 4, -1, 27, 25, 30, -1, 25, -1, -1, 11, -1, 27, 12, -1, 13, -1, 12, -1, 13, -1, 29, 30, -1, 5, @@ -378,12 +378,12 @@ static const unsigned char yyr2[] = means the default is an error. */ static const unsigned char yydefact[] = { - 4, 0, 23, 0, 12, 0, 0, 0, 0, 2, + 4, 0, 23, 11, 12, 0, 0, 0, 0, 2, 24, 25, 26, 27, 22, 0, 8, 0, 0, 20, - 21, 3, 0, 5, 6, 35, 36, 0, 49, 0, - 50, 0, 1, 0, 13, 11, 0, 0, 31, 0, - 41, 43, 0, 7, 18, 0, 19, 0, 0, 5, - 34, 0, 11, 48, 0, 15, 0, 10, 30, 0, + 21, 10, 3, 0, 5, 6, 35, 36, 0, 49, + 0, 50, 0, 1, 0, 13, 11, 0, 0, 31, + 0, 41, 43, 0, 7, 18, 0, 19, 0, 0, + 5, 34, 0, 11, 48, 0, 15, 0, 30, 0, 11, 14, 28, 33, 38, 46, 16, 0, 9, 37, 47, 51, 0, 0, 0, 40, 32, 44, 45, 17, 29, 39, 11, 42 @@ -392,33 +392,33 @@ static const unsigned char yydefact[] = /* YYDEFGOTO[NTERM-NUM]. */ static const yysigned_char yydefgoto[] = { - -1, 7, 57, 58, 22, 62, 56, 68, 23, 24, - 10, 38, 39, 11, 27, 12, 40, 41, 42, 30, - 13, 31 + -1, 7, 21, 22, 23, 62, 57, 68, 24, 25, + 10, 39, 40, 11, 28, 12, 41, 42, 43, 31, + 13, 32 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -47 +#define YYPACT_NINF -50 static const short yypact[] = { - 168, 179, -47, 133, -47, 116, 78, 5, 94, -47, - -47, -47, -47, -47, -47, 133, -47, 163, 85, -47, - -47, -47, 58, -47, -47, -47, -47, -3, -47, 9, - -47, 1, -47, 35, -47, 133, 133, 12, -47, 18, - -47, -47, 18, -47, -47, 85, -47, 148, 32, 12, - -47, 133, 133, -47, 133, -47, 104, -47, -47, 24, - 133, -47, -47, 36, -47, 104, -47, 32, -47, -47, - -47, -47, 18, 18, 40, -47, -47, -47, -47, -47, - -47, -47, 133, -47 + 169, 13, -50, 134, -50, 117, 79, 3, 95, -50, + -50, -50, -50, -50, -50, 134, -50, 164, 86, -50, + -50, -50, -50, 59, -50, -50, -50, -50, -1, -50, + -7, -50, 14, -50, 184, -50, 134, 134, 10, -50, + 32, -50, -50, 32, -50, -50, 86, -50, 149, 62, + 10, -50, 134, 134, -50, 134, -50, 105, -50, 15, + 134, -50, -50, 25, -50, 105, -50, 62, -50, -50, + -50, -50, 32, 32, 26, -50, -50, -50, -50, -50, + -50, -50, 134, -50 }; /* YYPGOTO[NTERM-NUM]. */ static const yysigned_char yypgoto[] = { - -47, -47, -2, -44, 6, -40, -13, -16, -8, 11, - -47, -46, 0, -47, -47, -47, -47, 3, 15, 19, - -47, -47 + -50, -50, -4, -24, 4, -30, -12, -21, -8, 6, + -50, -49, 2, -50, -50, -50, -50, -15, 12, -2, + -50, -50 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -428,50 +428,50 @@ static const yysigned_char yypgoto[] = #define YYTABLE_NINF -1 static const unsigned char yytable[] = { - 37, 21, 64, 26, 29, 32, 8, 8, 70, 44, - 46, 9, 14, 43, 49, 50, 75, 76, 51, 77, - 48, 53, 54, 8, 52, 44, 63, 60, 14, 65, - 55, 61, 80, 81, 59, 67, 55, 44, 83, 44, - 45, 18, 19, 20, 55, 66, 74, 55, 37, 69, - 35, 79, 29, 8, 67, 82, 72, 37, 14, 63, - 65, 15, 16, 47, 18, 19, 20, 2, 78, 4, - 34, 73, 35, 71, 0, 5, 0, 6, 0, 0, - 36, 15, 16, 17, 18, 19, 20, 2, 0, 4, - 45, 18, 19, 20, 0, 5, 0, 6, 28, 33, - 18, 19, 20, 0, 0, 0, 34, 0, 35, 45, - 18, 19, 20, 0, 0, 0, 36, 0, 35, 15, - 16, 17, 18, 19, 20, 2, 36, 4, 0, 0, - 0, 0, 0, 5, 25, 6, 15, 16, 17, 18, - 19, 20, 2, 0, 4, 0, 0, 0, 0, 0, - 5, 0, 6, 17, 18, 19, 20, 2, 0, 4, - 55, 0, 0, 0, 0, 5, 0, 6, 17, 18, - 19, 20, 2, 1, 4, 0, 0, 2, 3, 4, - 5, 0, 6, 0, 1, 5, 0, 6, 2, 0, - 4, 0, 0, 0, 0, 0, 5, 0, 6 + 38, 27, 30, 33, 8, 8, 9, 14, 53, 45, + 47, 44, 58, 64, 76, 50, 77, 51, 1, 49, + 52, 8, 2, 14, 4, 60, 45, 56, 63, 70, + 5, 65, 6, 59, 54, 55, 75, 67, 45, 36, + 45, 82, 80, 81, 56, 61, 79, 74, 69, 38, + 78, 30, 8, 71, 14, 67, 0, 38, 83, 72, + 63, 65, 15, 16, 48, 18, 19, 20, 2, 73, + 4, 35, 0, 36, 56, 66, 5, 0, 6, 0, + 0, 37, 15, 16, 17, 18, 19, 20, 2, 0, + 4, 46, 18, 19, 20, 0, 5, 0, 6, 29, + 34, 18, 19, 20, 0, 0, 0, 35, 0, 36, + 46, 18, 19, 20, 0, 0, 0, 37, 0, 36, + 15, 16, 17, 18, 19, 20, 2, 37, 4, 0, + 0, 0, 0, 0, 5, 26, 6, 15, 16, 17, + 18, 19, 20, 2, 0, 4, 0, 0, 0, 0, + 0, 5, 0, 6, 17, 18, 19, 20, 2, 0, + 4, 56, 0, 0, 0, 0, 5, 0, 6, 17, + 18, 19, 20, 2, 1, 4, 0, 0, 2, 3, + 4, 5, 0, 6, 0, 0, 5, 0, 6, 46, + 18, 19, 20, 0, 0, 0, 56 }; static const yysigned_char yycheck[] = { - 8, 3, 42, 5, 6, 0, 0, 1, 52, 17, - 18, 0, 1, 15, 22, 18, 60, 63, 21, 65, - 22, 20, 21, 17, 15, 33, 39, 15, 17, 42, - 12, 13, 72, 73, 36, 48, 12, 45, 82, 47, - 5, 6, 7, 8, 12, 13, 59, 12, 56, 51, - 14, 67, 54, 47, 67, 15, 56, 65, 47, 72, - 73, 3, 4, 5, 6, 7, 8, 9, 65, 11, - 12, 56, 14, 54, -1, 17, -1, 19, -1, -1, - 22, 3, 4, 5, 6, 7, 8, 9, -1, 11, - 5, 6, 7, 8, -1, 17, -1, 19, 20, 5, - 6, 7, 8, -1, -1, -1, 12, -1, 14, 5, - 6, 7, 8, -1, -1, -1, 22, -1, 14, 3, - 4, 5, 6, 7, 8, 9, 22, 11, -1, -1, - -1, -1, -1, 17, 18, 19, 3, 4, 5, 6, - 7, 8, 9, -1, 11, -1, -1, -1, -1, -1, - 17, -1, 19, 5, 6, 7, 8, 9, -1, 11, - 12, -1, -1, -1, -1, 17, -1, 19, 5, 6, - 7, 8, 9, 5, 11, -1, -1, 9, 10, 11, - 17, -1, 19, -1, 5, 17, -1, 19, 9, -1, - 11, -1, -1, -1, -1, -1, 17, -1, 19 + 8, 5, 6, 0, 0, 1, 0, 1, 15, 17, + 18, 15, 36, 43, 63, 23, 65, 18, 5, 23, + 21, 17, 9, 17, 11, 15, 34, 12, 40, 53, + 17, 43, 19, 37, 20, 21, 60, 49, 46, 14, + 48, 15, 72, 73, 12, 13, 67, 59, 52, 57, + 65, 55, 48, 55, 48, 67, -1, 65, 82, 57, + 72, 73, 3, 4, 5, 6, 7, 8, 9, 57, + 11, 12, -1, 14, 12, 13, 17, -1, 19, -1, + -1, 22, 3, 4, 5, 6, 7, 8, 9, -1, + 11, 5, 6, 7, 8, -1, 17, -1, 19, 20, + 5, 6, 7, 8, -1, -1, -1, 12, -1, 14, + 5, 6, 7, 8, -1, -1, -1, 22, -1, 14, + 3, 4, 5, 6, 7, 8, 9, 22, 11, -1, + -1, -1, -1, -1, 17, 18, 19, 3, 4, 5, + 6, 7, 8, 9, -1, 11, -1, -1, -1, -1, + -1, 17, -1, 19, 5, 6, 7, 8, 9, -1, + 11, 12, -1, -1, -1, -1, 17, -1, 19, 5, + 6, 7, 8, 9, 5, 11, -1, -1, 9, 10, + 11, 17, -1, 19, -1, -1, 17, -1, 19, 5, + 6, 7, 8, -1, -1, -1, 12 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -480,10 +480,10 @@ static const unsigned char yystos[] = { 0, 5, 9, 10, 11, 17, 19, 24, 27, 32, 33, 36, 38, 43, 32, 3, 4, 5, 6, 7, - 8, 25, 27, 31, 32, 18, 25, 37, 20, 25, - 42, 44, 0, 5, 12, 14, 22, 31, 34, 35, - 39, 40, 41, 25, 31, 5, 31, 5, 25, 31, - 18, 21, 15, 20, 21, 12, 29, 25, 26, 25, + 8, 25, 26, 27, 31, 32, 18, 25, 37, 20, + 25, 42, 44, 0, 5, 12, 14, 22, 31, 34, + 35, 39, 40, 41, 25, 31, 5, 31, 5, 25, + 31, 18, 21, 15, 20, 21, 12, 29, 26, 25, 15, 13, 28, 29, 28, 29, 13, 29, 30, 25, 26, 42, 35, 41, 29, 26, 34, 34, 40, 30, 28, 28, 15, 26 diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c index 8b94636b4e..f55edadb47 100644 --- a/ext/syck/rubyext.c +++ b/ext/syck/rubyext.c @@ -493,15 +493,10 @@ syck_parser_load(argc, argv, self) parser->bonus = (void *)proc; } - v = syck_parse( parser ); - if ( v == 0 ) - { - return Qnil; - } //v = rb_ensure(rb_run_syck_parse, (VALUE)&parser, rb_syck_ensure, (VALUE)&parser); - return v; + return syck_parse( parser ); } /* diff --git a/ext/syck/token.c b/ext/syck/token.c index 9801d936c6..62499ecbaf 100644 --- a/ext/syck/token.c +++ b/ext/syck/token.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.5 on Mon May 19 12:39:17 2003 */ +/* Generated by re2c 0.5 on Wed May 21 13:04:00 2003 */ #line 1 "token.re" /* * token.re @@ -388,7 +388,7 @@ yy31: yych = *++YYCURSOR; default: goto yy32; } yy32: -#line 335 +#line 336 { ENSURE_IOPEN(lvl, 0, 1); goto Plain; } @@ -559,14 +559,15 @@ yy35: yych = *++YYCURSOR; yy36: yych = *++YYCURSOR; yy37: #line 312 - { goto TransferMethod; } + { ENSURE_IOPEN(lvl, 0, 1); + goto TransferMethod; } yy38: yych = *++YYCURSOR; yy39: -#line 314 +#line 315 { goto SingleQuote; } yy40: yych = *++YYCURSOR; yy41: -#line 316 +#line 317 { goto DoubleQuote; } yy42: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); @@ -587,18 +588,18 @@ yy42: yyaccept = 0; } yy43: yych = *++YYCURSOR; yy44: -#line 325 +#line 326 { eat_comments( parser ); goto Document; } yy45: yych = *++YYCURSOR; goto yy51; yy46: -#line 329 +#line 330 { goto Document; } yy47: yych = *++YYCURSOR; yy48: -#line 331 +#line 332 { ENSURE_IEND(lvl, -1); return 0; } @@ -641,7 +642,7 @@ yy56: switch(yych){ default: goto yy57; } yy57: -#line 318 +#line 319 { if ( *( YYCURSOR - 1 ) == '\n' ) { YYCURSOR--; @@ -887,7 +888,7 @@ yy79: switch(yych){ default: goto yy26; } } -#line 339 +#line 340 } @@ -994,14 +995,14 @@ yy83: yyaccept = 0; default: goto yy84; } yy84: -#line 352 +#line 353 { YYCURSOR = YYTOKTMP; return DOCSEP; } yy85: yych = *++YYCURSOR; goto yy89; yy86: -#line 350 +#line 351 { goto Directive; } yy87: yych = *++YYCURSOR; goto yy84; @@ -1253,10 +1254,10 @@ yy94: switch(yych){ default: goto yy95; } yy95: -#line 348 +#line 349 { goto Directive; } } -#line 355 +#line 356 } @@ -1295,7 +1296,7 @@ yy96: yy98: yych = *++YYCURSOR; goto yy122; yy99: -#line 375 +#line 376 { int indt_len; SyckLevel *lvl; char *tok = YYTOKTMP; @@ -1317,11 +1318,11 @@ yy100: yych = *++YYCURSOR; default: goto yy101; } yy101: -#line 404 +#line 405 { goto Plain2; } yy102: yych = *++YYCURSOR; yy103: -#line 392 +#line 393 { if ( plvl->status != syck_lvl_inline ) goto Plain2; RETURN_IMPLICIT(multiLine); } @@ -1333,7 +1334,7 @@ yy104: yych = *++YYCURSOR; } yy105: yych = *++YYCURSOR; yy106: -#line 396 +#line 397 { RETURN_IMPLICIT(multiLine); } yy107: yych = *++YYCURSOR; switch(yych){ @@ -1341,13 +1342,13 @@ yy107: yych = *++YYCURSOR; default: goto yy108; } yy108: -#line 402 +#line 403 { goto Plain3; } yy109: yych = *++YYCURSOR; goto yy101; yy110: yych = *++YYCURSOR; yy111: -#line 398 +#line 399 { eat_comments( parser ); RETURN_IMPLICIT(multiLine); } @@ -1373,7 +1374,7 @@ yy117: switch(yych){ default: goto yy118; } yy118: -#line 390 +#line 391 { RETURN_IMPLICIT(multiLine); } yy119: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -1398,7 +1399,7 @@ yy124: switch(yych){ default: goto yy99; } } -#line 406 +#line 407 } @@ -1428,7 +1429,7 @@ yy125: yy127: yych = *++YYCURSOR; goto yy137; yy128: -#line 420 +#line 421 { int indt_len; int nl_count = 0; SyckLevel *lvl; @@ -1470,7 +1471,7 @@ yy129: yych = *++YYCURSOR; default: goto yy130; } yy130: -#line 460 +#line 461 { SyckLevel *lvl; SyckNode *n = syck_alloc_str(); lvl = CURRENT_LEVEL(); @@ -1488,13 +1489,13 @@ yy131: yych = *++YYCURSOR; goto yy130; yy132: yych = *++YYCURSOR; yy133: -#line 474 +#line 475 { QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1)); goto SingleQuote2; } yy134: yych = *++YYCURSOR; yy135: -#line 456 +#line 457 { QUOTECAT(qstr, qcapa, qidx, '\''); goto SingleQuote2; } @@ -1514,7 +1515,7 @@ yy139: switch(yych){ default: goto yy128; } } -#line 478 +#line 479 } @@ -1549,7 +1550,7 @@ yy140: yy142: yych = *++YYCURSOR; goto yy158; yy143: -#line 496 +#line 497 { int indt_len; int nl_count = 0; SyckLevel *lvl; @@ -1600,13 +1601,13 @@ yy144: yyaccept = 0; default: goto yy145; } yy145: -#line 571 +#line 572 { QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1)); goto DoubleQuote2; } yy146: yych = *++YYCURSOR; yy147: -#line 557 +#line 558 { SyckLevel *lvl; SyckNode *n = syck_alloc_str(); lvl = CURRENT_LEVEL(); @@ -1638,14 +1639,14 @@ yy152: YYCURSOR = YYMARKER; } yy153: yych = *++YYCURSOR; yy154: -#line 552 +#line 553 { keep_nl = 0; YYCURSOR--; goto DoubleQuote2; } yy155: yych = *++YYCURSOR; yy156: -#line 536 +#line 537 { char ch = *( YYCURSOR - 1 ); switch ( ch ) { @@ -1677,7 +1678,7 @@ yy160: switch(yych){ default: goto yy143; } } -#line 575 +#line 576 } @@ -1702,7 +1703,7 @@ yy161: yy163:yy164: yych = *++YYCURSOR; goto yy172; yy165: -#line 584 +#line 585 { SyckLevel *lvl; YYCURSOR = YYTOKTMP; if ( YYCURSOR == YYTOKEN + 1 ) @@ -1752,7 +1753,7 @@ yy166: yych = *++YYCURSOR; goto yy170; yy167: yych = *++YYCURSOR; yy168: -#line 630 +#line 631 { goto TransferMethod; } yy169: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -1769,7 +1770,7 @@ yy172: switch(yych){ default: goto yy165; } } -#line 632 +#line 633 } @@ -1827,7 +1828,7 @@ yy173: yy175: yych = *++YYCURSOR; goto yy184; yy176: -#line 674 +#line 675 { int indt_len; GOBBLE_UP_INDENT( indt_len, YYTOKTMP ); lvl = CURRENT_LEVEL(); @@ -1860,7 +1861,7 @@ yy176: } yy177: yych = *++YYCURSOR; yy178: -#line 706 +#line 707 { lvl = CURRENT_LEVEL(); YYCURSOR--; yylval->nodeData = syck_new_str2( YYTOKEN, YYCURSOR - YYTOKEN ); @@ -1870,7 +1871,7 @@ yy178: } yy179: yych = *++YYCURSOR; yy180: -#line 714 +#line 715 { lvl = CURRENT_LEVEL(); if ( lvl->status != syck_lvl_block ) { @@ -1881,7 +1882,7 @@ yy180: } yy181: yych = *++YYCURSOR; yy182: -#line 723 +#line 724 { goto ScalarBlock2; } yy183: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -1899,7 +1900,7 @@ yy186: switch(yych){ default: goto yy176; } } -#line 725 +#line 726 } @@ -1929,7 +1930,7 @@ yy187: } yy189: yych = *++YYCURSOR; yy190: -#line 741 +#line 742 { SyckLevel *lvl = CURRENT_LEVEL(); YYCURSOR = tok; return; @@ -1938,7 +1939,7 @@ yy191: yych = *++YYCURSOR; goto yy195; yy192: yych = *++YYCURSOR; yy193: -#line 746 +#line 747 { goto Comment; } yy194: ++YYCURSOR; @@ -1949,7 +1950,7 @@ yy195: switch(yych){ default: goto yy190; } } -#line 749 +#line 750 } diff --git a/lib/yaml/rubytypes.rb b/lib/yaml/rubytypes.rb index 666618e49c..ae5585db5d 100644 --- a/lib/yaml/rubytypes.rb +++ b/lib/yaml/rubytypes.rb @@ -3,6 +3,12 @@ require 'date' # Type conversions # +class Class + def to_yaml( opts = {} ) + raise ArgumentError, "can't dump anonymous class %s" % self.class + end +end + class Object def is_complex_yaml? true @@ -300,7 +306,7 @@ class Symbol def to_yaml( opts = {} ) YAML::quick_emit( nil, opts ) { |out| out << "!ruby/sym " - self.object_id2name.to_yaml( :Emitter => out ) + self.id2name.to_yaml( :Emitter => out ) } end end |