Skip to content

Commit

Permalink
* defs/keywords (reserved_word): made inline function static.
Browse files Browse the repository at this point in the history
  [ruby-core:23210]

* parse.y (rb_reserved_word): ordinary function for ripper.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed May 16, 2009
1 parent d2c07ec commit 78e376a
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 47 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
@@ -1,3 +1,10 @@
Sat May 16 09:30:14 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>

* defs/keywords (reserved_word): made inline function static.
[ruby-core:23210]

* parse.y (rb_reserved_word): ordinary function for ripper.

Sat May 16 09:19:16 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> Sat May 16 09:19:16 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>


* parse.y (magic_comment_encoding): use rb_compile_warning() to * parse.y (magic_comment_encoding): use rb_compile_warning() to
Expand Down
2 changes: 2 additions & 0 deletions defs/keywords
Expand Up @@ -2,6 +2,8 @@
struct kwtable {const char *name; int id[2]; enum lex_state_e state;}; struct kwtable {const char *name; int id[2]; enum lex_state_e state;};
const struct kwtable *rb_reserved_word(const char *, unsigned int); const struct kwtable *rb_reserved_word(const char *, unsigned int);
#ifndef RIPPER #ifndef RIPPER
static const struct kwtable *reserved_word(const char *, unsigned int);
#define rb_reserved_word(str, len) reserved_word(str, len)
%} %}


struct kwtable; struct kwtable;
Expand Down
2 changes: 2 additions & 0 deletions defs/lex.c.src
Expand Up @@ -2,6 +2,8 @@
struct kwtable {const char *name; int id[2]; enum lex_state_e state;}; struct kwtable {const char *name; int id[2]; enum lex_state_e state;};
const struct kwtable *rb_reserved_word(const char *, unsigned int); const struct kwtable *rb_reserved_word(const char *, unsigned int);
#ifndef RIPPER #ifndef RIPPER
static const struct kwtable *reserved_word(const char *, unsigned int);
#define rb_reserved_word(str, len) reserved_word(str, len)
%} %}


struct kwtable; struct kwtable;
Expand Down
96 changes: 49 additions & 47 deletions lex.c.blt
@@ -1,5 +1,5 @@
/* C code produced by gperf version 3.0.3 */ /* C code produced by gperf version 3.0.4 */
/* Command-line: gperf -C -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' keywords */ /* Command-line: gperf -C -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' defs/keywords */


#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
Expand Down Expand Up @@ -28,12 +28,14 @@
error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
#endif #endif


#line 1 "keywords" #line 1 "defs/keywords"


struct kwtable {const char *name; int id[2]; enum lex_state_e state;}; struct kwtable {const char *name; int id[2]; enum lex_state_e state;};
const struct kwtable *rb_reserved_word(const char *, unsigned int); const struct kwtable *rb_reserved_word(const char *, unsigned int);
#ifndef RIPPER #ifndef RIPPER
#line 7 "keywords" static const struct kwtable *reserved_word(const char *, unsigned int);
#define rb_reserved_word(str, len) reserved_word(str, len)
#line 9 "defs/keywords"
struct kwtable; struct kwtable;


#define TOTAL_KEYWORDS 41 #define TOTAL_KEYWORDS 41
Expand Down Expand Up @@ -101,7 +103,7 @@ hash (str, len)


#ifdef __GNUC__ #ifdef __GNUC__
__inline __inline
#ifdef __GNUC_STDC_INLINE__ #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
__attribute__ ((__gnu_inline__)) __attribute__ ((__gnu_inline__))
#endif #endif
#endif #endif
Expand All @@ -113,88 +115,88 @@ rb_reserved_word (str, len)
static const struct kwtable wordlist[] = static const struct kwtable wordlist[] =
{ {
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 17 "keywords" #line 19 "defs/keywords"
{"break", {keyword_break, keyword_break}, EXPR_MID}, {"break", {keyword_break, keyword_break}, EXPR_MID},
#line 23 "keywords" #line 25 "defs/keywords"
{"else", {keyword_else, keyword_else}, EXPR_BEG}, {"else", {keyword_else, keyword_else}, EXPR_BEG},
#line 33 "keywords" #line 35 "defs/keywords"
{"nil", {keyword_nil, keyword_nil}, EXPR_END}, {"nil", {keyword_nil, keyword_nil}, EXPR_END},
#line 26 "keywords" #line 28 "defs/keywords"
{"ensure", {keyword_ensure, keyword_ensure}, EXPR_BEG}, {"ensure", {keyword_ensure, keyword_ensure}, EXPR_BEG},
#line 25 "keywords" #line 27 "defs/keywords"
{"end", {keyword_end, keyword_end}, EXPR_END}, {"end", {keyword_end, keyword_end}, EXPR_END},
#line 42 "keywords" #line 44 "defs/keywords"
{"then", {keyword_then, keyword_then}, EXPR_BEG}, {"then", {keyword_then, keyword_then}, EXPR_BEG},
#line 34 "keywords" #line 36 "defs/keywords"
{"not", {keyword_not, keyword_not}, EXPR_ARG}, {"not", {keyword_not, keyword_not}, EXPR_ARG},
#line 27 "keywords" #line 29 "defs/keywords"
{"false", {keyword_false, keyword_false}, EXPR_END}, {"false", {keyword_false, keyword_false}, EXPR_END},
#line 40 "keywords" #line 42 "defs/keywords"
{"self", {keyword_self, keyword_self}, EXPR_END}, {"self", {keyword_self, keyword_self}, EXPR_END},
#line 24 "keywords" #line 26 "defs/keywords"
{"elsif", {keyword_elsif, keyword_elsif}, EXPR_VALUE}, {"elsif", {keyword_elsif, keyword_elsif}, EXPR_VALUE},
#line 37 "keywords" #line 39 "defs/keywords"
{"rescue", {keyword_rescue, modifier_rescue}, EXPR_MID}, {"rescue", {keyword_rescue, modifier_rescue}, EXPR_MID},
#line 43 "keywords" #line 45 "defs/keywords"
{"true", {keyword_true, keyword_true}, EXPR_END}, {"true", {keyword_true, keyword_true}, EXPR_END},
#line 46 "keywords" #line 48 "defs/keywords"
{"until", {keyword_until, modifier_until}, EXPR_VALUE}, {"until", {keyword_until, modifier_until}, EXPR_VALUE},
#line 45 "keywords" #line 47 "defs/keywords"
{"unless", {keyword_unless, modifier_unless}, EXPR_VALUE}, {"unless", {keyword_unless, modifier_unless}, EXPR_VALUE},
#line 39 "keywords" #line 41 "defs/keywords"
{"return", {keyword_return, keyword_return}, EXPR_MID}, {"return", {keyword_return, keyword_return}, EXPR_MID},
#line 20 "keywords" #line 22 "defs/keywords"
{"def", {keyword_def, keyword_def}, EXPR_FNAME}, {"def", {keyword_def, keyword_def}, EXPR_FNAME},
#line 15 "keywords" #line 17 "defs/keywords"
{"and", {keyword_and, keyword_and}, EXPR_VALUE}, {"and", {keyword_and, keyword_and}, EXPR_VALUE},
#line 22 "keywords" #line 24 "defs/keywords"
{"do", {keyword_do, keyword_do}, EXPR_BEG}, {"do", {keyword_do, keyword_do}, EXPR_BEG},
#line 49 "keywords" #line 51 "defs/keywords"
{"yield", {keyword_yield, keyword_yield}, EXPR_ARG}, {"yield", {keyword_yield, keyword_yield}, EXPR_ARG},
#line 28 "keywords" #line 30 "defs/keywords"
{"for", {keyword_for, keyword_for}, EXPR_VALUE}, {"for", {keyword_for, keyword_for}, EXPR_VALUE},
#line 44 "keywords" #line 46 "defs/keywords"
{"undef", {keyword_undef, keyword_undef}, EXPR_FNAME}, {"undef", {keyword_undef, keyword_undef}, EXPR_FNAME},
#line 35 "keywords" #line 37 "defs/keywords"
{"or", {keyword_or, keyword_or}, EXPR_VALUE}, {"or", {keyword_or, keyword_or}, EXPR_VALUE},
#line 30 "keywords" #line 32 "defs/keywords"
{"in", {keyword_in, keyword_in}, EXPR_VALUE}, {"in", {keyword_in, keyword_in}, EXPR_VALUE},
#line 47 "keywords" #line 49 "defs/keywords"
{"when", {keyword_when, keyword_when}, EXPR_VALUE}, {"when", {keyword_when, keyword_when}, EXPR_VALUE},
#line 38 "keywords" #line 40 "defs/keywords"
{"retry", {keyword_retry, keyword_retry}, EXPR_END}, {"retry", {keyword_retry, keyword_retry}, EXPR_END},
#line 29 "keywords" #line 31 "defs/keywords"
{"if", {keyword_if, modifier_if}, EXPR_VALUE}, {"if", {keyword_if, modifier_if}, EXPR_VALUE},
#line 18 "keywords" #line 20 "defs/keywords"
{"case", {keyword_case, keyword_case}, EXPR_VALUE}, {"case", {keyword_case, keyword_case}, EXPR_VALUE},
#line 36 "keywords" #line 38 "defs/keywords"
{"redo", {keyword_redo, keyword_redo}, EXPR_END}, {"redo", {keyword_redo, keyword_redo}, EXPR_END},
#line 32 "keywords" #line 34 "defs/keywords"
{"next", {keyword_next, keyword_next}, EXPR_MID}, {"next", {keyword_next, keyword_next}, EXPR_MID},
#line 41 "keywords" #line 43 "defs/keywords"
{"super", {keyword_super, keyword_super}, EXPR_ARG}, {"super", {keyword_super, keyword_super}, EXPR_ARG},
#line 31 "keywords" #line 33 "defs/keywords"
{"module", {keyword_module, keyword_module}, EXPR_VALUE}, {"module", {keyword_module, keyword_module}, EXPR_VALUE},
#line 16 "keywords" #line 18 "defs/keywords"
{"begin", {keyword_begin, keyword_begin}, EXPR_BEG}, {"begin", {keyword_begin, keyword_begin}, EXPR_BEG},
#line 10 "keywords" #line 12 "defs/keywords"
{"__LINE__", {keyword__LINE__, keyword__LINE__}, EXPR_END}, {"__LINE__", {keyword__LINE__, keyword__LINE__}, EXPR_END},
#line 11 "keywords" #line 13 "defs/keywords"
{"__FILE__", {keyword__FILE__, keyword__FILE__}, EXPR_END}, {"__FILE__", {keyword__FILE__, keyword__FILE__}, EXPR_END},
#line 9 "keywords" #line 11 "defs/keywords"
{"__ENCODING__", {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END}, {"__ENCODING__", {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END},
#line 13 "keywords" #line 15 "defs/keywords"
{"END", {keyword_END, keyword_END}, EXPR_END}, {"END", {keyword_END, keyword_END}, EXPR_END},
#line 14 "keywords" #line 16 "defs/keywords"
{"alias", {keyword_alias, keyword_alias}, EXPR_FNAME}, {"alias", {keyword_alias, keyword_alias}, EXPR_FNAME},
#line 12 "keywords" #line 14 "defs/keywords"
{"BEGIN", {keyword_BEGIN, keyword_BEGIN}, EXPR_END}, {"BEGIN", {keyword_BEGIN, keyword_BEGIN}, EXPR_END},
#line 21 "keywords" #line 23 "defs/keywords"
{"defined?", {keyword_defined, keyword_defined}, EXPR_ARG}, {"defined?", {keyword_defined, keyword_defined}, EXPR_ARG},
#line 19 "keywords" #line 21 "defs/keywords"
{"class", {keyword_class, keyword_class}, EXPR_CLASS}, {"class", {keyword_class, keyword_class}, EXPR_CLASS},
{""}, {""}, {""}, {""},
#line 48 "keywords" #line 50 "defs/keywords"
{"while", {keyword_while, modifier_while}, EXPR_VALUE} {"while", {keyword_while, modifier_while}, EXPR_VALUE}
}; };


Expand All @@ -212,6 +214,6 @@ rb_reserved_word (str, len)
} }
return 0; return 0;
} }
#line 50 "keywords" #line 52 "defs/keywords"


#endif #endif
8 changes: 8 additions & 0 deletions parse.y
Expand Up @@ -9715,6 +9715,14 @@ VALUE rb_parser_get_yydebug(VALUE);
VALUE rb_parser_set_yydebug(VALUE, VALUE); VALUE rb_parser_set_yydebug(VALUE, VALUE);


#ifndef RIPPER #ifndef RIPPER
#undef rb_reserved_word

const struct kwtable *
rb_reserved_word(const char *str, unsigned int len)
{
return reserved_word(str, len);
}

static struct parser_params * static struct parser_params *
parser_new(void) parser_new(void)
{ {
Expand Down

0 comments on commit 78e376a

Please sign in to comment.