diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-13 09:23:19 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-13 09:23:19 +0000 |
| commit | 6a124552fb6777d47ddee7e941f1c3dbeda55994 (patch) | |
| tree | 7cecc62c7ec308c8247d17c840f5e52d70e1149a | |
| parent | 6f06228f84373d752fc54c5e4278137972a1cbd8 (diff) | |
| download | ruby-6a124552fb6777d47ddee7e941f1c3dbeda55994.tar.gz ruby-6a124552fb6777d47ddee7e941f1c3dbeda55994.tar.xz ruby-6a124552fb6777d47ddee7e941f1c3dbeda55994.zip | |
* parse.y (token_info_push, token_info_pop): reduced ifdefs.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | parse.y | 51 |
2 files changed, 21 insertions, 34 deletions
@@ -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. @@ -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) { |
