зеркало из https://github.com/github/ruby.git
* ext/syck/implicit.c, ext/syck/rubyext.c: transfer methods applied to native loading
* ext/syck/token.c: fix for transfer methods on same indentation as nested mapping * lib/yaml/rubytypes.rb: all type names in lowercase git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
0b5d8d2d66
Коммит
e44e2ef2e8
|
@ -1,4 +1,4 @@
|
|||
/* Generated by re2c 0.5 on Sat May 10 12:56:19 2003 */
|
||||
/* Generated by re2c 0.5 on Sat May 10 19:43:22 2003 */
|
||||
#line 1 "implicit.re"
|
||||
//
|
||||
// implicit.re
|
||||
|
@ -21,10 +21,20 @@ void
|
|||
try_tag_implicit( SyckNode *n, int taguri )
|
||||
{
|
||||
char *tid;
|
||||
if ( n->kind != syck_str_kind )
|
||||
return;
|
||||
switch ( n->kind )
|
||||
{
|
||||
case syck_str_kind:
|
||||
tid = syck_match_implicit( n->data.str->ptr, n->data.str->len );
|
||||
break;
|
||||
|
||||
tid = syck_match_implicit( n->data.str->ptr, n->data.str->len );
|
||||
case syck_seq_kind:
|
||||
tid = "seq";
|
||||
break;
|
||||
|
||||
case syck_map_kind:
|
||||
tid = "map";
|
||||
break;
|
||||
}
|
||||
if ( taguri == 1 )
|
||||
{
|
||||
n->type_id = syck_taguri( YAML_DOMAIN, tid, strlen( tid ) );
|
||||
|
@ -136,7 +146,7 @@ yy2: YYCURSOR = YYMARKER;
|
|||
yy3: yych = *++YYCURSOR;
|
||||
if(yych <= '\000') goto yy185;
|
||||
yy4:
|
||||
#line 102
|
||||
#line 112
|
||||
{ return "str"; }
|
||||
yy5: yyaccept = 0;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
|
@ -298,7 +308,7 @@ yy27: yych = *++YYCURSOR;
|
|||
if(yych >= '\001') goto yy2;
|
||||
yy28: yych = *++YYCURSOR;
|
||||
yy29:
|
||||
#line 88
|
||||
#line 98
|
||||
{ return "float#inf"; }
|
||||
yy30: yych = *++YYCURSOR;
|
||||
if(yych == 'f') goto yy27;
|
||||
|
@ -312,7 +322,7 @@ yy33: yych = *++YYCURSOR;
|
|||
if(yych >= '\001') goto yy2;
|
||||
yy34: yych = *++YYCURSOR;
|
||||
yy35:
|
||||
#line 92
|
||||
#line 102
|
||||
{ return "float#nan"; }
|
||||
yy36: yych = *++YYCURSOR;
|
||||
if(yych == 'n') goto yy33;
|
||||
|
@ -351,7 +361,7 @@ yy41: if(yybm[0+yych] & 2) goto yy40;
|
|||
}
|
||||
yy42: yych = *++YYCURSOR;
|
||||
yy43:
|
||||
#line 82
|
||||
#line 92
|
||||
{ return "int"; }
|
||||
yy44: ++YYCURSOR;
|
||||
if(YYLIMIT == YYCURSOR) YYFILL(1);
|
||||
|
@ -367,7 +377,7 @@ yy45: if(yych <= ','){
|
|||
}
|
||||
yy46: yych = *++YYCURSOR;
|
||||
yy47:
|
||||
#line 84
|
||||
#line 94
|
||||
{ return "float#fix"; }
|
||||
yy48: ++YYCURSOR;
|
||||
if(YYLIMIT == YYCURSOR) YYFILL(1);
|
||||
|
@ -390,7 +400,7 @@ yy53: if(yych <= '\000') goto yy54;
|
|||
goto yy2;
|
||||
yy54: yych = *++YYCURSOR;
|
||||
yy55:
|
||||
#line 86
|
||||
#line 96
|
||||
{ return "float#exp"; }
|
||||
yy56: yych = *++YYCURSOR;
|
||||
if(yych <= '/') goto yy39;
|
||||
|
@ -424,7 +434,7 @@ yy63: yych = *++YYCURSOR;
|
|||
}
|
||||
yy64: yych = *++YYCURSOR;
|
||||
yy65:
|
||||
#line 94
|
||||
#line 104
|
||||
{ return "timestamp#ymd"; }
|
||||
yy66: yych = *++YYCURSOR;
|
||||
if(yych <= '/') goto yy2;
|
||||
|
@ -511,7 +521,7 @@ yy86: yych = *++YYCURSOR;
|
|||
goto yy2;
|
||||
yy87: yych = *++YYCURSOR;
|
||||
yy88:
|
||||
#line 98
|
||||
#line 108
|
||||
{ return "timestamp#spaced"; }
|
||||
yy89: yych = *++YYCURSOR;
|
||||
if(yych <= '/') goto yy2;
|
||||
|
@ -584,7 +594,7 @@ yy106: yych = *++YYCURSOR;
|
|||
goto yy2;
|
||||
yy107: yych = *++YYCURSOR;
|
||||
yy108:
|
||||
#line 96
|
||||
#line 106
|
||||
{ return "timestamp#iso8601"; }
|
||||
yy109: yych = *++YYCURSOR;
|
||||
if(yych <= '/') goto yy2;
|
||||
|
@ -702,11 +712,11 @@ yy132: if(yybm[0+yych] & 128) goto yy131;
|
|||
if(yych >= '\001') goto yy2;
|
||||
yy133: yych = *++YYCURSOR;
|
||||
yy134:
|
||||
#line 78
|
||||
#line 88
|
||||
{ return "int#hex"; }
|
||||
yy135: yych = *++YYCURSOR;
|
||||
yy136:
|
||||
#line 80
|
||||
#line 90
|
||||
{ return "int#oct"; }
|
||||
yy137: ++YYCURSOR;
|
||||
if(YYLIMIT == YYCURSOR) YYFILL(1);
|
||||
|
@ -758,7 +768,7 @@ yy149: yych = *++YYCURSOR;
|
|||
if(yych >= '\001') goto yy2;
|
||||
yy150: yych = *++YYCURSOR;
|
||||
yy151:
|
||||
#line 90
|
||||
#line 100
|
||||
{ return "float#neginf"; }
|
||||
yy152: yych = *++YYCURSOR;
|
||||
if(yych == 'f') goto yy149;
|
||||
|
@ -780,7 +790,7 @@ yy158: yych = *++YYCURSOR;
|
|||
if(yych >= '\001') goto yy2;
|
||||
yy159: yych = *++YYCURSOR;
|
||||
yy160:
|
||||
#line 76
|
||||
#line 86
|
||||
{ return "bool#no"; }
|
||||
yy161: yych = *++YYCURSOR;
|
||||
if(yych != 'S') goto yy2;
|
||||
|
@ -804,7 +814,7 @@ yy168: yych = *++YYCURSOR;
|
|||
if(yych >= '\001') goto yy2;
|
||||
yy169: yych = *++YYCURSOR;
|
||||
yy170:
|
||||
#line 74
|
||||
#line 84
|
||||
{ return "bool#yes"; }
|
||||
yy171: yych = *++YYCURSOR;
|
||||
if(yych == 'f') goto yy158;
|
||||
|
@ -845,7 +855,7 @@ yy184: yych = *++YYCURSOR;
|
|||
if(yych >= '\001') goto yy2;
|
||||
yy185: yych = *++YYCURSOR;
|
||||
yy186:
|
||||
#line 72
|
||||
#line 82
|
||||
{ return "null"; }
|
||||
yy187: yych = *++YYCURSOR;
|
||||
if(yych == 'L') goto yy184;
|
||||
|
@ -856,7 +866,7 @@ yy189: yych = *++YYCURSOR;
|
|||
if(yych == 'l') goto yy184;
|
||||
goto yy2;
|
||||
}
|
||||
#line 104
|
||||
#line 114
|
||||
|
||||
|
||||
}
|
||||
|
@ -960,7 +970,7 @@ yy193: yyaccept = 0;
|
|||
}
|
||||
}
|
||||
yy194:
|
||||
#line 156
|
||||
#line 166
|
||||
{ return syck_taguri( YAML_DOMAIN, type_id, strlen( type_id ) ); }
|
||||
yy195: yyaccept = 0;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
|
@ -988,7 +998,7 @@ yy195: yyaccept = 0;
|
|||
}
|
||||
yy196: yych = *++YYCURSOR;
|
||||
yy197:
|
||||
#line 130
|
||||
#line 140
|
||||
{ return syck_xprivate( type_id + 1, strlen( type_id ) - 1 ); }
|
||||
yy198: yyaccept = 0;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
|
@ -1080,7 +1090,7 @@ yy205: ++YYCURSOR;
|
|||
}
|
||||
yy206: yych = *++YYCURSOR;
|
||||
yy207:
|
||||
#line 132
|
||||
#line 142
|
||||
{ char *domain = S_ALLOC_N( char, ( YYCURSOR - type_id ) + 15 );
|
||||
char *uri;
|
||||
|
||||
|
@ -1158,7 +1168,7 @@ yy216: yych = *++YYCURSOR;
|
|||
goto yy192;
|
||||
yy217: yych = *++YYCURSOR;
|
||||
yy218:
|
||||
#line 145
|
||||
#line 155
|
||||
{ char *domain = S_ALLOC_N( char, YYCURSOR - type_id );
|
||||
char *uri;
|
||||
|
||||
|
@ -1250,7 +1260,7 @@ yy230: yych = *++YYCURSOR;
|
|||
}
|
||||
yy231: yych = *++YYCURSOR;
|
||||
yy232:
|
||||
#line 128
|
||||
#line 138
|
||||
{ return type_id; }
|
||||
yy233: yych = *++YYCURSOR;
|
||||
if(yych <= '.'){
|
||||
|
@ -1431,7 +1441,7 @@ yy253: yych = *++YYCURSOR;
|
|||
goto yy192;
|
||||
yy254: yych = *++YYCURSOR;
|
||||
yy255:
|
||||
#line 126
|
||||
#line 136
|
||||
{ return type_id; }
|
||||
yy256: yych = *++YYCURSOR;
|
||||
if(yych <= '/') goto yy192;
|
||||
|
@ -1450,7 +1460,7 @@ yy260: yych = *++YYCURSOR;
|
|||
if(yych == ':') goto yy254;
|
||||
goto yy192;
|
||||
}
|
||||
#line 158
|
||||
#line 168
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#define RUBY_DOMAIN "ruby.yaml.org,2002"
|
||||
|
||||
static ID s_utc, s_read, s_binmode;
|
||||
static VALUE str_taguri, str_xprivate;
|
||||
static VALUE sym_model, sym_generic;
|
||||
static VALUE sym_scalar, sym_seq, sym_map;
|
||||
VALUE cParser, cLoader, cNode, oDefaultLoader;
|
||||
|
@ -217,6 +216,7 @@ rb_syck_load_handler(p, n)
|
|||
VALUE obj;
|
||||
long i;
|
||||
int str = 0;
|
||||
int check_transfers = 0;
|
||||
|
||||
switch (n->kind)
|
||||
{
|
||||
|
@ -289,6 +289,7 @@ rb_syck_load_handler(p, n)
|
|||
}
|
||||
else
|
||||
{
|
||||
check_transfers = 1;
|
||||
obj = rb_str_new( n->data.str->ptr, n->data.str->len );
|
||||
}
|
||||
break;
|
||||
|
@ -299,6 +300,7 @@ rb_syck_load_handler(p, n)
|
|||
{
|
||||
rb_ary_store( obj, i, syck_seq_read( n, i ) );
|
||||
}
|
||||
check_transfers = 1;
|
||||
break;
|
||||
|
||||
case syck_map_kind:
|
||||
|
@ -307,13 +309,21 @@ rb_syck_load_handler(p, n)
|
|||
{
|
||||
rb_hash_aset( obj, syck_map_read( n, map_key, i ), syck_map_read( n, map_value, i ) );
|
||||
}
|
||||
check_transfers = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( p->bonus != 0 )
|
||||
{
|
||||
VALUE proc = (VALUE)p->bonus;
|
||||
rb_funcall(proc, rb_intern("call"), 1, obj);
|
||||
}
|
||||
|
||||
if ( check_transfers == 1 && n->type_id != NULL )
|
||||
{
|
||||
obj = rb_funcall( oDefaultLoader, rb_intern( "transfer" ), 2, rb_str_new2( n->type_id ), obj );
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -631,6 +641,8 @@ syck_loader_transfer( self, type, val )
|
|||
{
|
||||
VALUE scheme, name, type_hash, type_proc;
|
||||
VALUE type_uri = rb_str_new2( taguri );
|
||||
VALUE str_taguri = rb_str_new2("taguri");
|
||||
VALUE str_xprivate = rb_str_new2("x-private");
|
||||
VALUE parts = rb_str_split( type_uri, ":" );
|
||||
// rb_funcall(rb_mKernel, rb_intern("p"), 1, parts);
|
||||
|
||||
|
@ -749,8 +761,6 @@ Init_syck()
|
|||
s_utc = rb_intern("utc");
|
||||
s_read = rb_intern("read");
|
||||
s_binmode = rb_intern("binmode");
|
||||
str_taguri = rb_str_new2("taguri");
|
||||
str_xprivate = rb_str_new2("x-private");
|
||||
sym_model = ID2SYM(rb_intern("Model"));
|
||||
sym_generic = ID2SYM(rb_intern("Generic"));
|
||||
sym_map = ID2SYM(rb_intern("map"));
|
||||
|
|
110
ext/syck/token.c
110
ext/syck/token.c
|
@ -1,4 +1,4 @@
|
|||
/* Generated by re2c 0.5 on Thu May 8 08:06:37 2003 */
|
||||
/* Generated by re2c 0.5 on Sat May 10 19:31:12 2003 */
|
||||
#line 1 "token.re"
|
||||
//
|
||||
// token.re
|
||||
|
@ -443,11 +443,15 @@ yy26:
|
|||
// Check for open indent
|
||||
ENSURE_IEND(lvl, indt_len);
|
||||
ENSURE_IOPEN(lvl, indt_len, 0);
|
||||
if ( indt_len == -1 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return INDENT;
|
||||
}
|
||||
yy27: yych = *++YYCURSOR;
|
||||
yy28:
|
||||
#line 276
|
||||
#line 280
|
||||
{ ENSURE_IOPEN(lvl, 0, 1);
|
||||
lvl = CURRENT_LEVEL();
|
||||
ADD_LEVEL(lvl->spaces + 1, syck_lvl_inline);
|
||||
|
@ -455,7 +459,7 @@ yy28:
|
|||
}
|
||||
yy29: yych = *++YYCURSOR;
|
||||
yy30:
|
||||
#line 282
|
||||
#line 286
|
||||
{ POP_LEVEL();
|
||||
return YYTOKEN[0];
|
||||
}
|
||||
|
@ -463,7 +467,7 @@ yy31: yych = *++YYCURSOR;
|
|||
if(yych == '\n') goto yy74;
|
||||
if(yych == ' ') goto yy71;
|
||||
yy32:
|
||||
#line 331
|
||||
#line 335
|
||||
{ ENSURE_IOPEN(lvl, 0, 1);
|
||||
goto Plain;
|
||||
}
|
||||
|
@ -481,15 +485,15 @@ yy35: yych = *++YYCURSOR;
|
|||
goto yy32;
|
||||
yy36: yych = *++YYCURSOR;
|
||||
yy37:
|
||||
#line 308
|
||||
#line 312
|
||||
{ goto TransferMethod; }
|
||||
yy38: yych = *++YYCURSOR;
|
||||
yy39:
|
||||
#line 310
|
||||
#line 314
|
||||
{ goto SingleQuote; }
|
||||
yy40: yych = *++YYCURSOR;
|
||||
yy41:
|
||||
#line 312
|
||||
#line 316
|
||||
{ goto DoubleQuote; }
|
||||
yy42: yyaccept = 0;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
|
@ -510,18 +514,18 @@ yy42: yyaccept = 0;
|
|||
}
|
||||
yy43: yych = *++YYCURSOR;
|
||||
yy44:
|
||||
#line 321
|
||||
#line 325
|
||||
{ eat_comments( parser );
|
||||
goto Document;
|
||||
}
|
||||
yy45: yych = *++YYCURSOR;
|
||||
goto yy51;
|
||||
yy46:
|
||||
#line 325
|
||||
#line 329
|
||||
{ goto Document; }
|
||||
yy47: yych = *++YYCURSOR;
|
||||
yy48:
|
||||
#line 327
|
||||
#line 331
|
||||
{ ENSURE_IEND(lvl, -1);
|
||||
return 0;
|
||||
}
|
||||
|
@ -556,7 +560,7 @@ yy55: ++YYCURSOR;
|
|||
yych = *YYCURSOR;
|
||||
yy56: if(yych == ' ') goto yy55;
|
||||
yy57:
|
||||
#line 314
|
||||
#line 318
|
||||
{ if ( *( YYCURSOR - 1 ) == '\n' )
|
||||
{
|
||||
YYCURSOR--;
|
||||
|
@ -573,7 +577,7 @@ yy60: ++YYCURSOR;
|
|||
yych = *YYCURSOR;
|
||||
yy61: if(yybm[0+yych] & 64) goto yy60;
|
||||
yy62:
|
||||
#line 304
|
||||
#line 308
|
||||
{ yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
|
||||
return ALIAS;
|
||||
}
|
||||
|
@ -584,7 +588,7 @@ yy64: if(yych <= '-') goto yy65;
|
|||
if(yych == '`') goto yy65;
|
||||
if(yych <= 'z') goto yy63;
|
||||
yy65:
|
||||
#line 300
|
||||
#line 304
|
||||
{ yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
|
||||
return ANCHOR;
|
||||
}
|
||||
|
@ -593,7 +597,7 @@ yy66: ++YYCURSOR;
|
|||
yych = *YYCURSOR;
|
||||
yy67: if(yych == ' ') goto yy66;
|
||||
yy68:
|
||||
#line 290
|
||||
#line 294
|
||||
{ ENSURE_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1);
|
||||
FORCE_NEXT_TOKEN(IOPEN);
|
||||
if ( *( YYCURSOR - 1 ) == '\n' )
|
||||
|
@ -613,7 +617,7 @@ yy71: ++YYCURSOR;
|
|||
yych = *YYCURSOR;
|
||||
yy72: if(yych == ' ') goto yy71;
|
||||
yy73:
|
||||
#line 286
|
||||
#line 290
|
||||
{ YYPOS(1);
|
||||
return YYTOKEN[0];
|
||||
}
|
||||
|
@ -633,7 +637,7 @@ yy78: ++YYCURSOR;
|
|||
yy79: if(yybm[0+yych] & 128) goto yy78;
|
||||
goto yy26;
|
||||
}
|
||||
#line 335
|
||||
#line 339
|
||||
|
||||
}
|
||||
|
||||
|
@ -701,14 +705,14 @@ yy83: yyaccept = 0;
|
|||
if(yych == '`') goto yy84;
|
||||
if(yych <= 'z') goto yy90;
|
||||
yy84:
|
||||
#line 348
|
||||
#line 352
|
||||
{ YYCURSOR = YYTOKTMP;
|
||||
return DOCSEP;
|
||||
}
|
||||
yy85: yych = *++YYCURSOR;
|
||||
goto yy89;
|
||||
yy86:
|
||||
#line 346
|
||||
#line 350
|
||||
{ goto Directive; }
|
||||
yy87: yych = *++YYCURSOR;
|
||||
goto yy84;
|
||||
|
@ -730,10 +734,10 @@ yy93: ++YYCURSOR;
|
|||
yych = *YYCURSOR;
|
||||
yy94: if(yybm[0+yych] & 128) goto yy93;
|
||||
yy95:
|
||||
#line 344
|
||||
#line 348
|
||||
{ goto Directive; }
|
||||
}
|
||||
#line 351
|
||||
#line 355
|
||||
|
||||
|
||||
}
|
||||
|
@ -816,7 +820,7 @@ yy96:
|
|||
yy98: yych = *++YYCURSOR;
|
||||
goto yy122;
|
||||
yy99:
|
||||
#line 371
|
||||
#line 375
|
||||
{ int indt_len;
|
||||
SyckLevel *lvl;
|
||||
char *tok = YYTOKTMP;
|
||||
|
@ -835,11 +839,11 @@ yy100: yych = *++YYCURSOR;
|
|||
if(yych == '\n') goto yy119;
|
||||
if(yych == ' ') goto yy116;
|
||||
yy101:
|
||||
#line 400
|
||||
#line 404
|
||||
{ goto Plain2; }
|
||||
yy102: yych = *++YYCURSOR;
|
||||
yy103:
|
||||
#line 388
|
||||
#line 392
|
||||
{ if ( plvl->status != syck_lvl_inline ) goto Plain2;
|
||||
RETURN_IMPLICIT(multiLine);
|
||||
}
|
||||
|
@ -849,18 +853,18 @@ yy104: yych = *++YYCURSOR;
|
|||
goto yy101;
|
||||
yy105: yych = *++YYCURSOR;
|
||||
yy106:
|
||||
#line 392
|
||||
#line 396
|
||||
{ RETURN_IMPLICIT(multiLine); }
|
||||
yy107: yych = *++YYCURSOR;
|
||||
if(yych == '#') goto yy110;
|
||||
yy108:
|
||||
#line 398
|
||||
#line 402
|
||||
{ goto Plain3; }
|
||||
yy109: yych = *++YYCURSOR;
|
||||
goto yy101;
|
||||
yy110: yych = *++YYCURSOR;
|
||||
yy111:
|
||||
#line 394
|
||||
#line 398
|
||||
{ eat_comments( parser );
|
||||
RETURN_IMPLICIT(multiLine);
|
||||
}
|
||||
|
@ -879,7 +883,7 @@ yy116: ++YYCURSOR;
|
|||
yych = *YYCURSOR;
|
||||
yy117: if(yych == ' ') goto yy116;
|
||||
yy118:
|
||||
#line 386
|
||||
#line 390
|
||||
{ RETURN_IMPLICIT(multiLine); }
|
||||
yy119: ++YYCURSOR;
|
||||
if(YYLIMIT == YYCURSOR) YYFILL(1);
|
||||
|
@ -897,7 +901,7 @@ yy123: ++YYCURSOR;
|
|||
yy124: if(yybm[0+yych] & 128) goto yy123;
|
||||
goto yy99;
|
||||
}
|
||||
#line 402
|
||||
#line 406
|
||||
|
||||
}
|
||||
|
||||
|
@ -962,7 +966,7 @@ yy125:
|
|||
yy127: yych = *++YYCURSOR;
|
||||
goto yy137;
|
||||
yy128:
|
||||
#line 416
|
||||
#line 420
|
||||
{ int indt_len;
|
||||
int nl_count = 0;
|
||||
SyckLevel *lvl;
|
||||
|
@ -1001,7 +1005,7 @@ yy128:
|
|||
yy129: yych = *++YYCURSOR;
|
||||
if(yych == '\'') goto yy134;
|
||||
yy130:
|
||||
#line 456
|
||||
#line 460
|
||||
{ SyckLevel *lvl;
|
||||
SyckNode *n = syck_alloc_str();
|
||||
lvl = CURRENT_LEVEL();
|
||||
|
@ -1019,13 +1023,13 @@ yy131: yych = *++YYCURSOR;
|
|||
goto yy130;
|
||||
yy132: yych = *++YYCURSOR;
|
||||
yy133:
|
||||
#line 470
|
||||
#line 474
|
||||
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
|
||||
goto SingleQuote2;
|
||||
}
|
||||
yy134: yych = *++YYCURSOR;
|
||||
yy135:
|
||||
#line 452
|
||||
#line 456
|
||||
{ QUOTECAT(qstr, qcapa, qidx, '\'');
|
||||
goto SingleQuote2;
|
||||
}
|
||||
|
@ -1040,7 +1044,7 @@ yy138: ++YYCURSOR;
|
|||
yy139: if(yybm[0+yych] & 128) goto yy138;
|
||||
goto yy128;
|
||||
}
|
||||
#line 474
|
||||
#line 478
|
||||
|
||||
|
||||
}
|
||||
|
@ -1110,7 +1114,7 @@ yy140:
|
|||
yy142: yych = *++YYCURSOR;
|
||||
goto yy158;
|
||||
yy143:
|
||||
#line 492
|
||||
#line 496
|
||||
{ int indt_len;
|
||||
int nl_count = 0;
|
||||
SyckLevel *lvl;
|
||||
|
@ -1182,13 +1186,13 @@ yy144: yyaccept = 0;
|
|||
}
|
||||
}
|
||||
yy145:
|
||||
#line 567
|
||||
#line 571
|
||||
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
|
||||
goto DoubleQuote2;
|
||||
}
|
||||
yy146: yych = *++YYCURSOR;
|
||||
yy147:
|
||||
#line 553
|
||||
#line 557
|
||||
{ SyckLevel *lvl;
|
||||
SyckNode *n = syck_alloc_str();
|
||||
lvl = CURRENT_LEVEL();
|
||||
|
@ -1217,14 +1221,14 @@ yy152: YYCURSOR = YYMARKER;
|
|||
}
|
||||
yy153: yych = *++YYCURSOR;
|
||||
yy154:
|
||||
#line 548
|
||||
#line 552
|
||||
{ keep_nl = 0;
|
||||
YYCURSOR--;
|
||||
goto DoubleQuote2;
|
||||
}
|
||||
yy155: yych = *++YYCURSOR;
|
||||
yy156:
|
||||
#line 532
|
||||
#line 536
|
||||
{ char ch = *( YYCURSOR - 1 );
|
||||
switch ( ch )
|
||||
{
|
||||
|
@ -1251,7 +1255,7 @@ yy159: ++YYCURSOR;
|
|||
yy160: if(yybm[0+yych] & 128) goto yy159;
|
||||
goto yy143;
|
||||
}
|
||||
#line 571
|
||||
#line 575
|
||||
|
||||
}
|
||||
|
||||
|
@ -1312,7 +1316,7 @@ yy161:
|
|||
yy163:yy164: yych = *++YYCURSOR;
|
||||
goto yy172;
|
||||
yy165:
|
||||
#line 580
|
||||
#line 584
|
||||
{ SyckLevel *lvl;
|
||||
YYCURSOR = YYTOKTMP;
|
||||
if ( YYCURSOR == YYTOKEN + 1 )
|
||||
|
@ -1354,13 +1358,19 @@ yy165:
|
|||
yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( *YYCURSOR == '\n' )
|
||||
{
|
||||
FORCE_NEXT_TOKEN(IOPEN);
|
||||
ADD_LEVEL(lvl->spaces, syck_lvl_doc);
|
||||
}
|
||||
return TRANSFER;
|
||||
}
|
||||
yy166: yych = *++YYCURSOR;
|
||||
goto yy170;
|
||||
yy167: yych = *++YYCURSOR;
|
||||
yy168:
|
||||
#line 624
|
||||
#line 634
|
||||
{ goto TransferMethod; }
|
||||
yy169: ++YYCURSOR;
|
||||
if(YYLIMIT == YYCURSOR) YYFILL(1);
|
||||
|
@ -1373,7 +1383,7 @@ yy171: ++YYCURSOR;
|
|||
yy172: if(yybm[0+yych] & 128) goto yy171;
|
||||
goto yy165;
|
||||
}
|
||||
#line 626
|
||||
#line 636
|
||||
|
||||
}
|
||||
|
||||
|
@ -1466,7 +1476,7 @@ yy173:
|
|||
yy175: yych = *++YYCURSOR;
|
||||
goto yy184;
|
||||
yy176:
|
||||
#line 668
|
||||
#line 678
|
||||
{ int indt_len;
|
||||
GOBBLE_UP_INDENT( indt_len, YYTOKTMP );
|
||||
lvl = CURRENT_LEVEL();
|
||||
|
@ -1499,7 +1509,7 @@ yy176:
|
|||
}
|
||||
yy177: yych = *++YYCURSOR;
|
||||
yy178:
|
||||
#line 700
|
||||
#line 710
|
||||
{ lvl = CURRENT_LEVEL();
|
||||
YYCURSOR--;
|
||||
yylval->nodeData = syck_new_str2( YYTOKEN, YYCURSOR - YYTOKEN );
|
||||
|
@ -1509,7 +1519,7 @@ yy178:
|
|||
}
|
||||
yy179: yych = *++YYCURSOR;
|
||||
yy180:
|
||||
#line 708
|
||||
#line 718
|
||||
{ lvl = CURRENT_LEVEL();
|
||||
if ( lvl->status != syck_lvl_block )
|
||||
{
|
||||
|
@ -1520,7 +1530,7 @@ yy180:
|
|||
}
|
||||
yy181: yych = *++YYCURSOR;
|
||||
yy182:
|
||||
#line 717
|
||||
#line 727
|
||||
{ goto ScalarBlock2; }
|
||||
yy183: ++YYCURSOR;
|
||||
if(YYLIMIT == YYCURSOR) YYFILL(1);
|
||||
|
@ -1533,7 +1543,7 @@ yy185: ++YYCURSOR;
|
|||
yy186: if(yybm[0+yych] & 128) goto yy185;
|
||||
goto yy176;
|
||||
}
|
||||
#line 719
|
||||
#line 729
|
||||
|
||||
}
|
||||
|
||||
|
@ -1595,7 +1605,7 @@ yy187:
|
|||
goto yy192;
|
||||
yy189: yych = *++YYCURSOR;
|
||||
yy190:
|
||||
#line 735
|
||||
#line 745
|
||||
{ SyckLevel *lvl = CURRENT_LEVEL();
|
||||
YYCURSOR = tok;
|
||||
return;
|
||||
|
@ -1604,7 +1614,7 @@ yy191: yych = *++YYCURSOR;
|
|||
goto yy195;
|
||||
yy192: yych = *++YYCURSOR;
|
||||
yy193:
|
||||
#line 740
|
||||
#line 750
|
||||
{ goto Comment;
|
||||
}
|
||||
yy194: ++YYCURSOR;
|
||||
|
@ -1613,7 +1623,7 @@ yy194: ++YYCURSOR;
|
|||
yy195: if(yybm[0+yych] & 128) goto yy194;
|
||||
goto yy190;
|
||||
}
|
||||
#line 743
|
||||
#line 753
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ class Object
|
|||
end
|
||||
end
|
||||
|
||||
YAML.add_ruby_type( Object ) { |type, val|
|
||||
YAML.add_ruby_type( 'object' ) { |type, val|
|
||||
type, obj_class = YAML.read_type_class( type, Object )
|
||||
YAML.object_maker( obj_class, val )
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ hash_proc = Proc.new { |type, val|
|
|||
end
|
||||
val
|
||||
}
|
||||
YAML.add_builtin_type( /^map/, &hash_proc )
|
||||
YAML.add_ruby_type( Hash, &hash_proc )
|
||||
YAML.add_builtin_type( 'map', &hash_proc )
|
||||
YAML.add_ruby_type( 'hash', &hash_proc )
|
||||
|
||||
module YAML
|
||||
|
||||
|
@ -120,7 +120,7 @@ module YAML
|
|||
end
|
||||
end
|
||||
|
||||
YAML.add_ruby_type( :flexhash ) { |type, val|
|
||||
YAML.add_ruby_type( 'flexhash' ) { |type, val|
|
||||
if Array === val
|
||||
p = FlexHash.new
|
||||
val.each { |v|
|
||||
|
@ -159,7 +159,7 @@ class Struct
|
|||
end
|
||||
end
|
||||
|
||||
YAML.add_ruby_type( Struct ) { |type, val|
|
||||
YAML.add_ruby_type( 'struct' ) { |type, val|
|
||||
type =~ /^struct:(\w+)/
|
||||
if Hash === val
|
||||
type = $1
|
||||
|
@ -237,8 +237,8 @@ array_proc = Proc.new { |type, val|
|
|||
val.to_a
|
||||
end
|
||||
}
|
||||
YAML.add_builtin_type( /^seq/, &array_proc )
|
||||
YAML.add_ruby_type( Array, &array_proc )
|
||||
YAML.add_builtin_type( 'seq', &array_proc )
|
||||
YAML.add_ruby_type( 'array', &array_proc )
|
||||
|
||||
#
|
||||
# String#to_yaml
|
||||
|
@ -318,8 +318,8 @@ symbol_proc = Proc.new { |type, val|
|
|||
raise YAML::Error, "Invalid Symbol: " + val.inspect
|
||||
end
|
||||
}
|
||||
YAML.add_ruby_type( Symbol, &symbol_proc )
|
||||
YAML.add_ruby_type( :sym, &symbol_proc )
|
||||
YAML.add_ruby_type( 'symbol', &symbol_proc )
|
||||
YAML.add_ruby_type( 'sym', &symbol_proc )
|
||||
|
||||
#
|
||||
# Range#to_yaml
|
||||
|
@ -336,7 +336,7 @@ class Range
|
|||
end
|
||||
end
|
||||
|
||||
YAML.add_ruby_type( Range ) { |type, val|
|
||||
YAML.add_ruby_type( 'range' ) { |type, val|
|
||||
if String === val and val =~ /^(.*[^.])(\.{2,3})([^.].*)$/
|
||||
r1, rdots, r2 = $1, $2, $3
|
||||
Range.new( YAML.try_implicit( r1 ), YAML.try_implicit( r2 ), rdots.length == 3 )
|
||||
|
@ -384,7 +384,7 @@ regexp_proc = Proc.new { |type, val|
|
|||
end
|
||||
}
|
||||
YAML.add_domain_type( "perl.yaml.org,2002", /^regexp/, ®exp_proc )
|
||||
YAML.add_ruby_type( Regexp, ®exp_proc )
|
||||
YAML.add_ruby_type( 'regexp', ®exp_proc )
|
||||
|
||||
#
|
||||
# Emit a Time object as an ISO 8601 timestamp
|
||||
|
|
Загрузка…
Ссылка в новой задаче