summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-15 09:26:26 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-15 09:26:26 +0000
commitb520b218391b7af434c428f622797ae59b4691c4 (patch)
treed1e057380378bbd4f1cd666a92a9d839d2a8a430 /parse.y
parent356c085709099df61fdf177d1e7717aa65640376 (diff)
downloadbundler-b520b218391b7af434c428f622797ae59b4691c4.tar.gz
parse.y: static table
* parse.y (lex_state_name): use static table. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y22
1 files changed, 8 insertions, 14 deletions
diff --git a/parse.y b/parse.y
index fc99d2ffe6..457d0fb2ba 100644
--- a/parse.y
+++ b/parse.y
@@ -8571,20 +8571,14 @@ id_is_var_gen(struct parser_params *parser, ID id)
static const char *
lex_state_name(enum lex_state_e state)
{
- switch (state) {
- case EXPR_BEG: return "EXPR_BEG";
- case EXPR_END: return "EXPR_END";
- case EXPR_ENDARG: return "EXPR_ENDARG";
- case EXPR_ENDFN: return "EXPR_ENDFN";
- case EXPR_ARG: return "EXPR_ARG";
- case EXPR_CMDARG: return "EXPR_CMDARG";
- case EXPR_MID: return "EXPR_MID";
- case EXPR_FNAME: return "EXPR_FNAME";
- case EXPR_DOT: return "EXPR_DOT";
- case EXPR_CLASS: return "EXPR_CLASS";
- case EXPR_VALUE: return "EXPR_VALUE";
- case EXPR_MAX_STATE: break;
- }
+ static const char names[][12] = {
+ "EXPR_BEG", "EXPR_END", "EXPR_ENDARG", "EXPR_ENDFN", "EXPR_ARG",
+ "EXPR_CMDARG", "EXPR_MID", "EXPR_FNAME", "EXPR_DOT", "EXPR_CLASS",
+ "EXPR_VALUE",
+ };
+
+ if ((unsigned)state < EXPR_MAX_STATE)
+ return names[state];
return NULL;
}
#endif