summaryrefslogtreecommitdiff
path: root/ext/syck/token.c
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-21 21:16:58 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-21 21:16:58 +0000
commit7cca6c25f0682053b861fa987fa5b415346d044f (patch)
treeaf728c81dbd8c7d197b9965109d6f0802a893e15 /ext/syck/token.c
parent52e6a899ea1895363f0e61c8e1ef6295ac83fcab (diff)
* ext/syck/rubyext.c: refactoring of the transfer method
dispatch. added yaml_org_handler for faster dispatch of transfers to base types. * lib/yaml/rubytypes.rb: removed handling of builtins from Ruby library. * ext/syck/token.c: quoted and block scalars are now implicit !str * ext/syck/implicit.c: empty string detected as !null. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/syck/token.c')
-rw-r--r--ext/syck/token.c125
1 files changed, 64 insertions, 61 deletions
diff --git a/ext/syck/token.c b/ext/syck/token.c
index 1fc274c5901..d84d54505f5 100644
--- a/ext/syck/token.c
+++ b/ext/syck/token.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.5 on Mon Jul 28 21:10:39 2003 */
+/* Generated by re2c 0.5 on Thu Aug 21 14:28:35 2003 */
#line 1 "token.re"
/*
* token.re
@@ -137,6 +137,7 @@
#define RETURN_YAML_BLOCK() \
{ \
SyckNode *n = syck_alloc_str(); \
+ n->type_id = syck_strndup( "str", 3 ); \
n->data.str->ptr = qstr; \
n->data.str->len = qidx; \
if ( qidx > 0 ) \
@@ -228,7 +229,7 @@ sycklex( YYSTYPE *sycklval, SyckParser *parser )
return t;
}
-#line 246
+#line 247
if ( YYLINEPTR != YYCURSOR )
@@ -264,7 +265,7 @@ yy2: yyaccept = 0;
default: goto yy3;
}
yy3:
-#line 302
+#line 303
{ YYPOS(0);
goto Document;
}
@@ -276,13 +277,13 @@ yy4: yyaccept = 0;
}
yy5: yych = *++YYCURSOR;
yy6:
-#line 287
+#line 288
{ eat_comments( parser );
goto Header;
}
yy7: yych = *++YYCURSOR;
yy8:
-#line 291
+#line 292
{ SyckLevel *lvl = CURRENT_LEVEL();
ENSURE_YAML_IEND(lvl, -1);
YYPOS(0);
@@ -292,7 +293,7 @@ yy9: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
goto yy14;
yy10:
-#line 297
+#line 298
{ int indt_len;
GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
goto Header;
@@ -339,7 +340,7 @@ yy18: yych = *++YYCURSOR;
}
yy19: yych = *++YYCURSOR;
yy20:
-#line 273
+#line 274
{ SyckLevel *lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_header )
{
@@ -379,7 +380,7 @@ yy25: yych = *++YYCURSOR;
}
yy26: yych = *++YYCURSOR;
yy27:
-#line 259
+#line 260
{ SyckLevel *lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_header )
{
@@ -406,7 +407,7 @@ yy30: yych = *++YYCURSOR;
default: goto yy16;
}
}
-#line 306
+#line 307
Document:
@@ -449,7 +450,7 @@ yy33: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy86;
yy34:
-#line 320
+#line 321
{ /* Isolate spaces */
int indt_len;
GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
@@ -470,13 +471,13 @@ yy35: yych = *++YYCURSOR;
default: goto yy36;
}
yy36:
-#line 407
+#line 408
{ ENSURE_YAML_IOPEN(lvl, 0, 1);
goto Plain;
}
yy37: yych = *++YYCURSOR;
yy38:
-#line 335
+#line 336
{ ENSURE_YAML_IOPEN(lvl, 0, 1);
lvl = CURRENT_LEVEL();
ADD_LEVEL(lvl->spaces + 1, syck_lvl_inline);
@@ -484,7 +485,7 @@ yy38:
}
yy39: yych = *++YYCURSOR;
yy40:
-#line 341
+#line 342
{ POP_LEVEL();
return YYTOKEN[0];
}
@@ -634,17 +635,17 @@ yy44: yych = *++YYCURSOR;
}
yy45: yych = *++YYCURSOR;
yy46:
-#line 380
+#line 381
{ ENSURE_YAML_IOPEN(lvl, 0, 1);
goto TransferMethod; }
yy47: yych = *++YYCURSOR;
yy48:
-#line 383
+#line 384
{ ENSURE_YAML_IOPEN(lvl, 0, 1);
goto SingleQuote; }
yy49: yych = *++YYCURSOR;
yy50:
-#line 386
+#line 387
{ ENSURE_YAML_IOPEN(lvl, 0, 1);
goto DoubleQuote; }
yy51: yyaccept = 1;
@@ -667,18 +668,18 @@ yy51: yyaccept = 1;
}
yy52: yych = *++YYCURSOR;
yy53:
-#line 396
+#line 397
{ eat_comments( parser );
goto Document;
}
yy54: yych = *++YYCURSOR;
goto yy60;
yy55:
-#line 400
+#line 401
{ goto Document; }
yy56: yych = *++YYCURSOR;
yy57:
-#line 402
+#line 403
{ ENSURE_YAML_IEND(lvl, -1);
YYPOS(0);
return 0;
@@ -718,7 +719,7 @@ yy63: YYCURSOR = YYMARKER;
}
yy64: yych = *++YYCURSOR;
yy65:
-#line 389
+#line 390
{ if ( is_newline( YYCURSOR - 1 ) )
{
YYCURSOR--;
@@ -804,7 +805,7 @@ yy70: switch(yych){
default: goto yy71;
}
yy71:
-#line 375
+#line 376
{ ENSURE_YAML_IOPEN(lvl, 0, 1);
sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
return YAML_ALIAS;
@@ -876,7 +877,7 @@ yy73: switch(yych){
default: goto yy74;
}
yy74:
-#line 363
+#line 364
{ ENSURE_YAML_IOPEN(lvl, 0, 1);
sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
@@ -890,7 +891,7 @@ yy74:
}
yy75: yych = *++YYCURSOR;
yy76:
-#line 349
+#line 350
{ ENSURE_YAML_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1);
FORCE_NEXT_TOKEN(YAML_IOPEN);
if ( is_newline( YYCURSOR ) || is_newline( YYCURSOR - 1 ) )
@@ -918,7 +919,7 @@ yy79: yych = *++YYCURSOR;
}
yy80: yych = *++YYCURSOR;
yy81:
-#line 345
+#line 346
{ YYPOS(1);
return YYTOKEN[0];
}
@@ -951,7 +952,7 @@ yy87: ++YYCURSOR;
default: goto yy63;
}
}
-#line 411
+#line 412
}
@@ -1058,14 +1059,14 @@ yy91: yyaccept = 0;
default: goto yy92;
}
yy92:
-#line 424
+#line 425
{ YYCURSOR = YYTOKTMP;
return YAML_DOCSEP;
}
yy93: yych = *++YYCURSOR;
goto yy97;
yy94:
-#line 422
+#line 423
{ goto Directive; }
yy95: yych = *++YYCURSOR;
goto yy92;
@@ -1317,10 +1318,10 @@ yy102: switch(yych){
default: goto yy103;
}
yy103:
-#line 420
+#line 421
{ goto Directive; }
}
-#line 427
+#line 428
}
@@ -1364,7 +1365,7 @@ yy106: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy132;
yy107:
-#line 450
+#line 451
{ int indt_len, nl_count = 0;
SyckLevel *lvl;
char *tok = YYTOKTMP;
@@ -1402,7 +1403,7 @@ yy108: yych = *++YYCURSOR;
default: goto yy109;
}
yy109:
-#line 504
+#line 505
{ QUOTECATS(qstr, qcapa, qidx, YYTOKTMP, YYCURSOR - YYTOKTMP);
goto Plain2;
}
@@ -1416,7 +1417,7 @@ yy110: yyaccept = 1;
}
yy111: yych = *++YYCURSOR;
yy112:
-#line 484
+#line 485
{ if ( plvl->status != syck_lvl_inline )
{
if ( *(YYCURSOR - 1) == ' ' || is_newline( YYCURSOR - 1 ) )
@@ -1442,17 +1443,17 @@ yy114: yych = *++YYCURSOR;
default: goto yy115;
}
yy115:
-#line 502
+#line 503
{ goto Plain3; }
yy116: yych = *++YYCURSOR;
yy117:
-#line 500
+#line 501
{ RETURN_IMPLICIT(); }
yy118: yych = *++YYCURSOR;
goto yy109;
yy119: yych = *++YYCURSOR;
yy120:
-#line 496
+#line 497
{ eat_comments( parser );
RETURN_IMPLICIT();
}
@@ -1477,7 +1478,7 @@ yy125: YYCURSOR = YYMARKER;
}
yy126: yych = *++YYCURSOR;
yy127:
-#line 482
+#line 483
{ RETURN_IMPLICIT(); }
yy128: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -1508,7 +1509,7 @@ yy133: ++YYCURSOR;
default: goto yy125;
}
}
-#line 508
+#line 509
}
@@ -1540,7 +1541,7 @@ yy136: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy147;
yy137:
-#line 522
+#line 523
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1582,7 +1583,7 @@ yy138: yych = *++YYCURSOR;
default: goto yy139;
}
yy139:
-#line 576
+#line 578
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto SingleQuote2;
}
@@ -1592,7 +1593,7 @@ yy140: yych = *++YYCURSOR;
default: goto yy141;
}
yy141:
-#line 562
+#line 563
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1601,6 +1602,7 @@ yy141:
{
POP_LEVEL();
}
+ n->type_id = syck_strndup( "str", 3 );
n->data.str->ptr = qstr;
n->data.str->len = qidx;
sycklval->nodeData = n;
@@ -1612,7 +1614,7 @@ yy143: yych = *++YYCURSOR;
goto yy139;
yy144: yych = *++YYCURSOR;
yy145:
-#line 558
+#line 559
{ QUOTECAT(qstr, qcapa, qidx, '\'');
goto SingleQuote2;
}
@@ -1637,7 +1639,7 @@ yy149: YYCURSOR = YYMARKER;
case 0: goto yy137;
}
}
-#line 580
+#line 582
}
@@ -1674,7 +1676,7 @@ yy152: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy174;
yy153:
-#line 598
+#line 600
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1720,7 +1722,7 @@ yy154: yych = *++YYCURSOR;
default: goto yy155;
}
yy155:
-#line 682
+#line 685
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto DoubleQuote2;
}
@@ -1738,7 +1740,7 @@ yy156: yyaccept = 1;
}
yy157: yych = *++YYCURSOR;
yy158:
-#line 668
+#line 670
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1747,6 +1749,7 @@ yy158:
{
POP_LEVEL();
}
+ n->type_id = syck_strndup( "str", 3 );
n->data.str->ptr = qstr;
n->data.str->len = qidx;
sycklval->nodeData = n;
@@ -1772,7 +1775,7 @@ yy163: YYCURSOR = YYMARKER;
}
yy164: yych = *++YYCURSOR;
yy165:
-#line 663
+#line 665
{ keep_nl = 0;
YYCURSOR--;
goto DoubleQuote2;
@@ -1808,7 +1811,7 @@ yy167: yych = *++YYCURSOR;
}
yy168: yych = *++YYCURSOR;
yy169:
-#line 638
+#line 640
{ char ch = *( YYCURSOR - 1 );
switch ( ch )
{
@@ -1850,7 +1853,7 @@ yy170: yych = *++YYCURSOR;
}
yy171: yych = *++YYCURSOR;
yy172:
-#line 654
+#line 656
{ long ch;
char *chr_text = syck_strndup( YYTOKTMP, 4 );
chr_text[0] = '0';
@@ -1876,7 +1879,7 @@ yy175: ++YYCURSOR;
default: goto yy163;
}
}
-#line 686
+#line 689
}
@@ -1911,7 +1914,7 @@ yy178: YYCURSOR = YYMARKER;
}
yy179: yych = *++YYCURSOR;
yy180:
-#line 700
+#line 703
{ SyckLevel *lvl;
YYCURSOR = YYTOKTMP;
if ( YYCURSOR == YYTOKEN + 1 )
@@ -1969,7 +1972,7 @@ yy182: yych = *++YYCURSOR;
default: goto yy183;
}
yy183:
-#line 762
+#line 765
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto TransferMethod2;
}
@@ -2031,7 +2034,7 @@ yy187: yych = *++YYCURSOR;
}
yy188: yych = *++YYCURSOR;
yy189:
-#line 753
+#line 756
{ long ch;
char *chr_text = syck_strndup( YYTOKTMP, 4 );
chr_text[0] = '0';
@@ -2050,7 +2053,7 @@ yy192: switch(yych){
default: goto yy180;
}
}
-#line 767
+#line 770
}
@@ -2115,7 +2118,7 @@ yy195: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy205;
yy196:
-#line 814
+#line 817
{ char *pacer;
char *tok = YYTOKTMP;
int indt_len = 0, nl_count = 0, fold_nl = 0, nl_begin = 0;
@@ -2187,13 +2190,13 @@ yy197: yych = *++YYCURSOR;
default: goto yy198;
}
yy198:
-#line 900
+#line 903
{ QUOTECAT(qstr, qcapa, qidx, *YYTOKTMP);
goto ScalarBlock2;
}
yy199: yych = *++YYCURSOR;
yy200:
-#line 881
+#line 884
{ lvl = CURRENT_LEVEL();
if ( lvl->status != syck_lvl_block )
{
@@ -2208,7 +2211,7 @@ yy200:
}
yy201: yych = *++YYCURSOR;
yy202:
-#line 895
+#line 898
{ YYCURSOR--;
POP_LEVEL();
RETURN_YAML_BLOCK();
@@ -2236,7 +2239,7 @@ yy207: YYCURSOR = YYMARKER;
case 0: goto yy196;
}
}
-#line 905
+#line 908
}
@@ -2269,7 +2272,7 @@ yy208:
}
yy210: yych = *++YYCURSOR;
yy211:
-#line 923
+#line 926
{ YYCURSOR = tok;
return;
}
@@ -2282,7 +2285,7 @@ yy213: yych = *++YYCURSOR;
default: goto yy214;
}
yy214:
-#line 927
+#line 930
{ goto Comment;
}
yy215: yych = *++YYCURSOR;
@@ -2308,7 +2311,7 @@ yy219: YYCURSOR = YYMARKER;
case 0: goto yy211;
}
}
-#line 930
+#line 933
}