1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* parse.y (token_info_push, token_info_pop): reduced ifdefs.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-10-13 09:23:19 +00:00
parent 525f6818fa
commit 475bdfee7c
2 changed files with 21 additions and 34 deletions

View file

@ -1,4 +1,6 @@
Tue Oct 13 18:20:57 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
Tue Oct 13 18:23:17 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (token_info_push, token_info_pop): reduced ifdefs.
* parse.y (parser_magic_comment): fixed normalization.

51
parse.y
View file

@ -604,6 +604,11 @@ static void ripper_compile_error(struct parser_params*, const char *fmt, ...);
#ifndef RIPPER
static void token_info_push(struct parser_params*, const char *token);
static void token_info_pop(struct parser_params*, const char *token);
#define token_info_push(token) (RTEST(ruby_verbose) ? token_info_push(parser, token) : (void)0)
#define token_info_pop(token) (RTEST(ruby_verbose) ? token_info_pop(parser, token) : (void)0)
#else
#define token_info_push(token) /* nothing */
#define token_info_pop(token) /* nothing */
#endif
%}
@ -2976,89 +2981,67 @@ primary_value : primary
k_begin : keyword_begin
{
#ifndef RIPPER
if (RTEST(ruby_verbose)) token_info_push(parser, "begin");
#endif
token_info_push("begin");
}
;
k_if : keyword_if
{
#ifndef RIPPER
if (RTEST(ruby_verbose)) token_info_push(parser, "if");
#endif
token_info_push("if");
}
;
k_unless : keyword_unless
{
#ifndef RIPPER
if (RTEST(ruby_verbose)) token_info_push(parser, "unless");
#endif
token_info_push("unless");
}
;
k_while : keyword_while
{
#ifndef RIPPER
if (RTEST(ruby_verbose)) token_info_push(parser, "while");
#endif
token_info_push("while");
}
;
k_until : keyword_until
{
#ifndef RIPPER
if (RTEST(ruby_verbose)) token_info_push(parser, "until");
#endif
token_info_push("until");
}
;
k_case : keyword_case
{
#ifndef RIPPER
if (RTEST(ruby_verbose)) token_info_push(parser, "case");
#endif
token_info_push("case");
}
;
k_for : keyword_for
{
#ifndef RIPPER
if (RTEST(ruby_verbose)) token_info_push(parser, "for");
#endif
token_info_push("for");
}
;
k_class : keyword_class
{
#ifndef RIPPER
if (RTEST(ruby_verbose)) token_info_push(parser, "class");
#endif
token_info_push("class");
}
;
k_module : keyword_module
{
#ifndef RIPPER
if (RTEST(ruby_verbose)) token_info_push(parser, "module");
#endif
token_info_push("module");
}
;
k_def : keyword_def
{
#ifndef RIPPER
if (RTEST(ruby_verbose)) token_info_push(parser, "def");
#endif
token_info_push("def");
}
;
k_end : keyword_end
{
#ifndef RIPPER
if (RTEST(ruby_verbose)) token_info_pop(parser, "end"); /* POP */
#endif
token_info_pop("end");
}
;
@ -4825,6 +4808,7 @@ token_info_has_nonspaces(struct parser_params *parser, const char *token)
return 0;
}
#undef token_info_push
static void
token_info_push(struct parser_params *parser, const char *token)
{
@ -4841,6 +4825,7 @@ token_info_push(struct parser_params *parser, const char *token)
parser->parser_token_info = ptinfo;
}
#undef token_info_pop
static void
token_info_pop(struct parser_params *parser, const char *token)
{