summaryrefslogtreecommitdiff
path: root/ext/syck/token.c
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-28 19:27:42 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-28 19:27:42 +0000
commit0a75581a37b360542d05fc6560c8a9567b642955 (patch)
treec269f65ebba51395164a4e45bcc740665ed2152d /ext/syck/token.c
parentea837fc6feab1b2f1b5400b79b87879aa160f42b (diff)
* ext/syck/syck.h: Added 'syck' yacc prefixes.
* ext/syck/gram.c: ditto. * ext/syck/token.c: ditto. * ext/syck: Added ruby.h reference to source files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/syck/token.c')
-rw-r--r--ext/syck/token.c168
1 files changed, 85 insertions, 83 deletions
diff --git a/ext/syck/token.c b/ext/syck/token.c
index bec1e7bb5b9..8cdb787fa97 100644
--- a/ext/syck/token.c
+++ b/ext/syck/token.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.5 on Thu Jul 24 10:01:15 2003 */
+/* Generated by re2c 0.5 on Mon Jul 28 11:21:46 2003 */
#line 1 "token.re"
/*
* token.re
@@ -9,6 +9,7 @@
* Copyright (C) 2003 why the lucky stiff
*/
#include "syck.h"
+#include "ruby.h"
#include "gram.h"
/*
@@ -49,7 +50,7 @@
#define CURRENT_LEVEL() syck_parser_current_level( parser )
/*
- * Force a token next time around yylex()
+ * Force a token next time around sycklex()
*/
#define FORCE_NEXT_TOKEN(tok) parser->force_token = tok;
@@ -117,15 +118,14 @@
*/
#define RETURN_IMPLICIT() \
{ \
- SyckLevel *i_lvl = CURRENT_LEVEL(); \
SyckNode *n = syck_alloc_str(); \
YYCURSOR = YYTOKTMP; \
n->data.str->ptr = qstr; \
n->data.str->len = qidx; \
- yylval->nodeData = n; \
+ sycklval->nodeData = n; \
if ( parser->implicit_typing == 1 ) \
{ \
- try_tag_implicit( yylval->nodeData, parser->taguri_expansion ); \
+ try_tag_implicit( sycklval->nodeData, parser->taguri_expansion ); \
} \
return PLAIN; \
}
@@ -150,7 +150,7 @@
n->data.str->len = fc - n->data.str->ptr + 1; \
} \
} \
- yylval->nodeData = n; \
+ sycklval->nodeData = n; \
return BLOCK; \
}
@@ -196,7 +196,7 @@
}
/*
- * Argjh! I hate globals! Here for yyerror() only!
+ * Argjh! I hate globals! Here for syckerror() only!
*/
SyckParser *syck_parser_ptr = NULL;
@@ -204,14 +204,16 @@ SyckParser *syck_parser_ptr = NULL;
* Accessory funcs later in this file.
*/
void eat_comments( SyckParser * );
+int is_newline( char *ptr );
+int yywrap();
/*
- * My own re-entrant yylex() using re2c.
+ * My own re-entrant sycklex() using re2c.
* You really get used to the limited regexp.
* It's really nice to not rely on backtracking and such.
*/
int
-yylex( YYSTYPE *yylval, SyckParser *parser )
+sycklex( YYSTYPE *sycklval, SyckParser *parser )
{
syck_parser_ptr = parser;
if ( YYCURSOR == NULL )
@@ -226,7 +228,7 @@ yylex( YYSTYPE *yylval, SyckParser *parser )
return t;
}
-#line 245
+#line 246
if ( YYLINEPTR != YYCURSOR )
@@ -262,7 +264,7 @@ yy2: yyaccept = 0;
default: goto yy3;
}
yy3:
-#line 301
+#line 302
{ YYPOS(0);
goto Document;
}
@@ -274,13 +276,13 @@ yy4: yyaccept = 0;
}
yy5: yych = *++YYCURSOR;
yy6:
-#line 286
+#line 287
{ eat_comments( parser );
goto Header;
}
yy7: yych = *++YYCURSOR;
yy8:
-#line 290
+#line 291
{ SyckLevel *lvl = CURRENT_LEVEL();
ENSURE_IEND(lvl, -1);
YYPOS(0);
@@ -290,7 +292,7 @@ yy9: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
goto yy14;
yy10:
-#line 296
+#line 297
{ int indt_len;
GOBBLE_UP_INDENT( indt_len, YYTOKEN );
goto Header;
@@ -337,7 +339,7 @@ yy18: yych = *++YYCURSOR;
}
yy19: yych = *++YYCURSOR;
yy20:
-#line 272
+#line 273
{ SyckLevel *lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_header )
{
@@ -377,7 +379,7 @@ yy25: yych = *++YYCURSOR;
}
yy26: yych = *++YYCURSOR;
yy27:
-#line 258
+#line 259
{ SyckLevel *lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_header )
{
@@ -404,7 +406,7 @@ yy30: yych = *++YYCURSOR;
default: goto yy16;
}
}
-#line 305
+#line 306
Document:
@@ -447,7 +449,7 @@ yy33: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy86;
yy34:
-#line 319
+#line 320
{ /* Isolate spaces */
int indt_len;
GOBBLE_UP_INDENT( indt_len, YYTOKEN );
@@ -468,13 +470,13 @@ yy35: yych = *++YYCURSOR;
default: goto yy36;
}
yy36:
-#line 406
+#line 407
{ ENSURE_IOPEN(lvl, 0, 1);
goto Plain;
}
yy37: yych = *++YYCURSOR;
yy38:
-#line 334
+#line 335
{ ENSURE_IOPEN(lvl, 0, 1);
lvl = CURRENT_LEVEL();
ADD_LEVEL(lvl->spaces + 1, syck_lvl_inline);
@@ -482,7 +484,7 @@ yy38:
}
yy39: yych = *++YYCURSOR;
yy40:
-#line 340
+#line 341
{ POP_LEVEL();
return YYTOKEN[0];
}
@@ -632,17 +634,17 @@ yy44: yych = *++YYCURSOR;
}
yy45: yych = *++YYCURSOR;
yy46:
-#line 379
+#line 380
{ ENSURE_IOPEN(lvl, 0, 1);
goto TransferMethod; }
yy47: yych = *++YYCURSOR;
yy48:
-#line 382
+#line 383
{ ENSURE_IOPEN(lvl, 0, 1);
goto SingleQuote; }
yy49: yych = *++YYCURSOR;
yy50:
-#line 385
+#line 386
{ ENSURE_IOPEN(lvl, 0, 1);
goto DoubleQuote; }
yy51: yyaccept = 1;
@@ -665,18 +667,18 @@ yy51: yyaccept = 1;
}
yy52: yych = *++YYCURSOR;
yy53:
-#line 395
+#line 396
{ eat_comments( parser );
goto Document;
}
yy54: yych = *++YYCURSOR;
goto yy60;
yy55:
-#line 399
+#line 400
{ goto Document; }
yy56: yych = *++YYCURSOR;
yy57:
-#line 401
+#line 402
{ ENSURE_IEND(lvl, -1);
YYPOS(0);
return 0;
@@ -716,7 +718,7 @@ yy63: YYCURSOR = YYMARKER;
}
yy64: yych = *++YYCURSOR;
yy65:
-#line 388
+#line 389
{ if ( is_newline( YYCURSOR - 1 ) )
{
YYCURSOR--;
@@ -802,9 +804,9 @@ yy70: switch(yych){
default: goto yy71;
}
yy71:
-#line 374
+#line 375
{ ENSURE_IOPEN(lvl, 0, 1);
- yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
+ sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
return ALIAS;
}
yy72: ++YYCURSOR;
@@ -874,21 +876,21 @@ yy73: switch(yych){
default: goto yy74;
}
yy74:
-#line 362
+#line 363
{ ENSURE_IOPEN(lvl, 0, 1);
- yylval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
+ sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
/*
* Remove previous anchors of the same name. Since the parser will likely
* construct deeper nodes first, we want those nodes to be placed in the
* queue for matching at a higher level of indentation.
*/
- syck_hdlr_remove_anchor(parser, yylval->name);
+ syck_hdlr_remove_anchor(parser, sycklval->name);
return ANCHOR;
}
yy75: yych = *++YYCURSOR;
yy76:
-#line 348
+#line 349
{ ENSURE_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1);
FORCE_NEXT_TOKEN(IOPEN);
if ( is_newline( YYCURSOR ) || is_newline( YYCURSOR - 1 ) )
@@ -916,7 +918,7 @@ yy79: yych = *++YYCURSOR;
}
yy80: yych = *++YYCURSOR;
yy81:
-#line 344
+#line 345
{ YYPOS(1);
return YYTOKEN[0];
}
@@ -949,7 +951,7 @@ yy87: ++YYCURSOR;
default: goto yy63;
}
}
-#line 410
+#line 411
}
@@ -1056,14 +1058,14 @@ yy91: yyaccept = 0;
default: goto yy92;
}
yy92:
-#line 423
+#line 424
{ YYCURSOR = YYTOKTMP;
return DOCSEP;
}
yy93: yych = *++YYCURSOR;
goto yy97;
yy94:
-#line 421
+#line 422
{ goto Directive; }
yy95: yych = *++YYCURSOR;
goto yy92;
@@ -1315,10 +1317,10 @@ yy102: switch(yych){
default: goto yy103;
}
yy103:
-#line 419
+#line 420
{ goto Directive; }
}
-#line 426
+#line 427
}
@@ -1362,7 +1364,7 @@ yy106: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy132;
yy107:
-#line 449
+#line 450
{ int indt_len, nl_count = 0;
SyckLevel *lvl;
char *tok = YYTOKTMP;
@@ -1400,7 +1402,7 @@ yy108: yych = *++YYCURSOR;
default: goto yy109;
}
yy109:
-#line 503
+#line 504
{ QUOTECATS(qstr, qcapa, qidx, YYTOKTMP, YYCURSOR - YYTOKTMP);
goto Plain2;
}
@@ -1414,7 +1416,7 @@ yy110: yyaccept = 1;
}
yy111: yych = *++YYCURSOR;
yy112:
-#line 483
+#line 484
{ if ( plvl->status != syck_lvl_inline )
{
if ( *(YYCURSOR - 1) == ' ' || is_newline( YYCURSOR - 1 ) )
@@ -1440,17 +1442,17 @@ yy114: yych = *++YYCURSOR;
default: goto yy115;
}
yy115:
-#line 501
+#line 502
{ goto Plain3; }
yy116: yych = *++YYCURSOR;
yy117:
-#line 499
+#line 500
{ RETURN_IMPLICIT(); }
yy118: yych = *++YYCURSOR;
goto yy109;
yy119: yych = *++YYCURSOR;
yy120:
-#line 495
+#line 496
{ eat_comments( parser );
RETURN_IMPLICIT();
}
@@ -1475,7 +1477,7 @@ yy125: YYCURSOR = YYMARKER;
}
yy126: yych = *++YYCURSOR;
yy127:
-#line 481
+#line 482
{ RETURN_IMPLICIT(); }
yy128: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -1506,7 +1508,7 @@ yy133: ++YYCURSOR;
default: goto yy125;
}
}
-#line 507
+#line 508
}
@@ -1538,7 +1540,7 @@ yy136: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy147;
yy137:
-#line 521
+#line 522
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1580,7 +1582,7 @@ yy138: yych = *++YYCURSOR;
default: goto yy139;
}
yy139:
-#line 575
+#line 576
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto SingleQuote2;
}
@@ -1590,7 +1592,7 @@ yy140: yych = *++YYCURSOR;
default: goto yy141;
}
yy141:
-#line 561
+#line 562
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1601,7 +1603,7 @@ yy141:
}
n->data.str->ptr = qstr;
n->data.str->len = qidx;
- yylval->nodeData = n;
+ sycklval->nodeData = n;
return PLAIN;
}
yy142: yych = *++YYCURSOR;
@@ -1610,7 +1612,7 @@ yy143: yych = *++YYCURSOR;
goto yy139;
yy144: yych = *++YYCURSOR;
yy145:
-#line 557
+#line 558
{ QUOTECAT(qstr, qcapa, qidx, '\'');
goto SingleQuote2;
}
@@ -1635,7 +1637,7 @@ yy149: YYCURSOR = YYMARKER;
case 0: goto yy137;
}
}
-#line 579
+#line 580
}
@@ -1672,7 +1674,7 @@ yy152: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy174;
yy153:
-#line 597
+#line 598
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1718,7 +1720,7 @@ yy154: yych = *++YYCURSOR;
default: goto yy155;
}
yy155:
-#line 681
+#line 682
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto DoubleQuote2;
}
@@ -1736,7 +1738,7 @@ yy156: yyaccept = 1;
}
yy157: yych = *++YYCURSOR;
yy158:
-#line 667
+#line 668
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1747,7 +1749,7 @@ yy158:
}
n->data.str->ptr = qstr;
n->data.str->len = qidx;
- yylval->nodeData = n;
+ sycklval->nodeData = n;
return PLAIN;
}
yy159: yych = *++YYCURSOR;
@@ -1770,7 +1772,7 @@ yy163: YYCURSOR = YYMARKER;
}
yy164: yych = *++YYCURSOR;
yy165:
-#line 662
+#line 663
{ keep_nl = 0;
YYCURSOR--;
goto DoubleQuote2;
@@ -1806,7 +1808,7 @@ yy167: yych = *++YYCURSOR;
}
yy168: yych = *++YYCURSOR;
yy169:
-#line 637
+#line 638
{ char ch = *( YYCURSOR - 1 );
switch ( ch )
{
@@ -1848,7 +1850,7 @@ yy170: yych = *++YYCURSOR;
}
yy171: yych = *++YYCURSOR;
yy172:
-#line 653
+#line 654
{ long ch;
char *chr_text = syck_strndup( YYTOKTMP, 4 );
chr_text[0] = '0';
@@ -1874,7 +1876,7 @@ yy175: ++YYCURSOR;
default: goto yy163;
}
}
-#line 685
+#line 686
}
@@ -1909,7 +1911,7 @@ yy178: YYCURSOR = YYMARKER;
}
yy179: yych = *++YYCURSOR;
yy180:
-#line 699
+#line 700
{ SyckLevel *lvl;
YYCURSOR = YYTOKTMP;
if ( YYCURSOR == YYTOKEN + 1 )
@@ -1925,10 +1927,10 @@ yy180:
*/
if ( *qstr == '^' )
{
- yylval->name = S_ALLOC_N( char, qidx + strlen( lvl->domain ) );
- yylval->name[0] = '\0';
- strcat( yylval->name, lvl->domain );
- strncat( yylval->name, qstr + 1, qidx - 1 );
+ sycklval->name = S_ALLOC_N( char, qidx + strlen( lvl->domain ) );
+ sycklval->name[0] = '\0';
+ strcat( sycklval->name, lvl->domain );
+ strncat( sycklval->name, qstr + 1, qidx - 1 );
free( qstr );
}
else
@@ -1945,15 +1947,15 @@ yy180:
{
free( lvl->domain );
lvl->domain = syck_strndup( qstr, carat - qstr );
- yylval->name = S_ALLOC_N( char, ( qend - carat ) + strlen( lvl->domain ) );
- yylval->name[0] = '\0';
- strcat( yylval->name, lvl->domain );
- strncat( yylval->name, carat + 1, ( qend - carat ) - 1 );
+ sycklval->name = S_ALLOC_N( char, ( qend - carat ) + strlen( lvl->domain ) );
+ sycklval->name[0] = '\0';
+ strcat( sycklval->name, lvl->domain );
+ strncat( sycklval->name, carat + 1, ( qend - carat ) - 1 );
free( qstr );
}
else
{
- yylval->name = qstr;
+ sycklval->name = qstr;
}
}
@@ -1967,7 +1969,7 @@ yy182: yych = *++YYCURSOR;
default: goto yy183;
}
yy183:
-#line 761
+#line 762
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto TransferMethod2;
}
@@ -2029,7 +2031,7 @@ yy187: yych = *++YYCURSOR;
}
yy188: yych = *++YYCURSOR;
yy189:
-#line 752
+#line 753
{ long ch;
char *chr_text = syck_strndup( YYTOKTMP, 4 );
chr_text[0] = '0';
@@ -2048,13 +2050,12 @@ yy192: switch(yych){
default: goto yy180;
}
}
-#line 766
+#line 767
}
ScalarBlock:
{
- int keep_nl = 1;
int qidx = 0;
int qcapa = 100;
char *qstr = S_ALLOC_N( char, qcapa );
@@ -2239,6 +2240,8 @@ yy207: YYCURSOR = YYMARKER;
}
+ return 0;
+
}
void
@@ -2266,9 +2269,8 @@ yy208:
}
yy210: yych = *++YYCURSOR;
yy211:
-#line 921
- { SyckLevel *lvl = CURRENT_LEVEL();
- YYCURSOR = tok;
+#line 923
+ { YYCURSOR = tok;
return;
}
yy212: yyaccept = 0;
@@ -2280,7 +2282,7 @@ yy213: yych = *++YYCURSOR;
default: goto yy214;
}
yy214:
-#line 926
+#line 927
{ goto Comment;
}
yy215: yych = *++YYCURSOR;
@@ -2306,7 +2308,7 @@ yy219: YYCURSOR = YYMARKER;
case 0: goto yy211;
}
}
-#line 929
+#line 930
}
@@ -2326,13 +2328,13 @@ is_newline( char *ptr )
}
int
-yywrap()
+syckwrap()
{
return 1;
}
void
-yyerror( char *msg )
+syckerror( char *msg )
{
if ( syck_parser_ptr->error_handler == NULL )
syck_parser_ptr->error_handler = syck_default_error_handler;