1
0
Fork 0
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:
why 2003-07-29 03:27:01 +00:00
parent 49c85058af
commit 49ad283b97
4 changed files with 107 additions and 96 deletions

View file

@ -1,10 +1,19 @@
Tue Jul 29 12:22:28 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
* 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.
Tue Jul 29 12:15:37 2003 NAKAMURA Usaku <usa@ruby-lang.org> Tue Jul 29 12:15:37 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/etc/etc.c: add real prototype to getenv(). * ext/etc/etc.c: add real prototype to getenv().
* win32/win32.h: add arguments to definitions of functions if possible. * win32/win32.h: add arguments to definitions of functions if possible.
Mon Jul 28 19:22:08 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net> Tue Jul 29 04:22:08 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
* ext/syck/syck.h: Added 'syck' yacc prefixes. * ext/syck/syck.h: Added 'syck' yacc prefixes.

View file

@ -59,30 +59,30 @@
/* Put the tokens into the symbol table, so that GDB and other debuggers /* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */ know about them. */
enum yytokentype { enum yytokentype {
ANCHOR = 258, YAML_ANCHOR = 258,
ALIAS = 259, YAML_ALIAS = 259,
TRANSFER = 260, YAML_TRANSFER = 260,
ITRANSFER = 261, YAML_ITRANSFER = 261,
WORD = 262, YAML_WORD = 262,
PLAIN = 263, YAML_PLAIN = 263,
BLOCK = 264, YAML_BLOCK = 264,
DOCSEP = 265, YAML_DOCSEP = 265,
IOPEN = 266, YAML_IOPEN = 266,
INDENT = 267, YAML_INDENT = 267,
IEND = 268 YAML_IEND = 268
}; };
#endif #endif
#define ANCHOR 258 #define YAML_ANCHOR 258
#define ALIAS 259 #define YAML_ALIAS 259
#define TRANSFER 260 #define YAML_TRANSFER 260
#define ITRANSFER 261 #define YAML_ITRANSFER 261
#define WORD 262 #define YAML_WORD 262
#define PLAIN 263 #define YAML_PLAIN 263
#define BLOCK 264 #define YAML_BLOCK 264
#define DOCSEP 265 #define YAML_DOCSEP 265
#define IOPEN 266 #define YAML_IOPEN 266
#define INDENT 267 #define YAML_INDENT 267
#define IEND 268 #define YAML_IEND 268
@ -97,6 +97,7 @@
#define YYLEX_PARAM parser #define YYLEX_PARAM parser
/* Enabling traces. */ /* Enabling traces. */
#ifndef YYDEBUG #ifndef YYDEBUG
# define YYDEBUG 1 # define YYDEBUG 1
@ -344,11 +345,12 @@ static const unsigned short yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] = static const char *const yytname[] =
{ {
"$end", "error", "$undefined", "ANCHOR", "ALIAS", "TRANSFER", "ITRANSFER", "$end", "error", "$undefined", "YAML_ANCHOR", "YAML_ALIAS",
"WORD", "PLAIN", "BLOCK", "DOCSEP", "IOPEN", "INDENT", "IEND", "'-'", "YAML_TRANSFER", "YAML_ITRANSFER", "YAML_WORD", "YAML_PLAIN",
"':'", "'+'", "'['", "']'", "'{'", "'}'", "','", "'?'", "$accept", "YAML_BLOCK", "YAML_DOCSEP", "YAML_IOPEN", "YAML_INDENT", "YAML_IEND",
"doc", "atom", "ind_rep", "atom_or_empty", "indent_open", "indent_end", "'-'", "':'", "'+'", "'['", "']'", "'{'", "'}'", "','", "'?'",
"indent_sep", "indent_flex_end", "word_rep", "struct_rep", "$accept", "doc", "atom", "ind_rep", "atom_or_empty", "indent_open",
"indent_end", "indent_sep", "indent_flex_end", "word_rep", "struct_rep",
"implicit_seq", "basic_seq", "top_imp_seq", "in_implicit_seq", "implicit_seq", "basic_seq", "top_imp_seq", "in_implicit_seq",
"inline_seq", "in_inline_seq", "implicit_map", "top_imp_map", "inline_seq", "in_inline_seq", "implicit_map", "top_imp_map",
"basic_mapping", "complex_mapping", "in_implicit_map", "basic_mapping2", "basic_mapping", "complex_mapping", "in_implicit_map", "basic_mapping2",
@ -1459,7 +1461,7 @@ yyreduce:
} }
/* Line 1016 of /usr/local/share/bison/yacc.c. */ /* Line 1016 of /usr/local/share/bison/yacc.c. */
#line 1463 "y.tab.c" #line 1464 "y.tab.c"
yyvsp -= yylen; yyvsp -= yylen;
yyssp -= yylen; yyssp -= yylen;

View file

@ -32,30 +32,30 @@
/* Put the tokens into the symbol table, so that GDB and other debuggers /* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */ know about them. */
enum yytokentype { enum yytokentype {
ANCHOR = 258, YAML_ANCHOR = 258,
ALIAS = 259, YAML_ALIAS = 259,
TRANSFER = 260, YAML_TRANSFER = 260,
ITRANSFER = 261, YAML_ITRANSFER = 261,
WORD = 262, YAML_WORD = 262,
PLAIN = 263, YAML_PLAIN = 263,
BLOCK = 264, YAML_BLOCK = 264,
DOCSEP = 265, YAML_DOCSEP = 265,
IOPEN = 266, YAML_IOPEN = 266,
INDENT = 267, YAML_INDENT = 267,
IEND = 268 YAML_IEND = 268
}; };
#endif #endif
#define ANCHOR 258 #define YAML_ANCHOR 258
#define ALIAS 259 #define YAML_ALIAS 259
#define TRANSFER 260 #define YAML_TRANSFER 260
#define ITRANSFER 261 #define YAML_ITRANSFER 261
#define WORD 262 #define YAML_WORD 262
#define PLAIN 263 #define YAML_PLAIN 263
#define BLOCK 264 #define YAML_BLOCK 264
#define DOCSEP 265 #define YAML_DOCSEP 265
#define IOPEN 266 #define YAML_IOPEN 266
#define INDENT 267 #define YAML_INDENT 267
#define IEND 268 #define YAML_IEND 268

View file

@ -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" #line 1 "token.re"
/* /*
* token.re * token.re
@ -55,10 +55,10 @@
#define FORCE_NEXT_TOKEN(tok) parser->force_token = tok; #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 * * * 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->spaces < to_len ) \
{ \ { \
if ( last_lvl->status == syck_lvl_inline ) \ if ( last_lvl->status == syck_lvl_inline ) \
@ -69,7 +69,7 @@
{ \ { \
ADD_LEVEL( to_len, syck_lvl_doc ); \ ADD_LEVEL( to_len, syck_lvl_doc ); \
if ( reset == 1 ) YYPOS(0); \ if ( reset == 1 ) YYPOS(0); \
return IOPEN; \ return YAML_IOPEN; \
} \ } \
} }
@ -77,12 +77,12 @@
* Nice little macro to ensure closure of levels. * Nice little macro to ensure closure of levels.
* * Only use this macro in the "Document" section * * * 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 ) \ if ( last_lvl->spaces > to_len ) \
{ \ { \
syck_parser_pop_level( parser ); \ syck_parser_pop_level( parser ); \
YYPOS(0); \ YYPOS(0); \
return IEND; \ return YAML_IEND; \
} }
/* /*
@ -127,14 +127,14 @@
{ \ { \
try_tag_implicit( sycklval->nodeData, parser->taguri_expansion ); \ try_tag_implicit( sycklval->nodeData, parser->taguri_expansion ); \
} \ } \
return PLAIN; \ return YAML_PLAIN; \
} }
/* /*
* Keep or chomp block? * Keep or chomp block?
* * Use only in "ScalarBlock" section * * * Use only in "ScalarBlock" section *
*/ */
#define RETURN_BLOCK() \ #define RETURN_YAML_BLOCK() \
{ \ { \
SyckNode *n = syck_alloc_str(); \ SyckNode *n = syck_alloc_str(); \
n->data.str->ptr = qstr; \ n->data.str->ptr = qstr; \
@ -151,13 +151,13 @@
} \ } \
} \ } \
sycklval->nodeData = n; \ sycklval->nodeData = n; \
return BLOCK; \ return YAML_BLOCK; \
} }
/* /*
* Handles newlines, calculates indent * Handles newlines, calculates indent
*/ */
#define GOBBLE_UP_INDENT( ict, start ) \ #define GOBBLE_UP_YAML_INDENT( ict, start ) \
char *indent = start; \ char *indent = start; \
NEWLINE(indent); \ NEWLINE(indent); \
while ( indent < YYCURSOR ) \ while ( indent < YYCURSOR ) \
@ -181,7 +181,7 @@
/* /*
* If an indent exists at the current level, back up. * 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(); \ SyckLevel *lvl_deep = CURRENT_LEVEL(); \
indt_len = lvl_deep->spaces; \ indt_len = lvl_deep->spaces; \
@ -284,7 +284,7 @@ yy7: yych = *++YYCURSOR;
yy8: yy8:
#line 291 #line 291
{ SyckLevel *lvl = CURRENT_LEVEL(); { SyckLevel *lvl = CURRENT_LEVEL();
ENSURE_IEND(lvl, -1); ENSURE_YAML_IEND(lvl, -1);
YYPOS(0); YYPOS(0);
return 0; return 0;
} }
@ -294,7 +294,7 @@ yy9: yyaccept = 1;
yy10: yy10:
#line 297 #line 297
{ int indt_len; { int indt_len;
GOBBLE_UP_INDENT( indt_len, YYTOKEN ); GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
goto Header; goto Header;
} }
yy11: yych = *++YYCURSOR; yy11: yych = *++YYCURSOR;
@ -347,7 +347,7 @@ yy20:
} }
else else
{ {
ENSURE_IEND(lvl, -1); ENSURE_YAML_IEND(lvl, -1);
YYPOS(0); YYPOS(0);
return 0; return 0;
} }
@ -388,7 +388,7 @@ yy27:
} }
else else
{ {
ENSURE_IEND(lvl, -1); ENSURE_YAML_IEND(lvl, -1);
YYPOS(0); YYPOS(0);
return 0; return 0;
} }
@ -452,17 +452,17 @@ yy34:
#line 320 #line 320
{ /* Isolate spaces */ { /* Isolate spaces */
int indt_len; int indt_len;
GOBBLE_UP_INDENT( indt_len, YYTOKEN ); GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
lvl = CURRENT_LEVEL(); lvl = CURRENT_LEVEL();
/* Check for open indent */ /* Check for open indent */
ENSURE_IEND(lvl, indt_len); ENSURE_YAML_IEND(lvl, indt_len);
ENSURE_IOPEN(lvl, indt_len, 0); ENSURE_YAML_IOPEN(lvl, indt_len, 0);
if ( indt_len == -1 ) if ( indt_len == -1 )
{ {
return 0; return 0;
} }
return INDENT; return YAML_INDENT;
} }
yy35: yych = *++YYCURSOR; yy35: yych = *++YYCURSOR;
switch(yych){ switch(yych){
@ -471,13 +471,13 @@ yy35: yych = *++YYCURSOR;
} }
yy36: yy36:
#line 407 #line 407
{ ENSURE_IOPEN(lvl, 0, 1); { ENSURE_YAML_IOPEN(lvl, 0, 1);
goto Plain; goto Plain;
} }
yy37: yych = *++YYCURSOR; yy37: yych = *++YYCURSOR;
yy38: yy38:
#line 335 #line 335
{ ENSURE_IOPEN(lvl, 0, 1); { ENSURE_YAML_IOPEN(lvl, 0, 1);
lvl = CURRENT_LEVEL(); lvl = CURRENT_LEVEL();
ADD_LEVEL(lvl->spaces + 1, syck_lvl_inline); ADD_LEVEL(lvl->spaces + 1, syck_lvl_inline);
return YYTOKEN[0]; return YYTOKEN[0];
@ -635,17 +635,17 @@ yy44: yych = *++YYCURSOR;
yy45: yych = *++YYCURSOR; yy45: yych = *++YYCURSOR;
yy46: yy46:
#line 380 #line 380
{ ENSURE_IOPEN(lvl, 0, 1); { ENSURE_YAML_IOPEN(lvl, 0, 1);
goto TransferMethod; } goto TransferMethod; }
yy47: yych = *++YYCURSOR; yy47: yych = *++YYCURSOR;
yy48: yy48:
#line 383 #line 383
{ ENSURE_IOPEN(lvl, 0, 1); { ENSURE_YAML_IOPEN(lvl, 0, 1);
goto SingleQuote; } goto SingleQuote; }
yy49: yych = *++YYCURSOR; yy49: yych = *++YYCURSOR;
yy50: yy50:
#line 386 #line 386
{ ENSURE_IOPEN(lvl, 0, 1); { ENSURE_YAML_IOPEN(lvl, 0, 1);
goto DoubleQuote; } goto DoubleQuote; }
yy51: yyaccept = 1; yy51: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR); yych = *(YYMARKER = ++YYCURSOR);
@ -679,7 +679,7 @@ yy55:
yy56: yych = *++YYCURSOR; yy56: yych = *++YYCURSOR;
yy57: yy57:
#line 402 #line 402
{ ENSURE_IEND(lvl, -1); { ENSURE_YAML_IEND(lvl, -1);
YYPOS(0); YYPOS(0);
return 0; return 0;
} }
@ -805,9 +805,9 @@ yy70: switch(yych){
} }
yy71: yy71:
#line 375 #line 375
{ ENSURE_IOPEN(lvl, 0, 1); { ENSURE_YAML_IOPEN(lvl, 0, 1);
sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 ); sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
return ALIAS; return YAML_ALIAS;
} }
yy72: ++YYCURSOR; yy72: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1); if(YYLIMIT == YYCURSOR) YYFILL(1);
@ -877,7 +877,7 @@ yy73: switch(yych){
} }
yy74: yy74:
#line 363 #line 363
{ ENSURE_IOPEN(lvl, 0, 1); { ENSURE_YAML_IOPEN(lvl, 0, 1);
sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 ); sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
/* /*
@ -886,13 +886,13 @@ yy74:
* queue for matching at a higher level of indentation. * queue for matching at a higher level of indentation.
*/ */
syck_hdlr_remove_anchor(parser, sycklval->name); syck_hdlr_remove_anchor(parser, sycklval->name);
return ANCHOR; return YAML_ANCHOR;
} }
yy75: yych = *++YYCURSOR; yy75: yych = *++YYCURSOR;
yy76: yy76:
#line 349 #line 349
{ ENSURE_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1); { ENSURE_YAML_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1);
FORCE_NEXT_TOKEN(IOPEN); FORCE_NEXT_TOKEN(YAML_IOPEN);
if ( is_newline( YYCURSOR ) || is_newline( YYCURSOR - 1 ) ) if ( is_newline( YYCURSOR ) || is_newline( YYCURSOR - 1 ) )
{ {
YYCURSOR--; YYCURSOR--;
@ -1060,7 +1060,7 @@ yy91: yyaccept = 0;
yy92: yy92:
#line 424 #line 424
{ YYCURSOR = YYTOKTMP; { YYCURSOR = YYTOKTMP;
return DOCSEP; return YAML_DOCSEP;
} }
yy93: yych = *++YYCURSOR; yy93: yych = *++YYCURSOR;
goto yy97; goto yy97;
@ -1335,7 +1335,7 @@ Plain:
YYCURSOR = YYTOKEN; YYCURSOR = YYTOKEN;
plvl = CURRENT_LEVEL(); plvl = CURRENT_LEVEL();
GET_TRUE_INDENT(parentIndent); GET_TRUE_YAML_INDENT(parentIndent);
Plain2: Plain2:
YYTOKTMP = YYCURSOR; YYTOKTMP = YYCURSOR;
@ -1368,7 +1368,7 @@ yy107:
{ int indt_len, nl_count = 0; { int indt_len, nl_count = 0;
SyckLevel *lvl; SyckLevel *lvl;
char *tok = YYTOKTMP; char *tok = YYTOKTMP;
GOBBLE_UP_INDENT( indt_len, tok ); GOBBLE_UP_YAML_INDENT( indt_len, tok );
lvl = CURRENT_LEVEL(); lvl = CURRENT_LEVEL();
if ( indt_len <= parentIndent ) if ( indt_len <= parentIndent )
@ -1544,7 +1544,7 @@ yy137:
{ int indt_len; { int indt_len;
int nl_count = 0; int nl_count = 0;
SyckLevel *lvl; SyckLevel *lvl;
GOBBLE_UP_INDENT( indt_len, YYTOKTMP ); GOBBLE_UP_YAML_INDENT( indt_len, YYTOKTMP );
lvl = CURRENT_LEVEL(); lvl = CURRENT_LEVEL();
if ( lvl->status != syck_lvl_str ) if ( lvl->status != syck_lvl_str )
@ -1604,7 +1604,7 @@ yy141:
n->data.str->ptr = qstr; n->data.str->ptr = qstr;
n->data.str->len = qidx; n->data.str->len = qidx;
sycklval->nodeData = n; sycklval->nodeData = n;
return PLAIN; return YAML_PLAIN;
} }
yy142: yych = *++YYCURSOR; yy142: yych = *++YYCURSOR;
goto yy141; goto yy141;
@ -1678,7 +1678,7 @@ yy153:
{ int indt_len; { int indt_len;
int nl_count = 0; int nl_count = 0;
SyckLevel *lvl; SyckLevel *lvl;
GOBBLE_UP_INDENT( indt_len, YYTOKTMP ); GOBBLE_UP_YAML_INDENT( indt_len, YYTOKTMP );
lvl = CURRENT_LEVEL(); lvl = CURRENT_LEVEL();
if ( lvl->status != syck_lvl_str ) if ( lvl->status != syck_lvl_str )
@ -1750,7 +1750,7 @@ yy158:
n->data.str->ptr = qstr; n->data.str->ptr = qstr;
n->data.str->len = qidx; n->data.str->len = qidx;
sycklval->nodeData = n; sycklval->nodeData = n;
return PLAIN; return YAML_PLAIN;
} }
yy159: yych = *++YYCURSOR; yy159: yych = *++YYCURSOR;
goto yy158; goto yy158;
@ -1917,7 +1917,7 @@ yy180:
if ( YYCURSOR == YYTOKEN + 1 ) if ( YYCURSOR == YYTOKEN + 1 )
{ {
free( qstr ); free( qstr );
return ITRANSFER; return YAML_ITRANSFER;
} }
lvl = CURRENT_LEVEL(); lvl = CURRENT_LEVEL();
@ -1959,7 +1959,7 @@ yy180:
} }
} }
return TRANSFER; return YAML_TRANSFER;
} }
yy181: yych = *++YYCURSOR; yy181: yych = *++YYCURSOR;
goto yy192; goto yy192;
@ -2066,7 +2066,7 @@ ScalarBlock:
char *yyt = YYTOKEN; char *yyt = YYTOKEN;
SyckLevel *lvl = CURRENT_LEVEL(); SyckLevel *lvl = CURRENT_LEVEL();
int parentIndent; int parentIndent;
GET_TRUE_INDENT(parentIndent); GET_TRUE_YAML_INDENT(parentIndent);
switch ( *yyt ) switch ( *yyt )
{ {
@ -2119,7 +2119,7 @@ yy196:
{ char *pacer; { char *pacer;
char *tok = YYTOKTMP; char *tok = YYTOKTMP;
int indt_len = 0, nl_count = 0, fold_nl = 0, nl_begin = 0; 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(); lvl = CURRENT_LEVEL();
if ( indt_len > parentIndent && lvl->status != syck_lvl_block ) if ( indt_len > parentIndent && lvl->status != syck_lvl_block )
@ -2133,7 +2133,7 @@ yy196:
else if ( lvl->status != syck_lvl_block ) else if ( lvl->status != syck_lvl_block )
{ {
YYCURSOR = YYTOKTMP; YYCURSOR = YYTOKTMP;
RETURN_BLOCK(); RETURN_YAML_BLOCK();
} }
/* /*
@ -2177,7 +2177,7 @@ yy196:
{ {
POP_LEVEL(); POP_LEVEL();
YYCURSOR = YYTOKTMP; YYCURSOR = YYTOKTMP;
RETURN_BLOCK(); RETURN_YAML_BLOCK();
} }
goto ScalarBlock2; goto ScalarBlock2;
} }
@ -2211,7 +2211,7 @@ yy202:
#line 895 #line 895
{ YYCURSOR--; { YYCURSOR--;
POP_LEVEL(); POP_LEVEL();
RETURN_BLOCK(); RETURN_YAML_BLOCK();
} }
yy203: yych = *++YYCURSOR; yy203: yych = *++YYCURSOR;
goto yy198; goto yy198;