mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/syck/token.c: prefixed many constants and definitions with YAML_ to
avoid name clash. * ext/syck/gram.c: ditto. * ext/syck/gram.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
49c85058af
commit
49ad283b97
4 changed files with 107 additions and 96 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by re2c 0.5 on Mon Jul 28 11:21:46 2003 */
|
||||
/* Generated by re2c 0.5 on Mon Jul 28 21:10:39 2003 */
|
||||
#line 1 "token.re"
|
||||
/*
|
||||
* token.re
|
||||
|
|
@ -55,10 +55,10 @@
|
|||
#define FORCE_NEXT_TOKEN(tok) parser->force_token = tok;
|
||||
|
||||
/*
|
||||
* Nice little macro to ensure we're IOPENed to the current level.
|
||||
* Nice little macro to ensure we're YAML_IOPENed to the current level.
|
||||
* * Only use this macro in the "Document" section *
|
||||
*/
|
||||
#define ENSURE_IOPEN(last_lvl, to_len, reset) \
|
||||
#define ENSURE_YAML_IOPEN(last_lvl, to_len, reset) \
|
||||
if ( last_lvl->spaces < to_len ) \
|
||||
{ \
|
||||
if ( last_lvl->status == syck_lvl_inline ) \
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
{ \
|
||||
ADD_LEVEL( to_len, syck_lvl_doc ); \
|
||||
if ( reset == 1 ) YYPOS(0); \
|
||||
return IOPEN; \
|
||||
return YAML_IOPEN; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
|
@ -77,12 +77,12 @@
|
|||
* Nice little macro to ensure closure of levels.
|
||||
* * Only use this macro in the "Document" section *
|
||||
*/
|
||||
#define ENSURE_IEND(last_lvl, to_len) \
|
||||
#define ENSURE_YAML_IEND(last_lvl, to_len) \
|
||||
if ( last_lvl->spaces > to_len ) \
|
||||
{ \
|
||||
syck_parser_pop_level( parser ); \
|
||||
YYPOS(0); \
|
||||
return IEND; \
|
||||
return YAML_IEND; \
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -127,14 +127,14 @@
|
|||
{ \
|
||||
try_tag_implicit( sycklval->nodeData, parser->taguri_expansion ); \
|
||||
} \
|
||||
return PLAIN; \
|
||||
return YAML_PLAIN; \
|
||||
}
|
||||
|
||||
/*
|
||||
* Keep or chomp block?
|
||||
* * Use only in "ScalarBlock" section *
|
||||
*/
|
||||
#define RETURN_BLOCK() \
|
||||
#define RETURN_YAML_BLOCK() \
|
||||
{ \
|
||||
SyckNode *n = syck_alloc_str(); \
|
||||
n->data.str->ptr = qstr; \
|
||||
|
|
@ -151,13 +151,13 @@
|
|||
} \
|
||||
} \
|
||||
sycklval->nodeData = n; \
|
||||
return BLOCK; \
|
||||
return YAML_BLOCK; \
|
||||
}
|
||||
|
||||
/*
|
||||
* Handles newlines, calculates indent
|
||||
*/
|
||||
#define GOBBLE_UP_INDENT( ict, start ) \
|
||||
#define GOBBLE_UP_YAML_INDENT( ict, start ) \
|
||||
char *indent = start; \
|
||||
NEWLINE(indent); \
|
||||
while ( indent < YYCURSOR ) \
|
||||
|
|
@ -181,7 +181,7 @@
|
|||
/*
|
||||
* If an indent exists at the current level, back up.
|
||||
*/
|
||||
#define GET_TRUE_INDENT(indt_len) \
|
||||
#define GET_TRUE_YAML_INDENT(indt_len) \
|
||||
{ \
|
||||
SyckLevel *lvl_deep = CURRENT_LEVEL(); \
|
||||
indt_len = lvl_deep->spaces; \
|
||||
|
|
@ -284,7 +284,7 @@ yy7: yych = *++YYCURSOR;
|
|||
yy8:
|
||||
#line 291
|
||||
{ SyckLevel *lvl = CURRENT_LEVEL();
|
||||
ENSURE_IEND(lvl, -1);
|
||||
ENSURE_YAML_IEND(lvl, -1);
|
||||
YYPOS(0);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -294,7 +294,7 @@ yy9: yyaccept = 1;
|
|||
yy10:
|
||||
#line 297
|
||||
{ int indt_len;
|
||||
GOBBLE_UP_INDENT( indt_len, YYTOKEN );
|
||||
GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
|
||||
goto Header;
|
||||
}
|
||||
yy11: yych = *++YYCURSOR;
|
||||
|
|
@ -347,7 +347,7 @@ yy20:
|
|||
}
|
||||
else
|
||||
{
|
||||
ENSURE_IEND(lvl, -1);
|
||||
ENSURE_YAML_IEND(lvl, -1);
|
||||
YYPOS(0);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -388,7 +388,7 @@ yy27:
|
|||
}
|
||||
else
|
||||
{
|
||||
ENSURE_IEND(lvl, -1);
|
||||
ENSURE_YAML_IEND(lvl, -1);
|
||||
YYPOS(0);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -452,17 +452,17 @@ yy34:
|
|||
#line 320
|
||||
{ /* Isolate spaces */
|
||||
int indt_len;
|
||||
GOBBLE_UP_INDENT( indt_len, YYTOKEN );
|
||||
GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
|
||||
lvl = CURRENT_LEVEL();
|
||||
|
||||
/* Check for open indent */
|
||||
ENSURE_IEND(lvl, indt_len);
|
||||
ENSURE_IOPEN(lvl, indt_len, 0);
|
||||
ENSURE_YAML_IEND(lvl, indt_len);
|
||||
ENSURE_YAML_IOPEN(lvl, indt_len, 0);
|
||||
if ( indt_len == -1 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return INDENT;
|
||||
return YAML_INDENT;
|
||||
}
|
||||
yy35: yych = *++YYCURSOR;
|
||||
switch(yych){
|
||||
|
|
@ -471,13 +471,13 @@ yy35: yych = *++YYCURSOR;
|
|||
}
|
||||
yy36:
|
||||
#line 407
|
||||
{ ENSURE_IOPEN(lvl, 0, 1);
|
||||
{ ENSURE_YAML_IOPEN(lvl, 0, 1);
|
||||
goto Plain;
|
||||
}
|
||||
yy37: yych = *++YYCURSOR;
|
||||
yy38:
|
||||
#line 335
|
||||
{ ENSURE_IOPEN(lvl, 0, 1);
|
||||
{ ENSURE_YAML_IOPEN(lvl, 0, 1);
|
||||
lvl = CURRENT_LEVEL();
|
||||
ADD_LEVEL(lvl->spaces + 1, syck_lvl_inline);
|
||||
return YYTOKEN[0];
|
||||
|
|
@ -635,17 +635,17 @@ yy44: yych = *++YYCURSOR;
|
|||
yy45: yych = *++YYCURSOR;
|
||||
yy46:
|
||||
#line 380
|
||||
{ ENSURE_IOPEN(lvl, 0, 1);
|
||||
{ ENSURE_YAML_IOPEN(lvl, 0, 1);
|
||||
goto TransferMethod; }
|
||||
yy47: yych = *++YYCURSOR;
|
||||
yy48:
|
||||
#line 383
|
||||
{ ENSURE_IOPEN(lvl, 0, 1);
|
||||
{ ENSURE_YAML_IOPEN(lvl, 0, 1);
|
||||
goto SingleQuote; }
|
||||
yy49: yych = *++YYCURSOR;
|
||||
yy50:
|
||||
#line 386
|
||||
{ ENSURE_IOPEN(lvl, 0, 1);
|
||||
{ ENSURE_YAML_IOPEN(lvl, 0, 1);
|
||||
goto DoubleQuote; }
|
||||
yy51: yyaccept = 1;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
|
|
@ -679,7 +679,7 @@ yy55:
|
|||
yy56: yych = *++YYCURSOR;
|
||||
yy57:
|
||||
#line 402
|
||||
{ ENSURE_IEND(lvl, -1);
|
||||
{ ENSURE_YAML_IEND(lvl, -1);
|
||||
YYPOS(0);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -805,9 +805,9 @@ yy70: switch(yych){
|
|||
}
|
||||
yy71:
|
||||
#line 375
|
||||
{ ENSURE_IOPEN(lvl, 0, 1);
|
||||
{ ENSURE_YAML_IOPEN(lvl, 0, 1);
|
||||
sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
|
||||
return ALIAS;
|
||||
return YAML_ALIAS;
|
||||
}
|
||||
yy72: ++YYCURSOR;
|
||||
if(YYLIMIT == YYCURSOR) YYFILL(1);
|
||||
|
|
@ -877,7 +877,7 @@ yy73: switch(yych){
|
|||
}
|
||||
yy74:
|
||||
#line 363
|
||||
{ ENSURE_IOPEN(lvl, 0, 1);
|
||||
{ ENSURE_YAML_IOPEN(lvl, 0, 1);
|
||||
sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
|
||||
|
||||
/*
|
||||
|
|
@ -886,13 +886,13 @@ yy74:
|
|||
* queue for matching at a higher level of indentation.
|
||||
*/
|
||||
syck_hdlr_remove_anchor(parser, sycklval->name);
|
||||
return ANCHOR;
|
||||
return YAML_ANCHOR;
|
||||
}
|
||||
yy75: yych = *++YYCURSOR;
|
||||
yy76:
|
||||
#line 349
|
||||
{ ENSURE_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1);
|
||||
FORCE_NEXT_TOKEN(IOPEN);
|
||||
{ ENSURE_YAML_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1);
|
||||
FORCE_NEXT_TOKEN(YAML_IOPEN);
|
||||
if ( is_newline( YYCURSOR ) || is_newline( YYCURSOR - 1 ) )
|
||||
{
|
||||
YYCURSOR--;
|
||||
|
|
@ -1060,7 +1060,7 @@ yy91: yyaccept = 0;
|
|||
yy92:
|
||||
#line 424
|
||||
{ YYCURSOR = YYTOKTMP;
|
||||
return DOCSEP;
|
||||
return YAML_DOCSEP;
|
||||
}
|
||||
yy93: yych = *++YYCURSOR;
|
||||
goto yy97;
|
||||
|
|
@ -1335,7 +1335,7 @@ Plain:
|
|||
|
||||
YYCURSOR = YYTOKEN;
|
||||
plvl = CURRENT_LEVEL();
|
||||
GET_TRUE_INDENT(parentIndent);
|
||||
GET_TRUE_YAML_INDENT(parentIndent);
|
||||
|
||||
Plain2:
|
||||
YYTOKTMP = YYCURSOR;
|
||||
|
|
@ -1368,7 +1368,7 @@ yy107:
|
|||
{ int indt_len, nl_count = 0;
|
||||
SyckLevel *lvl;
|
||||
char *tok = YYTOKTMP;
|
||||
GOBBLE_UP_INDENT( indt_len, tok );
|
||||
GOBBLE_UP_YAML_INDENT( indt_len, tok );
|
||||
lvl = CURRENT_LEVEL();
|
||||
|
||||
if ( indt_len <= parentIndent )
|
||||
|
|
@ -1544,7 +1544,7 @@ yy137:
|
|||
{ int indt_len;
|
||||
int nl_count = 0;
|
||||
SyckLevel *lvl;
|
||||
GOBBLE_UP_INDENT( indt_len, YYTOKTMP );
|
||||
GOBBLE_UP_YAML_INDENT( indt_len, YYTOKTMP );
|
||||
lvl = CURRENT_LEVEL();
|
||||
|
||||
if ( lvl->status != syck_lvl_str )
|
||||
|
|
@ -1604,7 +1604,7 @@ yy141:
|
|||
n->data.str->ptr = qstr;
|
||||
n->data.str->len = qidx;
|
||||
sycklval->nodeData = n;
|
||||
return PLAIN;
|
||||
return YAML_PLAIN;
|
||||
}
|
||||
yy142: yych = *++YYCURSOR;
|
||||
goto yy141;
|
||||
|
|
@ -1678,7 +1678,7 @@ yy153:
|
|||
{ int indt_len;
|
||||
int nl_count = 0;
|
||||
SyckLevel *lvl;
|
||||
GOBBLE_UP_INDENT( indt_len, YYTOKTMP );
|
||||
GOBBLE_UP_YAML_INDENT( indt_len, YYTOKTMP );
|
||||
lvl = CURRENT_LEVEL();
|
||||
|
||||
if ( lvl->status != syck_lvl_str )
|
||||
|
|
@ -1750,7 +1750,7 @@ yy158:
|
|||
n->data.str->ptr = qstr;
|
||||
n->data.str->len = qidx;
|
||||
sycklval->nodeData = n;
|
||||
return PLAIN;
|
||||
return YAML_PLAIN;
|
||||
}
|
||||
yy159: yych = *++YYCURSOR;
|
||||
goto yy158;
|
||||
|
|
@ -1917,7 +1917,7 @@ yy180:
|
|||
if ( YYCURSOR == YYTOKEN + 1 )
|
||||
{
|
||||
free( qstr );
|
||||
return ITRANSFER;
|
||||
return YAML_ITRANSFER;
|
||||
}
|
||||
|
||||
lvl = CURRENT_LEVEL();
|
||||
|
|
@ -1959,7 +1959,7 @@ yy180:
|
|||
}
|
||||
}
|
||||
|
||||
return TRANSFER;
|
||||
return YAML_TRANSFER;
|
||||
}
|
||||
yy181: yych = *++YYCURSOR;
|
||||
goto yy192;
|
||||
|
|
@ -2066,7 +2066,7 @@ ScalarBlock:
|
|||
char *yyt = YYTOKEN;
|
||||
SyckLevel *lvl = CURRENT_LEVEL();
|
||||
int parentIndent;
|
||||
GET_TRUE_INDENT(parentIndent);
|
||||
GET_TRUE_YAML_INDENT(parentIndent);
|
||||
|
||||
switch ( *yyt )
|
||||
{
|
||||
|
|
@ -2119,7 +2119,7 @@ yy196:
|
|||
{ char *pacer;
|
||||
char *tok = YYTOKTMP;
|
||||
int indt_len = 0, nl_count = 0, fold_nl = 0, nl_begin = 0;
|
||||
GOBBLE_UP_INDENT( indt_len, tok );
|
||||
GOBBLE_UP_YAML_INDENT( indt_len, tok );
|
||||
lvl = CURRENT_LEVEL();
|
||||
|
||||
if ( indt_len > parentIndent && lvl->status != syck_lvl_block )
|
||||
|
|
@ -2133,7 +2133,7 @@ yy196:
|
|||
else if ( lvl->status != syck_lvl_block )
|
||||
{
|
||||
YYCURSOR = YYTOKTMP;
|
||||
RETURN_BLOCK();
|
||||
RETURN_YAML_BLOCK();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -2177,7 +2177,7 @@ yy196:
|
|||
{
|
||||
POP_LEVEL();
|
||||
YYCURSOR = YYTOKTMP;
|
||||
RETURN_BLOCK();
|
||||
RETURN_YAML_BLOCK();
|
||||
}
|
||||
goto ScalarBlock2;
|
||||
}
|
||||
|
|
@ -2211,7 +2211,7 @@ yy202:
|
|||
#line 895
|
||||
{ YYCURSOR--;
|
||||
POP_LEVEL();
|
||||
RETURN_BLOCK();
|
||||
RETURN_YAML_BLOCK();
|
||||
}
|
||||
yy203: yych = *++YYCURSOR;
|
||||
goto yy198;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue