diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2019-01-27 17:53:59 +0100 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2019-01-27 18:08:47 +0100 |
commit | f82f7eb1d816259065b49bd52f6712af32855050 (patch) | |
tree | ff06161e4d588f5ca8e31b6b7167d619016b38e4 /src/ielr.c | |
parent | 0d472b29ec0bd099a7abf0d83b8095a225896b1f (diff) | |
download | bison-f82f7eb1d816259065b49bd52f6712af32855050.tar.gz |
style: reduce scopes in state.c and ielr.c
Diffstat (limited to 'src/ielr.c')
-rw-r--r-- | src/ielr.c | 42 |
1 files changed, 24 insertions, 18 deletions
@@ -1051,27 +1051,33 @@ ielr_split_states (bitsetv follow_kernel_items, bitsetv always_follows, } } + +/* The user's requested LR type. */ +static LrType +lr_type_get (void) +{ + char *type = muscle_percent_define_get ("lr.type"); + LrType res; + if (STREQ (type, "lalr")) + res = LR_TYPE__LALR; + else if (STREQ (type, "ielr")) + res = LR_TYPE__IELR; + else if (STREQ (type, "canonical-lr")) + res = LR_TYPE__CANONICAL_LR; + else + { + aver (false); + abort (); + } + free (type); + return res; +} + + void ielr (void) { - LrType lr_type; - - /* Examine user options. */ - { - char *type = muscle_percent_define_get ("lr.type"); - if (STREQ (type, "lalr")) - lr_type = LR_TYPE__LALR; - else if (STREQ (type, "ielr")) - lr_type = LR_TYPE__IELR; - else if (STREQ (type, "canonical-lr")) - lr_type = LR_TYPE__CANONICAL_LR; - else - { - aver (false); - abort (); - } - free (type); - } + LrType lr_type = lr_type_get (); /* Phase 0: LALR(1). */ timevar_push (tv_lalr); |