summaryrefslogtreecommitdiff
path: root/ext/syck/token.c
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-11 06:32:13 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-11 06:32:13 +0000
commite44e2ef2e84012bd842228c8b86de776a9a334d6 (patch)
tree6798f736db01ce77147aa033335f78bd8a092ede /ext/syck/token.c
parent0b5d8d2d664a544e524a40082affa7c8aa0bc44d (diff)
* 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
Diffstat (limited to 'ext/syck/token.c')
-rw-r--r--ext/syck/token.c110
1 files changed, 60 insertions, 50 deletions
diff --git a/ext/syck/token.c b/ext/syck/token.c
index 17ca2d21ebb..04c5bab860b 100644
--- a/ext/syck/token.c
+++ b/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
}