summaryrefslogtreecommitdiff
path: root/ext/syck/token.c
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-30 23:09:54 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-30 23:09:54 +0000
commit38df1a90cc68d132306c9484ed57faa0be656b0e (patch)
tree82c9f4b85a92300e2c03f3dd4003c78e1bdfbc34 /ext/syck/token.c
parent1ce0018ba1b26fcb5c8f294d2908a56ef0310464 (diff)
* ext/syck/rubyext.c (rb_syck_mktime): seconds calculated wrong.
* ext/syck/gram.c: flexibility to anchors and transfer methods on collections. * ext/syck/token.c: hex escapes. * lib/yaml/basenode.rb: YamlNode references changed to YAML::BaseNode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/syck/token.c')
-rw-r--r--ext/syck/token.c334
1 files changed, 205 insertions, 129 deletions
diff --git a/ext/syck/token.c b/ext/syck/token.c
index 39ccbd8dd1c..01e51bad0ff 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:58:58 2003 */
+/* Generated by re2c 0.5 on Fri May 30 15:54:17 2003 */
#line 1 "token.re"
/*
* token.re
@@ -226,7 +226,7 @@ yylex( YYSTYPE *yylval, SyckParser *parser )
return t;
}
-#line 242
+#line 243
if ( YYLINEPTR != YYCURSOR )
@@ -260,19 +260,19 @@ yy2: yyaccept = 0;
default: goto yy3;
}
yy3:
-#line 283
+#line 284
{ YYPOS(0);
goto Document;
}
yy4: yych = *++YYCURSOR;
yy5:
-#line 269
+#line 270
{ eat_comments( parser );
goto Header;
}
yy6: yych = *++YYCURSOR;
yy7:
-#line 273
+#line 274
{ SyckLevel *lvl = CURRENT_LEVEL();
ENSURE_IEND(lvl, -1);
return 0;
@@ -280,7 +280,7 @@ yy7:
yy8: yych = *++YYCURSOR;
goto yy12;
yy9:
-#line 278
+#line 279
{ int indt_len;
GOBBLE_UP_INDENT( indt_len, YYTOKEN );
goto Header;
@@ -325,7 +325,7 @@ yy19: switch(yych){
default: goto yy20;
}
yy20:
-#line 255
+#line 256
{ SyckLevel *lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_header )
{
@@ -347,7 +347,7 @@ yy22: switch(yych){
default: goto yy20;
}
}
-#line 287
+#line 288
Document:
@@ -388,7 +388,7 @@ yy23:
yy25: yych = *++YYCURSOR;
goto yy77;
yy26:
-#line 301
+#line 302
{ // Isolate spaces
int indt_len;
GOBBLE_UP_INDENT( indt_len, YYTOKEN );
@@ -405,7 +405,7 @@ yy26:
}
yy27: yych = *++YYCURSOR;
yy28:
-#line 316
+#line 317
{ ENSURE_IOPEN(lvl, 0, 1);
lvl = CURRENT_LEVEL();
ADD_LEVEL(lvl->spaces + 1, syck_lvl_inline);
@@ -413,7 +413,7 @@ yy28:
}
yy29: yych = *++YYCURSOR;
yy30:
-#line 322
+#line 323
{ POP_LEVEL();
return YYTOKEN[0];
}
@@ -424,7 +424,7 @@ yy31: yych = *++YYCURSOR;
default: goto yy32;
}
yy32:
-#line 380
+#line 381
{ ENSURE_IOPEN(lvl, 0, 1);
goto Plain;
}
@@ -564,17 +564,17 @@ yy35: yych = *++YYCURSOR;
}
yy36: yych = *++YYCURSOR;
yy37:
-#line 354
+#line 355
{ ENSURE_IOPEN(lvl, 0, 1);
goto TransferMethod; }
yy38: yych = *++YYCURSOR;
yy39:
-#line 357
+#line 358
{ ENSURE_IOPEN(lvl, 0, 1);
goto SingleQuote; }
yy40: yych = *++YYCURSOR;
yy41:
-#line 360
+#line 361
{ ENSURE_IOPEN(lvl, 0, 1);
goto DoubleQuote; }
yy42: yyaccept = 0;
@@ -596,18 +596,18 @@ yy42: yyaccept = 0;
}
yy43: yych = *++YYCURSOR;
yy44:
-#line 370
+#line 371
{ eat_comments( parser );
goto Document;
}
yy45: yych = *++YYCURSOR;
goto yy51;
yy46:
-#line 374
+#line 375
{ goto Document; }
yy47: yych = *++YYCURSOR;
yy48:
-#line 376
+#line 377
{ ENSURE_IEND(lvl, -1);
return 0;
}
@@ -650,7 +650,7 @@ yy56: switch(yych){
default: goto yy57;
}
yy57:
-#line 363
+#line 364
{ if ( *( YYCURSOR - 1 ) == '\n' )
{
YYCURSOR--;
@@ -731,7 +731,7 @@ yy61: switch(yych){
default: goto yy62;
}
yy62:
-#line 349
+#line 350
{ ENSURE_IOPEN(lvl, 0, 1);
yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
return ALIAS;
@@ -803,7 +803,7 @@ yy64: switch(yych){
default: goto yy65;
}
yy65:
-#line 344
+#line 345
{ ENSURE_IOPEN(lvl, 0, 1);
yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
return ANCHOR;
@@ -816,7 +816,7 @@ yy67: switch(yych){
default: goto yy68;
}
yy68:
-#line 330
+#line 331
{ ENSURE_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1);
FORCE_NEXT_TOKEN(IOPEN);
if ( *YYCURSOR == '\n' || *( YYCURSOR - 1 ) == '\n' )
@@ -845,7 +845,7 @@ yy72: switch(yych){
default: goto yy73;
}
yy73:
-#line 326
+#line 327
{ YYPOS(1);
return YYTOKEN[0];
}
@@ -872,7 +872,7 @@ yy79: switch(yych){
default: goto yy26;
}
}
-#line 384
+#line 385
}
@@ -964,14 +964,14 @@ yy83: yyaccept = 0;
default: goto yy84;
}
yy84:
-#line 397
+#line 398
{ YYCURSOR = YYTOKTMP;
return DOCSEP;
}
yy85: yych = *++YYCURSOR;
goto yy89;
yy86:
-#line 395
+#line 396
{ goto Directive; }
yy87: yych = *++YYCURSOR;
goto yy84;
@@ -1180,10 +1180,10 @@ yy94: switch(yych){
default: goto yy95;
}
yy95:
-#line 393
+#line 394
{ goto Directive; }
}
-#line 400
+#line 401
}
@@ -1225,7 +1225,7 @@ yy96:
yy98: yych = *++YYCURSOR;
goto yy122;
yy99:
-#line 423
+#line 424
{ int indt_len, nl_count = 0;
SyckLevel *lvl;
char *tok = YYTOKTMP;
@@ -1264,13 +1264,13 @@ yy100: yych = *++YYCURSOR;
default: goto yy101;
}
yy101:
-#line 474
+#line 475
{ QUOTECATS(qstr, qcapa, qidx, YYTOKTMP, YYCURSOR - YYTOKTMP);
goto Plain2;
}
yy102: yych = *++YYCURSOR;
yy103:
-#line 457
+#line 458
{ if ( plvl->status != syck_lvl_inline )
{
YYCURSOR--;
@@ -1291,17 +1291,17 @@ yy105: yych = *++YYCURSOR;
default: goto yy106;
}
yy106:
-#line 472
+#line 473
{ goto Plain3; }
yy107: yych = *++YYCURSOR;
yy108:
-#line 470
+#line 471
{ RETURN_IMPLICIT(); }
yy109: yych = *++YYCURSOR;
goto yy101;
yy110: yych = *++YYCURSOR;
yy111:
-#line 466
+#line 467
{ eat_comments( parser );
RETURN_IMPLICIT();
}
@@ -1327,7 +1327,7 @@ yy117: switch(yych){
default: goto yy118;
}
yy118:
-#line 455
+#line 456
{ RETURN_IMPLICIT(); }
yy119: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -1352,7 +1352,7 @@ yy124: switch(yych){
default: goto yy99;
}
}
-#line 478
+#line 479
}
@@ -1382,7 +1382,7 @@ yy125:
yy127: yych = *++YYCURSOR;
goto yy137;
yy128:
-#line 492
+#line 493
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1424,7 +1424,7 @@ yy129: yych = *++YYCURSOR;
default: goto yy130;
}
yy130:
-#line 532
+#line 533
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1442,13 +1442,13 @@ yy131: yych = *++YYCURSOR;
goto yy130;
yy132: yych = *++YYCURSOR;
yy133:
-#line 546
+#line 547
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto SingleQuote2;
}
yy134: yych = *++YYCURSOR;
yy135:
-#line 528
+#line 529
{ QUOTECAT(qstr, qcapa, qidx, '\'');
goto SingleQuote2;
}
@@ -1468,7 +1468,7 @@ yy139: switch(yych){
default: goto yy128;
}
}
-#line 550
+#line 551
}
@@ -1491,7 +1491,7 @@ DoubleQuote2:
goto yy140;
yy141: ++YYCURSOR;
yy140:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+ if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
yych = *YYCURSOR;
switch(yych){
case '\000': goto yy146;
@@ -1501,9 +1501,9 @@ yy140:
default: goto yy149;
}
yy142: yych = *++YYCURSOR;
- goto yy158;
+ goto yy162;
yy143:
-#line 568
+#line 569
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1550,17 +1550,18 @@ yy144: yyaccept = 0;
case ' ': goto yy150;
case '"': case '\\': case 'a':
case 'b': case 'e':
- case 'f': case 'n': case 'r': case 't': case 'v': goto yy155;
+ case 'f': case 'n': case 'r': case 't': case 'v': goto yy156;
+ case 'x': goto yy155;
default: goto yy145;
}
yy145:
-#line 643
+#line 653
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto DoubleQuote2;
}
yy146: yych = *++YYCURSOR;
yy147:
-#line 629
+#line 639
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1592,14 +1593,38 @@ yy152: YYCURSOR = YYMARKER;
}
yy153: yych = *++YYCURSOR;
yy154:
-#line 624
+#line 634
{ keep_nl = 0;
YYCURSOR--;
goto DoubleQuote2;
}
yy155: yych = *++YYCURSOR;
-yy156:
-#line 608
+ switch(yych){
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9': case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F': case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f': goto yy158;
+ default: goto yy152;
+ }
+yy156: yych = *++YYCURSOR;
+yy157:
+#line 609
{ char ch = *( YYCURSOR - 1 );
switch ( ch )
{
@@ -1615,23 +1640,58 @@ yy156:
QUOTECAT(qstr, qcapa, qidx, ch);
goto DoubleQuote2;
}
-yy157: ++YYCURSOR;
+yy158: yych = *++YYCURSOR;
+ switch(yych){
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9': case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F': case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f': goto yy159;
+ default: goto yy152;
+ }
+yy159: yych = *++YYCURSOR;
+yy160:
+#line 625
+ { long ch;
+ char *chr_text = syck_strndup( YYTOKTMP, 4 );
+ chr_text[0] = '0';
+ ch = strtol( chr_text, NULL, 16 );
+ free( chr_text );
+ QUOTECAT(qstr, qcapa, qidx, ch);
+ goto DoubleQuote2;
+ }
+yy161: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy158: switch(yych){
- case '\n': goto yy157;
- case ' ': goto yy159;
+yy162: switch(yych){
+ case '\n': goto yy161;
+ case ' ': goto yy163;
default: goto yy143;
}
-yy159: ++YYCURSOR;
+yy163: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy160: switch(yych){
- case '\n': case ' ': goto yy159;
+yy164: switch(yych){
+ case '\n': case ' ': goto yy163;
default: goto yy143;
}
}
-#line 647
+#line 657
}
@@ -1642,21 +1702,21 @@ TransferMethod:
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy161;
-yy162: ++YYCURSOR;
-yy161:
+ goto yy165;
+yy166: ++YYCURSOR;
+yy165:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy163;
- case '\n': goto yy166;
- case ' ': goto yy164;
- default: goto yy167;
+ case '\000': goto yy167;
+ case '\n': goto yy170;
+ case ' ': goto yy168;
+ default: goto yy171;
}
-yy163:yy164: yych = *++YYCURSOR;
- goto yy172;
-yy165:
-#line 656
+yy167:yy168: yych = *++YYCURSOR;
+ goto yy176;
+yy169:
+#line 666
{ SyckLevel *lvl;
YYCURSOR = YYTOKTMP;
if ( YYCURSOR == YYTOKEN + 1 )
@@ -1702,28 +1762,28 @@ yy165:
return TRANSFER;
}
-yy166: yych = *++YYCURSOR;
- goto yy170;
-yy167: yych = *++YYCURSOR;
-yy168:
-#line 702
+yy170: yych = *++YYCURSOR;
+ goto yy174;
+yy171: yych = *++YYCURSOR;
+yy172:
+#line 712
{ goto TransferMethod; }
-yy169: ++YYCURSOR;
+yy173: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy170: switch(yych){
- case '\n': goto yy169;
- default: goto yy165;
+yy174: switch(yych){
+ case '\n': goto yy173;
+ default: goto yy169;
}
-yy171: ++YYCURSOR;
+yy175: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy172: switch(yych){
- case ' ': goto yy171;
- default: goto yy165;
+yy176: switch(yych){
+ case ' ': goto yy175;
+ default: goto yy169;
}
}
-#line 704
+#line 714
}
@@ -1773,20 +1833,21 @@ ScalarBlock2:
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy173;
-yy174: ++YYCURSOR;
-yy173:
+ goto yy177;
+yy178: ++YYCURSOR;
+yy177:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy177;
- case '\n': goto yy175;
- default: goto yy179;
- }
-yy175: yych = *++YYCURSOR;
- goto yy182;
-yy176:
-#line 752
+ case '\000': goto yy183;
+ case '\n': goto yy179;
+ case '#': goto yy181;
+ default: goto yy185;
+ }
+yy179: yych = *++YYCURSOR;
+ goto yy188;
+yy180:
+#line 762
{ char *pacer;
char *tok = YYTOKTMP;
int indt_len = 0, nl_count = 0, fold_nl = 0;
@@ -1854,36 +1915,51 @@ yy176:
}
goto ScalarBlock2;
}
-yy177: yych = *++YYCURSOR;
-yy178:
-#line 821
+yy181: yych = *++YYCURSOR;
+yy182:
+#line 831
+ { lvl = CURRENT_LEVEL();
+ if ( lvl->status != syck_lvl_block )
+ {
+ eat_comments( parser );
+ YYTOKTMP = YYCURSOR;
+ }
+ else
+ {
+ QUOTECAT(qstr, qcapa, qidx, *YYTOKTMP);
+ }
+ goto ScalarBlock2;
+ }
+yy183: yych = *++YYCURSOR;
+yy184:
+#line 845
{ YYCURSOR--;
POP_LEVEL();
RETURN_BLOCK();
}
-yy179: yych = *++YYCURSOR;
-yy180:
-#line 826
+yy185: yych = *++YYCURSOR;
+yy186:
+#line 850
{ QUOTECAT(qstr, qcapa, qidx, *YYTOKTMP);
goto ScalarBlock2;
}
-yy181: ++YYCURSOR;
+yy187: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy182: switch(yych){
- case '\n': goto yy181;
- case ' ': goto yy183;
- default: goto yy176;
+yy188: switch(yych){
+ case '\n': goto yy187;
+ case ' ': goto yy189;
+ default: goto yy180;
}
-yy183: ++YYCURSOR;
+yy189: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy184: switch(yych){
- case '\n': case ' ': goto yy183;
- default: goto yy176;
+yy190: switch(yych){
+ case '\n': case ' ': goto yy189;
+ default: goto yy180;
}
}
-#line 831
+#line 855
}
@@ -1901,39 +1977,39 @@ Comment:
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy185;
-yy186: ++YYCURSOR;
-yy185:
+ goto yy191;
+yy192: ++YYCURSOR;
+yy191:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy187;
- case '\n': goto yy189;
- default: goto yy190;
+ case '\000': goto yy193;
+ case '\n': goto yy195;
+ default: goto yy196;
}
-yy187: yych = *++YYCURSOR;
-yy188:
-#line 847
+yy193: yych = *++YYCURSOR;
+yy194:
+#line 871
{ SyckLevel *lvl = CURRENT_LEVEL();
YYCURSOR = tok;
return;
}
-yy189: yych = *++YYCURSOR;
- goto yy193;
-yy190: yych = *++YYCURSOR;
-yy191:
-#line 852
+yy195: yych = *++YYCURSOR;
+ goto yy199;
+yy196: yych = *++YYCURSOR;
+yy197:
+#line 876
{ goto Comment;
}
-yy192: ++YYCURSOR;
+yy198: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy193: switch(yych){
- case '\n': goto yy192;
- default: goto yy188;
+yy199: switch(yych){
+ case '\n': goto yy198;
+ default: goto yy194;
}
}
-#line 855
+#line 879
}