summaryrefslogtreecommitdiff
path: root/ext/syck/token.c
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-29 23:51:16 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-29 23:51:16 +0000
commit5b743d275e5e6be6ef1fb47b85a106aa197057d1 (patch)
treee906be4ac9787b99f6c2c00b69a0020112ab31e7 /ext/syck/token.c
parent5d47fda3f8b7148087a866cfd3033ab185e492fd (diff)
* ext/syck/token.c: preserve any indentation passed an explicit
indentation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/syck/token.c')
-rw-r--r--ext/syck/token.c124
1 files changed, 61 insertions, 63 deletions
diff --git a/ext/syck/token.c b/ext/syck/token.c
index e6bb1015f59..39ccbd8dd1c 100644
--- a/ext/syck/token.c
+++ b/ext/syck/token.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.5 on Thu May 29 17:33:02 2003 */
+/* Generated by re2c 0.5 on Thu May 29 17:58:58 2003 */
#line 1 "token.re"
/*
* token.re
@@ -149,11 +149,6 @@
fc += 1; \
n->data.str->len = fc - n->data.str->ptr + 1; \
} \
- else \
- { \
- n->data.str->ptr[n->data.str->len] = '\n'; \
- n->data.str->len++; \
- } \
} \
yylval->nodeData = n; \
return BLOCK; \
@@ -231,7 +226,7 @@ yylex( YYSTYPE *yylval, SyckParser *parser )
return t;
}
-#line 247
+#line 242
if ( YYLINEPTR != YYCURSOR )
@@ -265,19 +260,19 @@ yy2: yyaccept = 0;
default: goto yy3;
}
yy3:
-#line 288
+#line 283
{ YYPOS(0);
goto Document;
}
yy4: yych = *++YYCURSOR;
yy5:
-#line 274
+#line 269
{ eat_comments( parser );
goto Header;
}
yy6: yych = *++YYCURSOR;
yy7:
-#line 278
+#line 273
{ SyckLevel *lvl = CURRENT_LEVEL();
ENSURE_IEND(lvl, -1);
return 0;
@@ -285,7 +280,7 @@ yy7:
yy8: yych = *++YYCURSOR;
goto yy12;
yy9:
-#line 283
+#line 278
{ int indt_len;
GOBBLE_UP_INDENT( indt_len, YYTOKEN );
goto Header;
@@ -330,7 +325,7 @@ yy19: switch(yych){
default: goto yy20;
}
yy20:
-#line 260
+#line 255
{ SyckLevel *lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_header )
{
@@ -352,7 +347,7 @@ yy22: switch(yych){
default: goto yy20;
}
}
-#line 292
+#line 287
Document:
@@ -393,7 +388,7 @@ yy23:
yy25: yych = *++YYCURSOR;
goto yy77;
yy26:
-#line 306
+#line 301
{ // Isolate spaces
int indt_len;
GOBBLE_UP_INDENT( indt_len, YYTOKEN );
@@ -410,7 +405,7 @@ yy26:
}
yy27: yych = *++YYCURSOR;
yy28:
-#line 321
+#line 316
{ ENSURE_IOPEN(lvl, 0, 1);
lvl = CURRENT_LEVEL();
ADD_LEVEL(lvl->spaces + 1, syck_lvl_inline);
@@ -418,7 +413,7 @@ yy28:
}
yy29: yych = *++YYCURSOR;
yy30:
-#line 327
+#line 322
{ POP_LEVEL();
return YYTOKEN[0];
}
@@ -429,7 +424,7 @@ yy31: yych = *++YYCURSOR;
default: goto yy32;
}
yy32:
-#line 385
+#line 380
{ ENSURE_IOPEN(lvl, 0, 1);
goto Plain;
}
@@ -569,17 +564,17 @@ yy35: yych = *++YYCURSOR;
}
yy36: yych = *++YYCURSOR;
yy37:
-#line 359
+#line 354
{ ENSURE_IOPEN(lvl, 0, 1);
goto TransferMethod; }
yy38: yych = *++YYCURSOR;
yy39:
-#line 362
+#line 357
{ ENSURE_IOPEN(lvl, 0, 1);
goto SingleQuote; }
yy40: yych = *++YYCURSOR;
yy41:
-#line 365
+#line 360
{ ENSURE_IOPEN(lvl, 0, 1);
goto DoubleQuote; }
yy42: yyaccept = 0;
@@ -601,18 +596,18 @@ yy42: yyaccept = 0;
}
yy43: yych = *++YYCURSOR;
yy44:
-#line 375
+#line 370
{ eat_comments( parser );
goto Document;
}
yy45: yych = *++YYCURSOR;
goto yy51;
yy46:
-#line 379
+#line 374
{ goto Document; }
yy47: yych = *++YYCURSOR;
yy48:
-#line 381
+#line 376
{ ENSURE_IEND(lvl, -1);
return 0;
}
@@ -655,7 +650,7 @@ yy56: switch(yych){
default: goto yy57;
}
yy57:
-#line 368
+#line 363
{ if ( *( YYCURSOR - 1 ) == '\n' )
{
YYCURSOR--;
@@ -736,7 +731,7 @@ yy61: switch(yych){
default: goto yy62;
}
yy62:
-#line 354
+#line 349
{ ENSURE_IOPEN(lvl, 0, 1);
yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
return ALIAS;
@@ -808,7 +803,7 @@ yy64: switch(yych){
default: goto yy65;
}
yy65:
-#line 349
+#line 344
{ ENSURE_IOPEN(lvl, 0, 1);
yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
return ANCHOR;
@@ -821,7 +816,7 @@ yy67: switch(yych){
default: goto yy68;
}
yy68:
-#line 335
+#line 330
{ ENSURE_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1);
FORCE_NEXT_TOKEN(IOPEN);
if ( *YYCURSOR == '\n' || *( YYCURSOR - 1 ) == '\n' )
@@ -850,7 +845,7 @@ yy72: switch(yych){
default: goto yy73;
}
yy73:
-#line 331
+#line 326
{ YYPOS(1);
return YYTOKEN[0];
}
@@ -877,7 +872,7 @@ yy79: switch(yych){
default: goto yy26;
}
}
-#line 389
+#line 384
}
@@ -969,14 +964,14 @@ yy83: yyaccept = 0;
default: goto yy84;
}
yy84:
-#line 402
+#line 397
{ YYCURSOR = YYTOKTMP;
return DOCSEP;
}
yy85: yych = *++YYCURSOR;
goto yy89;
yy86:
-#line 400
+#line 395
{ goto Directive; }
yy87: yych = *++YYCURSOR;
goto yy84;
@@ -1185,10 +1180,10 @@ yy94: switch(yych){
default: goto yy95;
}
yy95:
-#line 398
+#line 393
{ goto Directive; }
}
-#line 405
+#line 400
}
@@ -1230,7 +1225,7 @@ yy96:
yy98: yych = *++YYCURSOR;
goto yy122;
yy99:
-#line 428
+#line 423
{ int indt_len, nl_count = 0;
SyckLevel *lvl;
char *tok = YYTOKTMP;
@@ -1269,13 +1264,13 @@ yy100: yych = *++YYCURSOR;
default: goto yy101;
}
yy101:
-#line 479
+#line 474
{ QUOTECATS(qstr, qcapa, qidx, YYTOKTMP, YYCURSOR - YYTOKTMP);
goto Plain2;
}
yy102: yych = *++YYCURSOR;
yy103:
-#line 462
+#line 457
{ if ( plvl->status != syck_lvl_inline )
{
YYCURSOR--;
@@ -1296,17 +1291,17 @@ yy105: yych = *++YYCURSOR;
default: goto yy106;
}
yy106:
-#line 477
+#line 472
{ goto Plain3; }
yy107: yych = *++YYCURSOR;
yy108:
-#line 475
+#line 470
{ RETURN_IMPLICIT(); }
yy109: yych = *++YYCURSOR;
goto yy101;
yy110: yych = *++YYCURSOR;
yy111:
-#line 471
+#line 466
{ eat_comments( parser );
RETURN_IMPLICIT();
}
@@ -1332,7 +1327,7 @@ yy117: switch(yych){
default: goto yy118;
}
yy118:
-#line 460
+#line 455
{ RETURN_IMPLICIT(); }
yy119: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -1357,7 +1352,7 @@ yy124: switch(yych){
default: goto yy99;
}
}
-#line 483
+#line 478
}
@@ -1387,7 +1382,7 @@ yy125:
yy127: yych = *++YYCURSOR;
goto yy137;
yy128:
-#line 497
+#line 492
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1429,7 +1424,7 @@ yy129: yych = *++YYCURSOR;
default: goto yy130;
}
yy130:
-#line 537
+#line 532
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1447,13 +1442,13 @@ yy131: yych = *++YYCURSOR;
goto yy130;
yy132: yych = *++YYCURSOR;
yy133:
-#line 551
+#line 546
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto SingleQuote2;
}
yy134: yych = *++YYCURSOR;
yy135:
-#line 533
+#line 528
{ QUOTECAT(qstr, qcapa, qidx, '\'');
goto SingleQuote2;
}
@@ -1473,7 +1468,7 @@ yy139: switch(yych){
default: goto yy128;
}
}
-#line 555
+#line 550
}
@@ -1508,7 +1503,7 @@ yy140:
yy142: yych = *++YYCURSOR;
goto yy158;
yy143:
-#line 573
+#line 568
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1559,13 +1554,13 @@ yy144: yyaccept = 0;
default: goto yy145;
}
yy145:
-#line 648
+#line 643
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto DoubleQuote2;
}
yy146: yych = *++YYCURSOR;
yy147:
-#line 634
+#line 629
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1597,14 +1592,14 @@ yy152: YYCURSOR = YYMARKER;
}
yy153: yych = *++YYCURSOR;
yy154:
-#line 629
+#line 624
{ keep_nl = 0;
YYCURSOR--;
goto DoubleQuote2;
}
yy155: yych = *++YYCURSOR;
yy156:
-#line 613
+#line 608
{ char ch = *( YYCURSOR - 1 );
switch ( ch )
{
@@ -1636,7 +1631,7 @@ yy160: switch(yych){
default: goto yy143;
}
}
-#line 652
+#line 647
}
@@ -1661,7 +1656,7 @@ yy161:
yy163:yy164: yych = *++YYCURSOR;
goto yy172;
yy165:
-#line 661
+#line 656
{ SyckLevel *lvl;
YYCURSOR = YYTOKTMP;
if ( YYCURSOR == YYTOKEN + 1 )
@@ -1711,7 +1706,7 @@ yy166: yych = *++YYCURSOR;
goto yy170;
yy167: yych = *++YYCURSOR;
yy168:
-#line 707
+#line 702
{ goto TransferMethod; }
yy169: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -1728,7 +1723,7 @@ yy172: switch(yych){
default: goto yy165;
}
}
-#line 709
+#line 704
}
@@ -1791,7 +1786,7 @@ yy173:
yy175: yych = *++YYCURSOR;
goto yy182;
yy176:
-#line 757
+#line 752
{ char *pacer;
char *tok = YYTOKTMP;
int indt_len = 0, nl_count = 0, fold_nl = 0;
@@ -1800,7 +1795,10 @@ yy176:
if ( indt_len > parentIndent && lvl->status != syck_lvl_block )
{
- ADD_LEVEL( forceIndent > 0 ? forceIndent : indt_len, syck_lvl_block );
+ int new_spaces = forceIndent > 0 ? forceIndent : indt_len;
+ ADD_LEVEL( new_spaces, syck_lvl_block );
+ lastIndent = indt_len - new_spaces;
+ YYCURSOR -= lastIndent;
goto ScalarBlock2;
}
@@ -1858,14 +1856,14 @@ yy176:
}
yy177: yych = *++YYCURSOR;
yy178:
-#line 823
+#line 821
{ YYCURSOR--;
POP_LEVEL();
RETURN_BLOCK();
}
yy179: yych = *++YYCURSOR;
yy180:
-#line 828
+#line 826
{ QUOTECAT(qstr, qcapa, qidx, *YYTOKTMP);
goto ScalarBlock2;
}
@@ -1885,7 +1883,7 @@ yy184: switch(yych){
default: goto yy176;
}
}
-#line 833
+#line 831
}
@@ -1915,7 +1913,7 @@ yy185:
}
yy187: yych = *++YYCURSOR;
yy188:
-#line 849
+#line 847
{ SyckLevel *lvl = CURRENT_LEVEL();
YYCURSOR = tok;
return;
@@ -1924,7 +1922,7 @@ yy189: yych = *++YYCURSOR;
goto yy193;
yy190: yych = *++YYCURSOR;
yy191:
-#line 854
+#line 852
{ goto Comment;
}
yy192: ++YYCURSOR;
@@ -1935,7 +1933,7 @@ yy193: switch(yych){
default: goto yy188;
}
}
-#line 857
+#line 855
}