diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-22 00:37:09 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-22 00:37:09 +0000 |
commit | 26be081f1bfbe9bfa1ef45b14860c64bd409b12b (patch) | |
tree | 78ee4b2f5ca62a96388ef5f987c4d11ae787b135 /lex.c.blt | |
parent | da4d4c002436e0e16da0b3a68c6ba470f85aac17 (diff) |
Makefile.in: PIC lex.c
* Makefile.in (lex.c): make position independent table.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lex.c.blt')
-rw-r--r-- | lex.c.blt | 197 |
1 files changed, 144 insertions, 53 deletions
@@ -1,5 +1,5 @@ /* 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,$' defs/keywords */ +/* Command-line: gperf -C -P -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' defs/keywords */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ @@ -30,7 +30,7 @@ error "gperf generated tables don't work with this execution character set. Plea #line 1 "defs/keywords" -struct kwtable {const char *name; int id[2]; enum lex_state_e state;}; +struct kwtable {unsigned int name, id[2], state;}; const struct kwtable *rb_reserved_word(const char *, unsigned int); #ifndef RIPPER static const struct kwtable *reserved_word(const char *, unsigned int); @@ -45,12 +45,10 @@ struct kwtable; #define MAX_HASH_VALUE 50 /* maximum key range = 43, duplicates = 0 */ -#ifdef __GNUC__ -__inline -#else -#ifdef __cplusplus +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) || defined(__GNUC_STDC_INLINE__) inline -#endif +#elif defined(__GNUC__) +__inline #endif static unsigned int hash (str, len) @@ -101,6 +99,95 @@ hash (str, len) return hval + asso_values[(unsigned char)str[len - 1]]; } +struct stringpool_t + { + char stringpool_str8[sizeof("break")]; + char stringpool_str9[sizeof("else")]; + char stringpool_str10[sizeof("nil")]; + char stringpool_str11[sizeof("ensure")]; + char stringpool_str12[sizeof("end")]; + char stringpool_str13[sizeof("then")]; + char stringpool_str14[sizeof("not")]; + char stringpool_str15[sizeof("false")]; + char stringpool_str16[sizeof("self")]; + char stringpool_str17[sizeof("elsif")]; + char stringpool_str18[sizeof("rescue")]; + char stringpool_str19[sizeof("true")]; + char stringpool_str20[sizeof("until")]; + char stringpool_str21[sizeof("unless")]; + char stringpool_str22[sizeof("return")]; + char stringpool_str23[sizeof("def")]; + char stringpool_str24[sizeof("and")]; + char stringpool_str25[sizeof("do")]; + char stringpool_str26[sizeof("yield")]; + char stringpool_str27[sizeof("for")]; + char stringpool_str28[sizeof("undef")]; + char stringpool_str29[sizeof("or")]; + char stringpool_str30[sizeof("in")]; + char stringpool_str31[sizeof("when")]; + char stringpool_str32[sizeof("retry")]; + char stringpool_str33[sizeof("if")]; + char stringpool_str34[sizeof("case")]; + char stringpool_str35[sizeof("redo")]; + char stringpool_str36[sizeof("next")]; + char stringpool_str37[sizeof("super")]; + char stringpool_str38[sizeof("module")]; + char stringpool_str39[sizeof("begin")]; + char stringpool_str40[sizeof("__LINE__")]; + char stringpool_str41[sizeof("__FILE__")]; + char stringpool_str42[sizeof("__ENCODING__")]; + char stringpool_str43[sizeof("END")]; + char stringpool_str44[sizeof("alias")]; + char stringpool_str45[sizeof("BEGIN")]; + char stringpool_str46[sizeof("defined?")]; + char stringpool_str47[sizeof("class")]; + char stringpool_str50[sizeof("while")]; + }; +static const struct stringpool_t stringpool_contents = + { + "break", + "else", + "nil", + "ensure", + "end", + "then", + "not", + "false", + "self", + "elsif", + "rescue", + "true", + "until", + "unless", + "return", + "def", + "and", + "do", + "yield", + "for", + "undef", + "or", + "in", + "when", + "retry", + "if", + "case", + "redo", + "next", + "super", + "module", + "begin", + "__LINE__", + "__FILE__", + "__ENCODING__", + "END", + "alias", + "BEGIN", + "defined?", + "class", + "while" + }; +#define stringpool ((const char *) &stringpool_contents) #ifdef __GNUC__ __inline #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ @@ -114,90 +201,90 @@ rb_reserved_word (str, len) { static const struct kwtable wordlist[] = { - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, #line 19 "defs/keywords" - {"break", {keyword_break, keyword_break}, EXPR_MID}, + {offsetof(struct stringpool_t, stringpool_str8), {keyword_break, keyword_break}, EXPR_MID}, #line 25 "defs/keywords" - {"else", {keyword_else, keyword_else}, EXPR_BEG}, + {offsetof(struct stringpool_t, stringpool_str9), {keyword_else, keyword_else}, EXPR_BEG}, #line 35 "defs/keywords" - {"nil", {keyword_nil, keyword_nil}, EXPR_END}, + {offsetof(struct stringpool_t, stringpool_str10), {keyword_nil, keyword_nil}, EXPR_END}, #line 28 "defs/keywords" - {"ensure", {keyword_ensure, keyword_ensure}, EXPR_BEG}, + {offsetof(struct stringpool_t, stringpool_str11), {keyword_ensure, keyword_ensure}, EXPR_BEG}, #line 27 "defs/keywords" - {"end", {keyword_end, keyword_end}, EXPR_END}, + {offsetof(struct stringpool_t, stringpool_str12), {keyword_end, keyword_end}, EXPR_END}, #line 44 "defs/keywords" - {"then", {keyword_then, keyword_then}, EXPR_BEG}, + {offsetof(struct stringpool_t, stringpool_str13), {keyword_then, keyword_then}, EXPR_BEG}, #line 36 "defs/keywords" - {"not", {keyword_not, keyword_not}, EXPR_ARG}, + {offsetof(struct stringpool_t, stringpool_str14), {keyword_not, keyword_not}, EXPR_ARG}, #line 29 "defs/keywords" - {"false", {keyword_false, keyword_false}, EXPR_END}, + {offsetof(struct stringpool_t, stringpool_str15), {keyword_false, keyword_false}, EXPR_END}, #line 42 "defs/keywords" - {"self", {keyword_self, keyword_self}, EXPR_END}, + {offsetof(struct stringpool_t, stringpool_str16), {keyword_self, keyword_self}, EXPR_END}, #line 26 "defs/keywords" - {"elsif", {keyword_elsif, keyword_elsif}, EXPR_VALUE}, + {offsetof(struct stringpool_t, stringpool_str17), {keyword_elsif, keyword_elsif}, EXPR_VALUE}, #line 39 "defs/keywords" - {"rescue", {keyword_rescue, modifier_rescue}, EXPR_MID}, + {offsetof(struct stringpool_t, stringpool_str18), {keyword_rescue, modifier_rescue}, EXPR_MID}, #line 45 "defs/keywords" - {"true", {keyword_true, keyword_true}, EXPR_END}, + {offsetof(struct stringpool_t, stringpool_str19), {keyword_true, keyword_true}, EXPR_END}, #line 48 "defs/keywords" - {"until", {keyword_until, modifier_until}, EXPR_VALUE}, + {offsetof(struct stringpool_t, stringpool_str20), {keyword_until, modifier_until}, EXPR_VALUE}, #line 47 "defs/keywords" - {"unless", {keyword_unless, modifier_unless}, EXPR_VALUE}, + {offsetof(struct stringpool_t, stringpool_str21), {keyword_unless, modifier_unless}, EXPR_VALUE}, #line 41 "defs/keywords" - {"return", {keyword_return, keyword_return}, EXPR_MID}, + {offsetof(struct stringpool_t, stringpool_str22), {keyword_return, keyword_return}, EXPR_MID}, #line 22 "defs/keywords" - {"def", {keyword_def, keyword_def}, EXPR_FNAME}, + {offsetof(struct stringpool_t, stringpool_str23), {keyword_def, keyword_def}, EXPR_FNAME}, #line 17 "defs/keywords" - {"and", {keyword_and, keyword_and}, EXPR_VALUE}, + {offsetof(struct stringpool_t, stringpool_str24), {keyword_and, keyword_and}, EXPR_VALUE}, #line 24 "defs/keywords" - {"do", {keyword_do, keyword_do}, EXPR_BEG}, + {offsetof(struct stringpool_t, stringpool_str25), {keyword_do, keyword_do}, EXPR_BEG}, #line 51 "defs/keywords" - {"yield", {keyword_yield, keyword_yield}, EXPR_ARG}, + {offsetof(struct stringpool_t, stringpool_str26), {keyword_yield, keyword_yield}, EXPR_ARG}, #line 30 "defs/keywords" - {"for", {keyword_for, keyword_for}, EXPR_VALUE}, + {offsetof(struct stringpool_t, stringpool_str27), {keyword_for, keyword_for}, EXPR_VALUE}, #line 46 "defs/keywords" - {"undef", {keyword_undef, keyword_undef}, EXPR_FNAME}, + {offsetof(struct stringpool_t, stringpool_str28), {keyword_undef, keyword_undef}, EXPR_FNAME}, #line 37 "defs/keywords" - {"or", {keyword_or, keyword_or}, EXPR_VALUE}, + {offsetof(struct stringpool_t, stringpool_str29), {keyword_or, keyword_or}, EXPR_VALUE}, #line 32 "defs/keywords" - {"in", {keyword_in, keyword_in}, EXPR_VALUE}, + {offsetof(struct stringpool_t, stringpool_str30), {keyword_in, keyword_in}, EXPR_VALUE}, #line 49 "defs/keywords" - {"when", {keyword_when, keyword_when}, EXPR_VALUE}, + {offsetof(struct stringpool_t, stringpool_str31), {keyword_when, keyword_when}, EXPR_VALUE}, #line 40 "defs/keywords" - {"retry", {keyword_retry, keyword_retry}, EXPR_END}, + {offsetof(struct stringpool_t, stringpool_str32), {keyword_retry, keyword_retry}, EXPR_END}, #line 31 "defs/keywords" - {"if", {keyword_if, modifier_if}, EXPR_VALUE}, + {offsetof(struct stringpool_t, stringpool_str33), {keyword_if, modifier_if}, EXPR_VALUE}, #line 20 "defs/keywords" - {"case", {keyword_case, keyword_case}, EXPR_VALUE}, + {offsetof(struct stringpool_t, stringpool_str34), {keyword_case, keyword_case}, EXPR_VALUE}, #line 38 "defs/keywords" - {"redo", {keyword_redo, keyword_redo}, EXPR_END}, + {offsetof(struct stringpool_t, stringpool_str35), {keyword_redo, keyword_redo}, EXPR_END}, #line 34 "defs/keywords" - {"next", {keyword_next, keyword_next}, EXPR_MID}, + {offsetof(struct stringpool_t, stringpool_str36), {keyword_next, keyword_next}, EXPR_MID}, #line 43 "defs/keywords" - {"super", {keyword_super, keyword_super}, EXPR_ARG}, + {offsetof(struct stringpool_t, stringpool_str37), {keyword_super, keyword_super}, EXPR_ARG}, #line 33 "defs/keywords" - {"module", {keyword_module, keyword_module}, EXPR_VALUE}, + {offsetof(struct stringpool_t, stringpool_str38), {keyword_module, keyword_module}, EXPR_VALUE}, #line 18 "defs/keywords" - {"begin", {keyword_begin, keyword_begin}, EXPR_BEG}, + {offsetof(struct stringpool_t, stringpool_str39), {keyword_begin, keyword_begin}, EXPR_BEG}, #line 12 "defs/keywords" - {"__LINE__", {keyword__LINE__, keyword__LINE__}, EXPR_END}, + {offsetof(struct stringpool_t, stringpool_str40), {keyword__LINE__, keyword__LINE__}, EXPR_END}, #line 13 "defs/keywords" - {"__FILE__", {keyword__FILE__, keyword__FILE__}, EXPR_END}, + {offsetof(struct stringpool_t, stringpool_str41), {keyword__FILE__, keyword__FILE__}, EXPR_END}, #line 11 "defs/keywords" - {"__ENCODING__", {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END}, + {offsetof(struct stringpool_t, stringpool_str42), {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END}, #line 15 "defs/keywords" - {"END", {keyword_END, keyword_END}, EXPR_END}, + {offsetof(struct stringpool_t, stringpool_str43), {keyword_END, keyword_END}, EXPR_END}, #line 16 "defs/keywords" - {"alias", {keyword_alias, keyword_alias}, EXPR_FNAME}, + {offsetof(struct stringpool_t, stringpool_str44), {keyword_alias, keyword_alias}, EXPR_FNAME}, #line 14 "defs/keywords" - {"BEGIN", {keyword_BEGIN, keyword_BEGIN}, EXPR_END}, + {offsetof(struct stringpool_t, stringpool_str45), {keyword_BEGIN, keyword_BEGIN}, EXPR_END}, #line 23 "defs/keywords" - {"defined?", {keyword_defined, keyword_defined}, EXPR_ARG}, + {offsetof(struct stringpool_t, stringpool_str46), {keyword_defined, keyword_defined}, EXPR_ARG}, #line 21 "defs/keywords" - {"class", {keyword_class, keyword_class}, EXPR_CLASS}, - {""}, {""}, + {offsetof(struct stringpool_t, stringpool_str47), {keyword_class, keyword_class}, EXPR_CLASS}, + {-1}, {-1}, #line 50 "defs/keywords" - {"while", {keyword_while, modifier_while}, EXPR_VALUE} + {offsetof(struct stringpool_t, stringpool_str50), {keyword_while, modifier_while}, EXPR_VALUE} }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) @@ -206,10 +293,14 @@ rb_reserved_word (str, len) if (key <= MAX_HASH_VALUE && key >= 0) { - register const char *s = wordlist[key].name; + register int o = wordlist[key].name; + if (o >= 0) + { + register const char *s = o + stringpool; - if (*str == *s && !strcmp (str + 1, s + 1)) - return &wordlist[key]; + if (*str == *s && !strcmp (str + 1, s + 1)) + return &wordlist[key]; + } } } return 0; |