зеркало из https://github.com/github/ruby.git
* ext/syck/rubyext.c (syck_parser_mark): was a bit heavy on the GC.
* lib/yaml.rb (YAML::transfer): added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
b5d717afda
Коммит
56796022a6
|
@ -7,6 +7,12 @@ Thu Jun 5 18:33:46 2003 WATANABE Hirofumi <eban@ruby-lang.org>
|
|||
* ext/curses/curses.c (window_s_allocate,curses_finalize):
|
||||
avoid VC++ warnings.
|
||||
|
||||
Thu Jun 5 17:44:11 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
|
||||
|
||||
* ext/syck/rubyext.c (syck_parser_mark): was a bit heavy on the GC.
|
||||
|
||||
* lib/yaml.rb (YAML::transfer): added.
|
||||
|
||||
Thu Jun 5 16:11:50 2003 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* bcc32/Makefile.sub, win32/Makefile.sub, wince/Makefile.sub
|
||||
|
|
|
@ -454,12 +454,6 @@ syck_mark_parser(parser)
|
|||
{
|
||||
rb_gc_mark(parser->root);
|
||||
rb_gc_mark(parser->root_on_error);
|
||||
if ( parser->bonus != 0 )
|
||||
{
|
||||
struct parser_xtra *bonus = (struct parser_xtra *)parser->bonus;
|
||||
rb_gc_mark(bonus->proc);
|
||||
rb_gc_mark(bonus->data);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef SYCK_H
|
||||
#define SYCK_H
|
||||
|
||||
#define SYCK_VERSION "0.34"
|
||||
#define SYCK_VERSION "0.35"
|
||||
#define YAML_DOMAIN "yaml.org,2002"
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
117
ext/syck/token.c
117
ext/syck/token.c
|
@ -1,4 +1,4 @@
|
|||
/* Generated by re2c 0.5 on Mon Jun 2 23:45:51 2003 */
|
||||
/* Generated by re2c 0.5 on Thu Jun 5 11:08:22 2003 */
|
||||
#line 1 "token.re"
|
||||
/*
|
||||
* token.re
|
||||
|
@ -260,7 +260,7 @@ yy2: yyaccept = 0;
|
|||
default: goto yy3;
|
||||
}
|
||||
yy3:
|
||||
#line 285
|
||||
#line 286
|
||||
{ YYPOS(0);
|
||||
goto Document;
|
||||
}
|
||||
|
@ -275,12 +275,13 @@ yy7:
|
|||
#line 275
|
||||
{ SyckLevel *lvl = CURRENT_LEVEL();
|
||||
ENSURE_IEND(lvl, -1);
|
||||
YYPOS(0);
|
||||
return 0;
|
||||
}
|
||||
yy8: yych = *++YYCURSOR;
|
||||
goto yy12;
|
||||
yy9:
|
||||
#line 280
|
||||
#line 281
|
||||
{ int indt_len;
|
||||
GOBBLE_UP_INDENT( indt_len, YYTOKEN );
|
||||
goto Header;
|
||||
|
@ -347,7 +348,7 @@ yy22: switch(yych){
|
|||
default: goto yy20;
|
||||
}
|
||||
}
|
||||
#line 289
|
||||
#line 290
|
||||
|
||||
|
||||
Document:
|
||||
|
@ -388,7 +389,7 @@ yy23:
|
|||
yy25: yych = *++YYCURSOR;
|
||||
goto yy77;
|
||||
yy26:
|
||||
#line 303
|
||||
#line 304
|
||||
{ // Isolate spaces
|
||||
int indt_len;
|
||||
GOBBLE_UP_INDENT( indt_len, YYTOKEN );
|
||||
|
@ -405,7 +406,7 @@ yy26:
|
|||
}
|
||||
yy27: yych = *++YYCURSOR;
|
||||
yy28:
|
||||
#line 318
|
||||
#line 319
|
||||
{ ENSURE_IOPEN(lvl, 0, 1);
|
||||
lvl = CURRENT_LEVEL();
|
||||
ADD_LEVEL(lvl->spaces + 1, syck_lvl_inline);
|
||||
|
@ -413,7 +414,7 @@ yy28:
|
|||
}
|
||||
yy29: yych = *++YYCURSOR;
|
||||
yy30:
|
||||
#line 324
|
||||
#line 325
|
||||
{ POP_LEVEL();
|
||||
return YYTOKEN[0];
|
||||
}
|
||||
|
@ -424,7 +425,7 @@ yy31: yych = *++YYCURSOR;
|
|||
default: goto yy32;
|
||||
}
|
||||
yy32:
|
||||
#line 382
|
||||
#line 384
|
||||
{ ENSURE_IOPEN(lvl, 0, 1);
|
||||
goto Plain;
|
||||
}
|
||||
|
@ -564,17 +565,17 @@ yy35: yych = *++YYCURSOR;
|
|||
}
|
||||
yy36: yych = *++YYCURSOR;
|
||||
yy37:
|
||||
#line 356
|
||||
#line 357
|
||||
{ ENSURE_IOPEN(lvl, 0, 1);
|
||||
goto TransferMethod; }
|
||||
yy38: yych = *++YYCURSOR;
|
||||
yy39:
|
||||
#line 359
|
||||
#line 360
|
||||
{ ENSURE_IOPEN(lvl, 0, 1);
|
||||
goto SingleQuote; }
|
||||
yy40: yych = *++YYCURSOR;
|
||||
yy41:
|
||||
#line 362
|
||||
#line 363
|
||||
{ ENSURE_IOPEN(lvl, 0, 1);
|
||||
goto DoubleQuote; }
|
||||
yy42: yyaccept = 0;
|
||||
|
@ -596,19 +597,20 @@ yy42: yyaccept = 0;
|
|||
}
|
||||
yy43: yych = *++YYCURSOR;
|
||||
yy44:
|
||||
#line 372
|
||||
#line 373
|
||||
{ eat_comments( parser );
|
||||
goto Document;
|
||||
}
|
||||
yy45: yych = *++YYCURSOR;
|
||||
goto yy51;
|
||||
yy46:
|
||||
#line 376
|
||||
#line 377
|
||||
{ goto Document; }
|
||||
yy47: yych = *++YYCURSOR;
|
||||
yy48:
|
||||
#line 378
|
||||
#line 379
|
||||
{ ENSURE_IEND(lvl, -1);
|
||||
YYPOS(0);
|
||||
return 0;
|
||||
}
|
||||
yy49: yych = *++YYCURSOR;
|
||||
|
@ -650,7 +652,7 @@ yy56: switch(yych){
|
|||
default: goto yy57;
|
||||
}
|
||||
yy57:
|
||||
#line 365
|
||||
#line 366
|
||||
{ if ( *( YYCURSOR - 1 ) == '\n' )
|
||||
{
|
||||
YYCURSOR--;
|
||||
|
@ -731,7 +733,7 @@ yy61: switch(yych){
|
|||
default: goto yy62;
|
||||
}
|
||||
yy62:
|
||||
#line 351
|
||||
#line 352
|
||||
{ ENSURE_IOPEN(lvl, 0, 1);
|
||||
yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
|
||||
return ALIAS;
|
||||
|
@ -803,7 +805,7 @@ yy64: switch(yych){
|
|||
default: goto yy65;
|
||||
}
|
||||
yy65:
|
||||
#line 346
|
||||
#line 347
|
||||
{ ENSURE_IOPEN(lvl, 0, 1);
|
||||
yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
|
||||
return ANCHOR;
|
||||
|
@ -816,7 +818,7 @@ yy67: switch(yych){
|
|||
default: goto yy68;
|
||||
}
|
||||
yy68:
|
||||
#line 332
|
||||
#line 333
|
||||
{ ENSURE_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1);
|
||||
FORCE_NEXT_TOKEN(IOPEN);
|
||||
if ( *YYCURSOR == '\n' || *( YYCURSOR - 1 ) == '\n' )
|
||||
|
@ -845,7 +847,7 @@ yy72: switch(yych){
|
|||
default: goto yy73;
|
||||
}
|
||||
yy73:
|
||||
#line 328
|
||||
#line 329
|
||||
{ YYPOS(1);
|
||||
return YYTOKEN[0];
|
||||
}
|
||||
|
@ -872,7 +874,7 @@ yy79: switch(yych){
|
|||
default: goto yy26;
|
||||
}
|
||||
}
|
||||
#line 386
|
||||
#line 388
|
||||
|
||||
}
|
||||
|
||||
|
@ -979,14 +981,14 @@ yy83: yyaccept = 0;
|
|||
default: goto yy84;
|
||||
}
|
||||
yy84:
|
||||
#line 399
|
||||
#line 401
|
||||
{ YYCURSOR = YYTOKTMP;
|
||||
return DOCSEP;
|
||||
}
|
||||
yy85: yych = *++YYCURSOR;
|
||||
goto yy89;
|
||||
yy86:
|
||||
#line 397
|
||||
#line 399
|
||||
{ goto Directive; }
|
||||
yy87: yych = *++YYCURSOR;
|
||||
goto yy84;
|
||||
|
@ -1238,10 +1240,10 @@ yy94: switch(yych){
|
|||
default: goto yy95;
|
||||
}
|
||||
yy95:
|
||||
#line 395
|
||||
#line 397
|
||||
{ goto Directive; }
|
||||
}
|
||||
#line 402
|
||||
#line 404
|
||||
|
||||
|
||||
}
|
||||
|
@ -1283,7 +1285,7 @@ yy96:
|
|||
yy98: yych = *++YYCURSOR;
|
||||
goto yy122;
|
||||
yy99:
|
||||
#line 425
|
||||
#line 427
|
||||
{ int indt_len, nl_count = 0;
|
||||
SyckLevel *lvl;
|
||||
char *tok = YYTOKTMP;
|
||||
|
@ -1322,16 +1324,19 @@ yy100: yych = *++YYCURSOR;
|
|||
default: goto yy101;
|
||||
}
|
||||
yy101:
|
||||
#line 476
|
||||
#line 481
|
||||
{ QUOTECATS(qstr, qcapa, qidx, YYTOKTMP, YYCURSOR - YYTOKTMP);
|
||||
goto Plain2;
|
||||
}
|
||||
yy102: yych = *++YYCURSOR;
|
||||
yy103:
|
||||
#line 459
|
||||
#line 461
|
||||
{ if ( plvl->status != syck_lvl_inline )
|
||||
{
|
||||
YYCURSOR--;
|
||||
if ( *(YYCURSOR - 1) == ' ' || *(YYCURSOR - 1) == '\n' )
|
||||
{
|
||||
YYCURSOR--;
|
||||
}
|
||||
QUOTECATS(qstr, qcapa, qidx, YYTOKTMP, YYCURSOR - YYTOKTMP);
|
||||
goto Plain2;
|
||||
}
|
||||
|
@ -1349,17 +1354,17 @@ yy105: yych = *++YYCURSOR;
|
|||
default: goto yy106;
|
||||
}
|
||||
yy106:
|
||||
#line 474
|
||||
#line 479
|
||||
{ goto Plain3; }
|
||||
yy107: yych = *++YYCURSOR;
|
||||
yy108:
|
||||
#line 472
|
||||
#line 477
|
||||
{ RETURN_IMPLICIT(); }
|
||||
yy109: yych = *++YYCURSOR;
|
||||
goto yy101;
|
||||
yy110: yych = *++YYCURSOR;
|
||||
yy111:
|
||||
#line 468
|
||||
#line 473
|
||||
{ eat_comments( parser );
|
||||
RETURN_IMPLICIT();
|
||||
}
|
||||
|
@ -1385,7 +1390,7 @@ yy117: switch(yych){
|
|||
default: goto yy118;
|
||||
}
|
||||
yy118:
|
||||
#line 457
|
||||
#line 459
|
||||
{ RETURN_IMPLICIT(); }
|
||||
yy119: ++YYCURSOR;
|
||||
if(YYLIMIT == YYCURSOR) YYFILL(1);
|
||||
|
@ -1410,7 +1415,7 @@ yy124: switch(yych){
|
|||
default: goto yy99;
|
||||
}
|
||||
}
|
||||
#line 480
|
||||
#line 485
|
||||
|
||||
}
|
||||
|
||||
|
@ -1440,7 +1445,7 @@ yy125:
|
|||
yy127: yych = *++YYCURSOR;
|
||||
goto yy137;
|
||||
yy128:
|
||||
#line 494
|
||||
#line 499
|
||||
{ int indt_len;
|
||||
int nl_count = 0;
|
||||
SyckLevel *lvl;
|
||||
|
@ -1482,7 +1487,7 @@ yy129: yych = *++YYCURSOR;
|
|||
default: goto yy130;
|
||||
}
|
||||
yy130:
|
||||
#line 534
|
||||
#line 539
|
||||
{ SyckLevel *lvl;
|
||||
SyckNode *n = syck_alloc_str();
|
||||
lvl = CURRENT_LEVEL();
|
||||
|
@ -1500,13 +1505,13 @@ yy131: yych = *++YYCURSOR;
|
|||
goto yy130;
|
||||
yy132: yych = *++YYCURSOR;
|
||||
yy133:
|
||||
#line 548
|
||||
#line 553
|
||||
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
|
||||
goto SingleQuote2;
|
||||
}
|
||||
yy134: yych = *++YYCURSOR;
|
||||
yy135:
|
||||
#line 530
|
||||
#line 535
|
||||
{ QUOTECAT(qstr, qcapa, qidx, '\'');
|
||||
goto SingleQuote2;
|
||||
}
|
||||
|
@ -1526,7 +1531,7 @@ yy139: switch(yych){
|
|||
default: goto yy128;
|
||||
}
|
||||
}
|
||||
#line 552
|
||||
#line 557
|
||||
|
||||
|
||||
}
|
||||
|
@ -1561,7 +1566,7 @@ yy140:
|
|||
yy142: yych = *++YYCURSOR;
|
||||
goto yy162;
|
||||
yy143:
|
||||
#line 570
|
||||
#line 575
|
||||
{ int indt_len;
|
||||
int nl_count = 0;
|
||||
SyckLevel *lvl;
|
||||
|
@ -1613,13 +1618,13 @@ yy144: yyaccept = 0;
|
|||
default: goto yy145;
|
||||
}
|
||||
yy145:
|
||||
#line 654
|
||||
#line 659
|
||||
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
|
||||
goto DoubleQuote2;
|
||||
}
|
||||
yy146: yych = *++YYCURSOR;
|
||||
yy147:
|
||||
#line 640
|
||||
#line 645
|
||||
{ SyckLevel *lvl;
|
||||
SyckNode *n = syck_alloc_str();
|
||||
lvl = CURRENT_LEVEL();
|
||||
|
@ -1651,7 +1656,7 @@ yy152: YYCURSOR = YYMARKER;
|
|||
}
|
||||
yy153: yych = *++YYCURSOR;
|
||||
yy154:
|
||||
#line 635
|
||||
#line 640
|
||||
{ keep_nl = 0;
|
||||
YYCURSOR--;
|
||||
goto DoubleQuote2;
|
||||
|
@ -1682,7 +1687,7 @@ yy155: yych = *++YYCURSOR;
|
|||
}
|
||||
yy156: yych = *++YYCURSOR;
|
||||
yy157:
|
||||
#line 610
|
||||
#line 615
|
||||
{ char ch = *( YYCURSOR - 1 );
|
||||
switch ( ch )
|
||||
{
|
||||
|
@ -1724,7 +1729,7 @@ yy158: yych = *++YYCURSOR;
|
|||
}
|
||||
yy159: yych = *++YYCURSOR;
|
||||
yy160:
|
||||
#line 626
|
||||
#line 631
|
||||
{ long ch;
|
||||
char *chr_text = syck_strndup( YYTOKTMP, 4 );
|
||||
chr_text[0] = '0';
|
||||
|
@ -1749,7 +1754,7 @@ yy164: switch(yych){
|
|||
default: goto yy143;
|
||||
}
|
||||
}
|
||||
#line 658
|
||||
#line 663
|
||||
|
||||
}
|
||||
|
||||
|
@ -1774,7 +1779,7 @@ yy165:
|
|||
yy167:yy168: yych = *++YYCURSOR;
|
||||
goto yy176;
|
||||
yy169:
|
||||
#line 667
|
||||
#line 672
|
||||
{ SyckLevel *lvl;
|
||||
YYCURSOR = YYTOKTMP;
|
||||
if ( YYCURSOR == YYTOKEN + 1 )
|
||||
|
@ -1824,7 +1829,7 @@ yy170: yych = *++YYCURSOR;
|
|||
goto yy174;
|
||||
yy171: yych = *++YYCURSOR;
|
||||
yy172:
|
||||
#line 713
|
||||
#line 718
|
||||
{ goto TransferMethod; }
|
||||
yy173: ++YYCURSOR;
|
||||
if(YYLIMIT == YYCURSOR) YYFILL(1);
|
||||
|
@ -1841,7 +1846,7 @@ yy176: switch(yych){
|
|||
default: goto yy169;
|
||||
}
|
||||
}
|
||||
#line 715
|
||||
#line 720
|
||||
|
||||
}
|
||||
|
||||
|
@ -1905,7 +1910,7 @@ yy177:
|
|||
yy179: yych = *++YYCURSOR;
|
||||
goto yy188;
|
||||
yy180:
|
||||
#line 763
|
||||
#line 768
|
||||
{ char *pacer;
|
||||
char *tok = YYTOKTMP;
|
||||
int indt_len = 0, nl_count = 0, fold_nl = 0;
|
||||
|
@ -1975,7 +1980,7 @@ yy180:
|
|||
}
|
||||
yy181: yych = *++YYCURSOR;
|
||||
yy182:
|
||||
#line 832
|
||||
#line 837
|
||||
{ lvl = CURRENT_LEVEL();
|
||||
if ( lvl->status != syck_lvl_block )
|
||||
{
|
||||
|
@ -1990,14 +1995,14 @@ yy182:
|
|||
}
|
||||
yy183: yych = *++YYCURSOR;
|
||||
yy184:
|
||||
#line 846
|
||||
#line 851
|
||||
{ YYCURSOR--;
|
||||
POP_LEVEL();
|
||||
RETURN_BLOCK();
|
||||
}
|
||||
yy185: yych = *++YYCURSOR;
|
||||
yy186:
|
||||
#line 851
|
||||
#line 856
|
||||
{ QUOTECAT(qstr, qcapa, qidx, *YYTOKTMP);
|
||||
goto ScalarBlock2;
|
||||
}
|
||||
|
@ -2017,7 +2022,7 @@ yy190: switch(yych){
|
|||
default: goto yy180;
|
||||
}
|
||||
}
|
||||
#line 856
|
||||
#line 861
|
||||
|
||||
}
|
||||
|
||||
|
@ -2047,7 +2052,7 @@ yy191:
|
|||
}
|
||||
yy193: yych = *++YYCURSOR;
|
||||
yy194:
|
||||
#line 872
|
||||
#line 877
|
||||
{ SyckLevel *lvl = CURRENT_LEVEL();
|
||||
YYCURSOR = tok;
|
||||
return;
|
||||
|
@ -2056,7 +2061,7 @@ yy195: yych = *++YYCURSOR;
|
|||
goto yy199;
|
||||
yy196: yych = *++YYCURSOR;
|
||||
yy197:
|
||||
#line 877
|
||||
#line 882
|
||||
{ goto Comment;
|
||||
}
|
||||
yy198: ++YYCURSOR;
|
||||
|
@ -2067,7 +2072,7 @@ yy199: switch(yych){
|
|||
default: goto yy194;
|
||||
}
|
||||
}
|
||||
#line 880
|
||||
#line 885
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -111,6 +111,13 @@ module YAML
|
|||
@@loader.detect_implicit( val )
|
||||
end
|
||||
|
||||
#
|
||||
# Apply a transfer method to a Ruby object
|
||||
#
|
||||
def YAML.transfer( type_id, obj )
|
||||
@@loader.transfer( type_id, obj )
|
||||
end
|
||||
|
||||
#
|
||||
# Method to extract colon-seperated type and class, returning
|
||||
# the type and the constant of the class
|
||||
|
@ -147,6 +154,7 @@ module YAML
|
|||
end
|
||||
|
||||
require 'yaml/rubytypes'
|
||||
require 'yaml/types'
|
||||
|
||||
#
|
||||
# ryan: You know how Kernel.p is a really convenient way to dump ruby
|
||||
|
|
Загрузка…
Ссылка в новой задаче