summaryrefslogtreecommitdiff
path: root/ext/syck/token.c
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-10 14:15:27 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-10 14:15:27 +0000
commite921ea2d78f693c57fcb289faff3fc126dc8617a (patch)
tree6931c25c8907d5e481be1281be1a30297a3fff53 /ext/syck/token.c
parent3079dcab4ad9e7624703d772f6fc54dc10e45bce (diff)
* ext/syck/token.c: preserve newlines prepended to a block.
* ext/syck/implicit.c (syck_match_implicit): added !merge and !default. * lib/yaml/constants.rb: remove '\z' escape. * lib/yaml/emitter.rb: ensure reset of @seq_map shortcut flag. * lib/yaml/encoding.rb: remove Unicode translation methods. * lib/yaml/rubytypes.rb: improved round-tripping of Strings. [ruby-core:1134] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/syck/token.c')
-rw-r--r--ext/syck/token.c975
1 files changed, 543 insertions, 432 deletions
diff --git a/ext/syck/token.c b/ext/syck/token.c
index d33b546a733..817689908c2 100644
--- a/ext/syck/token.c
+++ b/ext/syck/token.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.5 on Thu Jun 5 11:08:22 2003 */
+/* Generated by re2c 0.5 on Mon Jun 9 18:21:18 2003 */
#line 1 "token.re"
/*
* token.re
@@ -144,7 +144,7 @@
if ( nlDoWhat != NL_KEEP ) \
{ \
char *fc = n->data.str->ptr + n->data.str->len - 1; \
- while ( *fc == '\n' ) fc--; \
+ while ( is_newline( fc ) ) fc--; \
if ( nlDoWhat != NL_CHOMP ) \
fc += 1; \
n->data.str->len = fc - n->data.str->ptr + 1; \
@@ -162,7 +162,7 @@
NEWLINE(indent); \
while ( indent < YYCURSOR ) \
{ \
- if ( *(++indent) == '\n' ) \
+ if ( is_newline( ++indent ) ) \
{ \
NEWLINE(indent); \
} \
@@ -226,7 +226,7 @@ yylex( YYSTYPE *yylval, SyckParser *parser )
return t;
}
-#line 244
+#line 245
if ( YYLINEPTR != YYCURSOR )
@@ -244,89 +244,93 @@ Header:
goto yy0;
yy1: ++YYCURSOR;
yy0:
- if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
+ if((YYLIMIT - YYCURSOR) < 5) YYFILL(5);
yych = *YYCURSOR;
switch(yych){
case '\000': goto yy6;
case '\n': goto yy8;
+ case '\r': goto yy10;
case '#': goto yy4;
case '-': goto yy2;
- default: goto yy10;
+ default: goto yy11;
}
yy2: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case '-': goto yy15;
+ case '-': goto yy16;
default: goto yy3;
}
yy3:
-#line 286
+#line 287
{ YYPOS(0);
goto Document;
}
yy4: yych = *++YYCURSOR;
yy5:
-#line 271
+#line 272
{ eat_comments( parser );
goto Header;
}
yy6: yych = *++YYCURSOR;
yy7:
-#line 275
+#line 276
{ SyckLevel *lvl = CURRENT_LEVEL();
ENSURE_IEND(lvl, -1);
YYPOS(0);
return 0;
}
-yy8: yych = *++YYCURSOR;
- goto yy12;
+yy8: yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy13;
yy9:
-#line 281
+#line 282
{ int indt_len;
GOBBLE_UP_INDENT( indt_len, YYTOKEN );
goto Header;
}
yy10: yych = *++YYCURSOR;
+ switch(yych){
+ case '\n': goto yy12;
+ default: goto yy3;
+ }
+yy11: yych = *++YYCURSOR;
goto yy3;
-yy11: ++YYCURSOR;
+yy12: yyaccept = 1;
+ YYMARKER = ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy12: switch(yych){
- case '\n': goto yy11;
- case ' ': goto yy13;
+yy13: switch(yych){
+ case '\n': case ' ': goto yy12;
+ case '\r': goto yy14;
default: goto yy9;
}
-yy13: ++YYCURSOR;
+yy14: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy14: switch(yych){
- case '\n': case ' ': goto yy13;
- default: goto yy9;
- }
-yy15: yych = *++YYCURSOR;
switch(yych){
- case '-': goto yy17;
- default: goto yy16;
+ case '\n': goto yy12;
+ default: goto yy15;
}
-yy16: YYCURSOR = YYMARKER;
+yy15: YYCURSOR = YYMARKER;
switch(yyaccept){
+ case 1: goto yy9;
case 0: goto yy3;
}
-yy17: yych = *++YYCURSOR;
+yy16: yych = *++YYCURSOR;
switch(yych){
- case '\n': goto yy21;
- case ' ': goto yy18;
- default: goto yy16;
- }
-yy18: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy19: switch(yych){
- case ' ': goto yy18;
- default: goto yy20;
+ case '-': goto yy17;
+ default: goto yy15;
}
-yy20:
-#line 257
+yy17: yych = *++YYCURSOR;
+ switch(yych){
+ case '\n': goto yy18;
+ case '\r': goto yy22;
+ case ' ': goto yy20;
+ default: goto yy15;
+ }
+yy18: yych = *++YYCURSOR;
+yy19:
+#line 258
{ SyckLevel *lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_header )
{
@@ -340,15 +344,20 @@ yy20:
return 0;
}
}
-yy21: ++YYCURSOR;
+yy20: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy22: switch(yych){
- case '\n': goto yy21;
- default: goto yy20;
+yy21: switch(yych){
+ case ' ': goto yy20;
+ default: goto yy19;
+ }
+yy22: yych = *++YYCURSOR;
+ switch(yych){
+ case '\n': goto yy18;
+ default: goto yy15;
}
}
-#line 290
+#line 291
Document:
@@ -367,29 +376,31 @@ Document:
goto yy23;
yy24: ++YYCURSOR;
yy23:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+ if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy47;
+ case '\000': goto yy48;
case '\n': goto yy25;
- case ' ': goto yy45;
- case '!': goto yy36;
- case '"': goto yy40;
- case '#': goto yy43;
- case '&': goto yy34;
- case '\'': goto yy38;
- case '*': goto yy35;
- case ',': case ':': goto yy31;
- case '-': case '?': goto yy33;
- case '>': case '|': goto yy42;
- case '[': case '{': goto yy27;
- case ']': case '}': goto yy29;
- default: goto yy49;
- }
-yy25: yych = *++YYCURSOR;
- goto yy77;
+ case '\r': goto yy27;
+ case ' ': goto yy46;
+ case '!': goto yy37;
+ case '"': goto yy41;
+ case '#': goto yy44;
+ case '&': goto yy35;
+ case '\'': goto yy39;
+ case '*': goto yy36;
+ case ',': case ':': goto yy33;
+ case '-': case '?': goto yy34;
+ case '>': case '|': goto yy43;
+ case '[': case '{': goto yy29;
+ case ']': case '}': goto yy31;
+ default: goto yy50;
+ }
+yy25: yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy78;
yy26:
-#line 304
+#line 305
{ // Isolate spaces
int indt_len;
GOBBLE_UP_INDENT( indt_len, YYTOKEN );
@@ -405,37 +416,46 @@ yy26:
return INDENT;
}
yy27: yych = *++YYCURSOR;
+ switch(yych){
+ case '\n': goto yy77;
+ default: goto yy28;
+ }
yy28:
-#line 319
+#line 385
+ { ENSURE_IOPEN(lvl, 0, 1);
+ goto Plain;
+ }
+yy29: yych = *++YYCURSOR;
+yy30:
+#line 320
{ ENSURE_IOPEN(lvl, 0, 1);
lvl = CURRENT_LEVEL();
ADD_LEVEL(lvl->spaces + 1, syck_lvl_inline);
return YYTOKEN[0];
}
-yy29: yych = *++YYCURSOR;
-yy30:
-#line 325
+yy31: yych = *++YYCURSOR;
+yy32:
+#line 326
{ POP_LEVEL();
return YYTOKEN[0];
}
-yy31: yych = *++YYCURSOR;
+yy33: yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case '\n': goto yy74;
- case ' ': goto yy71;
- default: goto yy32;
+ case '\n': goto yy72;
+ case '\r': goto yy76;
+ case ' ': goto yy74;
+ default: goto yy28;
}
-yy32:
-#line 384
- { ENSURE_IOPEN(lvl, 0, 1);
- goto Plain;
- }
-yy33: yych = *++YYCURSOR;
+yy34: yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case '\n': goto yy69;
- case ' ': goto yy66;
- default: goto yy32;
+ case '\n': goto yy67;
+ case '\r': goto yy71;
+ case ' ': goto yy69;
+ default: goto yy28;
}
-yy34: yych = *++YYCURSOR;
+yy35: yych = *++YYCURSOR;
switch(yych){
case '-': case '0':
case '1':
@@ -496,10 +516,10 @@ yy34: yych = *++YYCURSOR;
case 'w':
case 'x':
case 'y':
- case 'z': goto yy63;
- default: goto yy32;
+ case 'z': goto yy64;
+ default: goto yy28;
}
-yy35: yych = *++YYCURSOR;
+yy36: yych = *++YYCURSOR;
switch(yych){
case '-': case '0':
case '1':
@@ -560,29 +580,30 @@ yy35: yych = *++YYCURSOR;
case 'w':
case 'x':
case 'y':
- case 'z': goto yy60;
- default: goto yy32;
+ case 'z': goto yy61;
+ default: goto yy28;
}
-yy36: yych = *++YYCURSOR;
-yy37:
-#line 357
+yy37: yych = *++YYCURSOR;
+yy38:
+#line 358
{ ENSURE_IOPEN(lvl, 0, 1);
goto TransferMethod; }
-yy38: yych = *++YYCURSOR;
-yy39:
-#line 360
+yy39: yych = *++YYCURSOR;
+yy40:
+#line 361
{ ENSURE_IOPEN(lvl, 0, 1);
goto SingleQuote; }
-yy40: yych = *++YYCURSOR;
-yy41:
-#line 363
+yy41: yych = *++YYCURSOR;
+yy42:
+#line 364
{ ENSURE_IOPEN(lvl, 0, 1);
goto DoubleQuote; }
-yy42: yyaccept = 0;
+yy43: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case '\n': goto yy58;
- case ' ': goto yy55;
+ case '\n': goto yy56;
+ case '\r': goto yy60;
+ case ' ': goto yy58;
case '+': case '-': case '0':
case '1':
case '2':
@@ -592,42 +613,43 @@ yy42: yyaccept = 0;
case '6':
case '7':
case '8':
- case '9': goto yy52;
- default: goto yy32;
+ case '9': goto yy53;
+ default: goto yy28;
}
-yy43: yych = *++YYCURSOR;
-yy44:
-#line 373
+yy44: yych = *++YYCURSOR;
+yy45:
+#line 374
{ eat_comments( parser );
goto Document;
}
-yy45: yych = *++YYCURSOR;
- goto yy51;
-yy46:
-#line 377
+yy46: yych = *++YYCURSOR;
+ goto yy52;
+yy47:
+#line 378
{ goto Document; }
-yy47: yych = *++YYCURSOR;
-yy48:
-#line 379
+yy48: yych = *++YYCURSOR;
+yy49:
+#line 380
{ ENSURE_IEND(lvl, -1);
YYPOS(0);
return 0;
}
-yy49: yych = *++YYCURSOR;
- goto yy32;
-yy50: ++YYCURSOR;
+yy50: yych = *++YYCURSOR;
+ goto yy28;
+yy51: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy51: switch(yych){
- case ' ': goto yy50;
- default: goto yy46;
+yy52: switch(yych){
+ case ' ': goto yy51;
+ default: goto yy47;
}
-yy52: ++YYCURSOR;
+yy53: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy53: switch(yych){
- case '\n': goto yy58;
- case ' ': goto yy55;
+yy54: switch(yych){
+ case '\n': goto yy56;
+ case '\r': goto yy60;
+ case ' ': goto yy58;
case '+': case '-': case '0':
case '1':
case '2':
@@ -637,23 +659,18 @@ yy53: switch(yych){
case '6':
case '7':
case '8':
- case '9': goto yy52;
- default: goto yy54;
+ case '9': goto yy53;
+ default: goto yy55;
}
-yy54: YYCURSOR = YYMARKER;
+yy55: YYCURSOR = YYMARKER;
switch(yyaccept){
- case 0: goto yy32;
- }
-yy55: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy56: switch(yych){
- case ' ': goto yy55;
- default: goto yy57;
+ case 0: goto yy26;
+ case 1: goto yy28;
}
+yy56: yych = *++YYCURSOR;
yy57:
-#line 366
- { if ( *( YYCURSOR - 1 ) == '\n' )
+#line 367
+ { if ( is_newline( YYCURSOR - 1 ) )
{
YYCURSOR--;
}
@@ -663,13 +680,18 @@ yy58: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy59: switch(yych){
- case '\n': goto yy58;
+ case ' ': goto yy58;
default: goto yy57;
}
-yy60: ++YYCURSOR;
+yy60: yych = *++YYCURSOR;
+ switch(yych){
+ case '\n': goto yy56;
+ default: goto yy55;
+ }
+yy61: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy61: switch(yych){
+yy62: switch(yych){
case '-': case '0':
case '1':
case '2':
@@ -729,19 +751,19 @@ yy61: switch(yych){
case 'w':
case 'x':
case 'y':
- case 'z': goto yy60;
- default: goto yy62;
+ case 'z': goto yy61;
+ default: goto yy63;
}
-yy62:
-#line 352
+yy63:
+#line 353
{ ENSURE_IOPEN(lvl, 0, 1);
yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
return ALIAS;
}
-yy63: ++YYCURSOR;
+yy64: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy64: switch(yych){
+yy65: switch(yych){
case '-': case '0':
case '1':
case '2':
@@ -801,27 +823,21 @@ yy64: switch(yych){
case 'w':
case 'x':
case 'y':
- case 'z': goto yy63;
- default: goto yy65;
+ case 'z': goto yy64;
+ default: goto yy66;
}
-yy65:
-#line 347
+yy66:
+#line 348
{ ENSURE_IOPEN(lvl, 0, 1);
yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
return ANCHOR;
}
-yy66: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy67: switch(yych){
- case ' ': goto yy66;
- default: goto yy68;
- }
+yy67: yych = *++YYCURSOR;
yy68:
-#line 333
+#line 334
{ ENSURE_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1);
FORCE_NEXT_TOKEN(IOPEN);
- if ( *YYCURSOR == '\n' || *( YYCURSOR - 1 ) == '\n' )
+ if ( is_newline( YYCURSOR ) || is_newline( YYCURSOR - 1 ) )
{
YYCURSOR--;
ADD_LEVEL((YYTOKEN + 1) - YYLINEPTR, syck_lvl_doc);
@@ -836,18 +852,17 @@ yy69: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy70: switch(yych){
- case '\n': goto yy69;
+ case ' ': goto yy69;
default: goto yy68;
}
-yy71: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy72: switch(yych){
- case ' ': goto yy71;
- default: goto yy73;
+yy71: yych = *++YYCURSOR;
+ switch(yych){
+ case '\n': goto yy67;
+ default: goto yy55;
}
+yy72: yych = *++YYCURSOR;
yy73:
-#line 329
+#line 330
{ YYPOS(1);
return YYTOKEN[0];
}
@@ -855,26 +870,32 @@ yy74: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy75: switch(yych){
- case '\n': goto yy74;
+ case ' ': goto yy74;
default: goto yy73;
}
-yy76: ++YYCURSOR;
+yy76: yych = *++YYCURSOR;
+ switch(yych){
+ case '\n': goto yy72;
+ default: goto yy55;
+ }
+yy77: yyaccept = 0;
+ YYMARKER = ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy77: switch(yych){
- case '\n': goto yy76;
- case ' ': goto yy78;
+yy78: switch(yych){
+ case '\n': case ' ': goto yy77;
+ case '\r': goto yy79;
default: goto yy26;
}
-yy78: ++YYCURSOR;
+yy79: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy79: switch(yych){
- case '\n': case ' ': goto yy78;
- default: goto yy26;
+ switch(yych){
+ case '\n': goto yy77;
+ default: goto yy55;
}
}
-#line 388
+#line 389
}
@@ -981,14 +1002,14 @@ yy83: yyaccept = 0;
default: goto yy84;
}
yy84:
-#line 401
+#line 402
{ YYCURSOR = YYTOKTMP;
return DOCSEP;
}
yy85: yych = *++YYCURSOR;
goto yy89;
yy86:
-#line 399
+#line 400
{ goto Directive; }
yy87: yych = *++YYCURSOR;
goto yy84;
@@ -1240,10 +1261,10 @@ yy94: switch(yych){
default: goto yy95;
}
yy95:
-#line 397
+#line 398
{ goto Directive; }
}
-#line 404
+#line 405
}
@@ -1271,21 +1292,23 @@ Plain3:
goto yy96;
yy97: ++YYCURSOR;
yy96:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+ if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy107;
+ case '\000': goto yy108;
case '\n': goto yy98;
- case ' ': goto yy105;
- case ',': goto yy104;
- case ':': goto yy100;
- case ']': case '}': goto yy102;
- default: goto yy109;
- }
-yy98: yych = *++YYCURSOR;
- goto yy122;
+ case '\r': goto yy100;
+ case ' ': goto yy106;
+ case ',': goto yy105;
+ case ':': goto yy102;
+ case ']': case '}': goto yy103;
+ default: goto yy110;
+ }
+yy98: yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy124;
yy99:
-#line 427
+#line 428
{ int indt_len, nl_count = 0;
SyckLevel *lvl;
char *tok = YYTOKTMP;
@@ -1299,7 +1322,7 @@ yy99:
while ( YYTOKTMP < YYCURSOR )
{
- if ( *YYTOKTMP++ == '\n' )
+ if ( is_newline( YYTOKTMP++ ) )
nl_count++;
}
if ( nl_count <= 1 )
@@ -1319,21 +1342,28 @@ yy99:
}
yy100: yych = *++YYCURSOR;
switch(yych){
- case '\n': goto yy119;
- case ' ': goto yy116;
+ case '\n': goto yy123;
default: goto yy101;
}
yy101:
-#line 481
+#line 482
{ QUOTECATS(qstr, qcapa, qidx, YYTOKTMP, YYCURSOR - YYTOKTMP);
goto Plain2;
}
-yy102: yych = *++YYCURSOR;
-yy103:
-#line 461
+yy102: yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
+ switch(yych){
+ case '\n': goto yy118;
+ case '\r': goto yy122;
+ case ' ': goto yy120;
+ default: goto yy101;
+ }
+yy103: yych = *++YYCURSOR;
+yy104:
+#line 462
{ if ( plvl->status != syck_lvl_inline )
{
- if ( *(YYCURSOR - 1) == ' ' || *(YYCURSOR - 1) == '\n' )
+ if ( *(YYCURSOR - 1) == ' ' || is_newline( YYCURSOR - 1 ) )
{
YYCURSOR--;
}
@@ -1342,80 +1372,87 @@ yy103:
}
RETURN_IMPLICIT();
}
-yy104: yych = *++YYCURSOR;
+yy105: yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case '\n': goto yy114;
- case ' ': goto yy112;
+ case '\n': goto yy113;
+ case '\r': goto yy116;
+ case ' ': goto yy114;
default: goto yy101;
}
-yy105: yych = *++YYCURSOR;
+yy106: yych = *++YYCURSOR;
switch(yych){
- case '#': goto yy110;
- default: goto yy106;
+ case '#': goto yy111;
+ default: goto yy107;
}
-yy106:
-#line 479
+yy107:
+#line 480
{ goto Plain3; }
-yy107: yych = *++YYCURSOR;
-yy108:
-#line 477
+yy108: yych = *++YYCURSOR;
+yy109:
+#line 478
{ RETURN_IMPLICIT(); }
-yy109: yych = *++YYCURSOR;
- goto yy101;
yy110: yych = *++YYCURSOR;
-yy111:
-#line 473
+ goto yy101;
+yy111: yych = *++YYCURSOR;
+yy112:
+#line 474
{ eat_comments( parser );
RETURN_IMPLICIT();
}
-yy112: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy113: switch(yych){
- case ' ': goto yy112;
- default: goto yy103;
- }
+yy113: yych = *++YYCURSOR;
+ goto yy104;
yy114: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy115: switch(yych){
- case '\n': goto yy114;
- default: goto yy103;
+ case ' ': goto yy114;
+ default: goto yy104;
}
-yy116: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy117: switch(yych){
- case ' ': goto yy116;
- default: goto yy118;
+yy116: yych = *++YYCURSOR;
+ switch(yych){
+ case '\n': goto yy113;
+ default: goto yy117;
}
-yy118:
-#line 459
+yy117: YYCURSOR = YYMARKER;
+ switch(yyaccept){
+ case 0: goto yy99;
+ case 1: goto yy101;
+ }
+yy118: yych = *++YYCURSOR;
+yy119:
+#line 460
{ RETURN_IMPLICIT(); }
-yy119: ++YYCURSOR;
+yy120: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy120: switch(yych){
- case '\n': goto yy119;
- default: goto yy118;
+yy121: switch(yych){
+ case ' ': goto yy120;
+ default: goto yy119;
}
-yy121: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy122: switch(yych){
- case '\n': goto yy121;
- case ' ': goto yy123;
- default: goto yy99;
+yy122: yych = *++YYCURSOR;
+ switch(yych){
+ case '\n': goto yy118;
+ default: goto yy117;
}
-yy123: ++YYCURSOR;
+yy123: yyaccept = 0;
+ YYMARKER = ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy124: switch(yych){
case '\n': case ' ': goto yy123;
+ case '\r': goto yy125;
default: goto yy99;
}
+yy125: ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch(yych){
+ case '\n': goto yy123;
+ default: goto yy117;
+ }
}
-#line 485
+#line 486
}
@@ -1431,21 +1468,23 @@ SingleQuote2:
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy125;
-yy126: ++YYCURSOR;
-yy125:
+ goto yy126;
+yy127: ++YYCURSOR;
+yy126:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy131;
- case '\n': goto yy127;
- case '\'': goto yy129;
- default: goto yy132;
- }
-yy127: yych = *++YYCURSOR;
- goto yy137;
-yy128:
-#line 499
+ case '\000': goto yy134;
+ case '\n': goto yy128;
+ case '\r': goto yy130;
+ case '\'': goto yy132;
+ default: goto yy135;
+ }
+yy128: yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy139;
+yy129:
+#line 500
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1463,7 +1502,7 @@ yy128:
while ( YYTOKTMP < YYCURSOR )
{
- if ( *YYTOKTMP++ == '\n' )
+ if ( is_newline( YYTOKTMP++ ) )
nl_count++;
}
if ( nl_count <= 1 )
@@ -1481,13 +1520,23 @@ yy128:
goto SingleQuote2;
}
-yy129: yych = *++YYCURSOR;
+yy130: yych = *++YYCURSOR;
switch(yych){
- case '\'': goto yy134;
- default: goto yy130;
+ case '\n': goto yy138;
+ default: goto yy131;
}
-yy130:
-#line 539
+yy131:
+#line 554
+ { QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
+ goto SingleQuote2;
+ }
+yy132: yych = *++YYCURSOR;
+ switch(yych){
+ case '\'': goto yy136;
+ default: goto yy133;
+ }
+yy133:
+#line 540
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1501,37 +1550,38 @@ yy130:
yylval->nodeData = n;
return PLAIN;
}
-yy131: yych = *++YYCURSOR;
- goto yy130;
-yy132: yych = *++YYCURSOR;
-yy133:
-#line 553
- { QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
- goto SingleQuote2;
- }
yy134: yych = *++YYCURSOR;
-yy135:
-#line 535
+ goto yy133;
+yy135: yych = *++YYCURSOR;
+ goto yy131;
+yy136: yych = *++YYCURSOR;
+yy137:
+#line 536
{ QUOTECAT(qstr, qcapa, qidx, '\'');
goto SingleQuote2;
}
-yy136: ++YYCURSOR;
+yy138: yyaccept = 0;
+ YYMARKER = ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy137: switch(yych){
- case '\n': goto yy136;
- case ' ': goto yy138;
- default: goto yy128;
+yy139: switch(yych){
+ case '\n': case ' ': goto yy138;
+ case '\r': goto yy140;
+ default: goto yy129;
}
-yy138: ++YYCURSOR;
+yy140: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy139: switch(yych){
- case '\n': case ' ': goto yy138;
- default: goto yy128;
+ switch(yych){
+ case '\n': goto yy138;
+ default: goto yy141;
+ }
+yy141: YYCURSOR = YYMARKER;
+ switch(yyaccept){
+ case 0: goto yy129;
}
}
-#line 557
+#line 558
}
@@ -1551,22 +1601,24 @@ DoubleQuote2:
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy140;
-yy141: ++YYCURSOR;
-yy140:
+ goto yy142;
+yy143: ++YYCURSOR;
+yy142:
if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy146;
- case '\n': goto yy142;
- case '"': goto yy148;
- case '\\': goto yy144;
- default: goto yy149;
- }
-yy142: yych = *++YYCURSOR;
- goto yy162;
-yy143:
-#line 575
+ case '\000': goto yy149;
+ case '\n': goto yy144;
+ case '\r': goto yy146;
+ case '"': goto yy151;
+ case '\\': goto yy148;
+ default: goto yy152;
+ }
+yy144: yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy166;
+yy145:
+#line 576
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1586,7 +1638,7 @@ yy143:
{
while ( YYTOKTMP < YYCURSOR )
{
- if ( *YYTOKTMP++ == '\n' )
+ if ( is_newline( YYTOKTMP++ ) )
nl_count++;
}
if ( nl_count <= 1 )
@@ -1606,25 +1658,31 @@ yy143:
keep_nl = 1;
goto DoubleQuote2;
}
-yy144: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
+yy146: yych = *++YYCURSOR;
switch(yych){
- case '\n': goto yy153;
- case ' ': goto yy150;
- case '"': case '\\': case 'a':
- case 'b': case 'e':
- case 'f': case 'n': case 'r': case 't': case 'v': goto yy156;
- case 'x': goto yy155;
- default: goto yy145;
+ case '\n': goto yy165;
+ default: goto yy147;
}
-yy145:
-#line 659
+yy147:
+#line 660
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto DoubleQuote2;
}
-yy146: yych = *++YYCURSOR;
-yy147:
-#line 645
+yy148: yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
+ switch(yych){
+ case '\n': goto yy156;
+ case '\r': goto yy158;
+ case ' ': goto yy153;
+ case '"': case '\\': case 'a':
+ case 'b': case 'e':
+ case 'f': case 'n': case 'r': case 't': case 'v': goto yy160;
+ case 'x': goto yy159;
+ default: goto yy147;
+ }
+yy149: yych = *++YYCURSOR;
+yy150:
+#line 646
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1638,30 +1696,37 @@ yy147:
yylval->nodeData = n;
return PLAIN;
}
-yy148: yych = *++YYCURSOR;
+yy151: yych = *++YYCURSOR;
+ goto yy150;
+yy152: yych = *++YYCURSOR;
goto yy147;
-yy149: yych = *++YYCURSOR;
- goto yy145;
-yy150: ++YYCURSOR;
+yy153: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy151: switch(yych){
- case '\n': goto yy153;
- case ' ': goto yy150;
- default: goto yy152;
+yy154: switch(yych){
+ case '\n': goto yy156;
+ case '\r': goto yy158;
+ case ' ': goto yy153;
+ default: goto yy155;
}
-yy152: YYCURSOR = YYMARKER;
+yy155: YYCURSOR = YYMARKER;
switch(yyaccept){
case 0: goto yy145;
+ case 1: goto yy147;
}
-yy153: yych = *++YYCURSOR;
-yy154:
-#line 640
+yy156: yych = *++YYCURSOR;
+yy157:
+#line 641
{ keep_nl = 0;
YYCURSOR--;
goto DoubleQuote2;
}
-yy155: yych = *++YYCURSOR;
+yy158: yych = *++YYCURSOR;
+ switch(yych){
+ case '\n': goto yy156;
+ default: goto yy155;
+ }
+yy159: yych = *++YYCURSOR;
switch(yych){
case '0':
case '1':
@@ -1682,12 +1747,12 @@ yy155: yych = *++YYCURSOR;
case 'c':
case 'd':
case 'e':
- case 'f': goto yy158;
- default: goto yy152;
+ case 'f': goto yy162;
+ default: goto yy155;
}
-yy156: yych = *++YYCURSOR;
-yy157:
-#line 615
+yy160: yych = *++YYCURSOR;
+yy161:
+#line 616
{ char ch = *( YYCURSOR - 1 );
switch ( ch )
{
@@ -1703,7 +1768,7 @@ yy157:
QUOTECAT(qstr, qcapa, qidx, ch);
goto DoubleQuote2;
}
-yy158: yych = *++YYCURSOR;
+yy162: yych = *++YYCURSOR;
switch(yych){
case '0':
case '1':
@@ -1724,12 +1789,12 @@ yy158: yych = *++YYCURSOR;
case 'c':
case 'd':
case 'e':
- case 'f': goto yy159;
- default: goto yy152;
+ case 'f': goto yy163;
+ default: goto yy155;
}
-yy159: yych = *++YYCURSOR;
-yy160:
-#line 631
+yy163: yych = *++YYCURSOR;
+yy164:
+#line 632
{ long ch;
char *chr_text = syck_strndup( YYTOKTMP, 4 );
chr_text[0] = '0';
@@ -1738,23 +1803,24 @@ yy160:
QUOTECAT(qstr, qcapa, qidx, ch);
goto DoubleQuote2;
}
-yy161: ++YYCURSOR;
+yy165: yyaccept = 0;
+ YYMARKER = ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy162: switch(yych){
- case '\n': goto yy161;
- case ' ': goto yy163;
- default: goto yy143;
+yy166: switch(yych){
+ case '\n': case ' ': goto yy165;
+ case '\r': goto yy167;
+ default: goto yy145;
}
-yy163: ++YYCURSOR;
+yy167: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy164: switch(yych){
- case '\n': case ' ': goto yy163;
- default: goto yy143;
+ switch(yych){
+ case '\n': goto yy165;
+ default: goto yy155;
}
}
-#line 663
+#line 664
}
@@ -1765,21 +1831,21 @@ TransferMethod:
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy165;
-yy166: ++YYCURSOR;
-yy165:
+ goto yy168;
+yy169: ++YYCURSOR;
+yy168:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy167;
- case '\n': goto yy170;
- case ' ': goto yy168;
- default: goto yy171;
- }
-yy167:yy168: yych = *++YYCURSOR;
- goto yy176;
-yy169:
-#line 672
+ case '\000': goto yy170;
+ case '\n': goto yy171;
+ case '\r': goto yy174;
+ case ' ': goto yy173;
+ default: goto yy176;
+ }
+yy170:yy171: yych = *++YYCURSOR;
+yy172:
+#line 673
{ SyckLevel *lvl;
YYCURSOR = YYTOKTMP;
if ( YYCURSOR == YYTOKEN + 1 )
@@ -1825,28 +1891,29 @@ yy169:
return TRANSFER;
}
-yy170: yych = *++YYCURSOR;
- goto yy174;
-yy171: yych = *++YYCURSOR;
-yy172:
-#line 718
- { goto TransferMethod; }
-yy173: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy174: switch(yych){
- case '\n': goto yy173;
- default: goto yy169;
+yy173: yych = *++YYCURSOR;
+ goto yy179;
+yy174: yych = *++YYCURSOR;
+ switch(yych){
+ case '\n': goto yy177;
+ default: goto yy175;
}
-yy175: ++YYCURSOR;
+yy175:
+#line 719
+ { goto TransferMethod; }
+yy176: yych = *++YYCURSOR;
+ goto yy175;
+yy177: yych = *++YYCURSOR;
+ goto yy172;
+yy178: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy176: switch(yych){
- case ' ': goto yy175;
- default: goto yy169;
+yy179: switch(yych){
+ case ' ': goto yy178;
+ default: goto yy172;
}
}
-#line 720
+#line 721
}
@@ -1896,24 +1963,26 @@ ScalarBlock2:
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy177;
-yy178: ++YYCURSOR;
-yy177:
+ goto yy180;
+yy181: ++YYCURSOR;
+yy180:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy183;
- case '\n': goto yy179;
- case '#': goto yy181;
- default: goto yy185;
+ case '\000': goto yy188;
+ case '\n': goto yy182;
+ case '\r': goto yy184;
+ case '#': goto yy186;
+ default: goto yy190;
}
-yy179: yych = *++YYCURSOR;
- goto yy188;
-yy180:
-#line 768
+yy182: yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy192;
+yy183:
+#line 769
{ char *pacer;
char *tok = YYTOKTMP;
- int indt_len = 0, nl_count = 0, fold_nl = 0;
+ int indt_len = 0, nl_count = 0, fold_nl = 0, nl_begin = 0;
GOBBLE_UP_INDENT( indt_len, tok );
lvl = CURRENT_LEVEL();
@@ -1922,12 +1991,10 @@ yy180:
int new_spaces = forceIndent > 0 ? forceIndent : indt_len;
ADD_LEVEL( new_spaces, syck_lvl_block );
lastIndent = indt_len - new_spaces;
- YYCURSOR -= lastIndent;
- goto ScalarBlock2;
+ nl_begin = 1;
+ lvl = CURRENT_LEVEL();
}
-
- lvl = CURRENT_LEVEL();
- if ( lvl->status != syck_lvl_block )
+ else if ( lvl->status != syck_lvl_block )
{
YYCURSOR = YYTOKTMP;
RETURN_BLOCK();
@@ -1945,16 +2012,16 @@ yy180:
pacer = YYTOKTMP;
while ( pacer < YYCURSOR )
{
- if ( *pacer++ == '\n' )
+ if ( is_newline( pacer++ ) )
nl_count++;
}
- if ( fold_nl == 1 )
+ if ( fold_nl == 1 || nl_begin == 1 )
{
nl_count--;
}
- if ( nl_count < 1 )
+ if ( nl_count < 1 && nl_begin == 0 )
{
QUOTECAT(qstr, qcapa, qidx, ' ');
}
@@ -1978,9 +2045,19 @@ yy180:
}
goto ScalarBlock2;
}
-yy181: yych = *++YYCURSOR;
-yy182:
-#line 837
+yy184: yych = *++YYCURSOR;
+ switch(yych){
+ case '\n': goto yy191;
+ default: goto yy185;
+ }
+yy185:
+#line 855
+ { QUOTECAT(qstr, qcapa, qidx, *YYTOKTMP);
+ goto ScalarBlock2;
+ }
+yy186: yych = *++YYCURSOR;
+yy187:
+#line 836
{ lvl = CURRENT_LEVEL();
if ( lvl->status != syck_lvl_block )
{
@@ -1993,36 +2070,37 @@ yy182:
}
goto ScalarBlock2;
}
-yy183: yych = *++YYCURSOR;
-yy184:
-#line 851
+yy188: yych = *++YYCURSOR;
+yy189:
+#line 850
{ YYCURSOR--;
POP_LEVEL();
RETURN_BLOCK();
}
-yy185: yych = *++YYCURSOR;
-yy186:
-#line 856
- { QUOTECAT(qstr, qcapa, qidx, *YYTOKTMP);
- goto ScalarBlock2;
- }
-yy187: ++YYCURSOR;
+yy190: yych = *++YYCURSOR;
+ goto yy185;
+yy191: yyaccept = 0;
+ YYMARKER = ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy188: switch(yych){
- case '\n': goto yy187;
- case ' ': goto yy189;
- default: goto yy180;
+yy192: switch(yych){
+ case '\n': case ' ': goto yy191;
+ case '\r': goto yy193;
+ default: goto yy183;
}
-yy189: ++YYCURSOR;
+yy193: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy190: switch(yych){
- case '\n': case ' ': goto yy189;
- default: goto yy180;
+ switch(yych){
+ case '\n': goto yy191;
+ default: goto yy194;
+ }
+yy194: YYCURSOR = YYMARKER;
+ switch(yyaccept){
+ case 0: goto yy183;
}
}
-#line 861
+#line 860
}
@@ -2040,45 +2118,78 @@ Comment:
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy191;
-yy192: ++YYCURSOR;
-yy191:
+ goto yy195;
+yy196: ++YYCURSOR;
+yy195:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy193;
- case '\n': goto yy195;
- default: goto yy196;
- }
-yy193: yych = *++YYCURSOR;
-yy194:
-#line 877
+ case '\000': goto yy197;
+ case '\n': goto yy199;
+ case '\r': goto yy200;
+ default: goto yy202;
+ }
+yy197: yych = *++YYCURSOR;
+yy198:
+#line 876
{ SyckLevel *lvl = CURRENT_LEVEL();
YYCURSOR = tok;
return;
}
-yy195: yych = *++YYCURSOR;
- goto yy199;
-yy196: yych = *++YYCURSOR;
-yy197:
-#line 882
+yy199: yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy204;
+yy200: yych = *++YYCURSOR;
+ switch(yych){
+ case '\n': goto yy203;
+ default: goto yy201;
+ }
+yy201:
+#line 881
{ goto Comment;
}
-yy198: ++YYCURSOR;
+yy202: yych = *++YYCURSOR;
+ goto yy201;
+yy203: yyaccept = 0;
+ YYMARKER = ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy199: switch(yych){
- case '\n': goto yy198;
- default: goto yy194;
+yy204: switch(yych){
+ case '\n': goto yy203;
+ case '\r': goto yy205;
+ default: goto yy198;
+ }
+yy205: ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch(yych){
+ case '\n': goto yy203;
+ default: goto yy206;
+ }
+yy206: YYCURSOR = YYMARKER;
+ switch(yyaccept){
+ case 0: goto yy198;
}
}
-#line 885
+#line 884
}
}
+int
+is_newline( char *ptr )
+{
+ if ( *ptr == '\n' )
+ return 1;
+
+ if ( *ptr == '\r' && *( ptr + 1 ) == '\n' )
+ return 1;
+
+ return 0;
+}
+
int
yywrap()
{