summaryrefslogtreecommitdiff
path: root/src/ielr.c
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2019-01-27 17:53:59 +0100
committerAkim Demaille <akim.demaille@gmail.com>2019-01-27 18:08:47 +0100
commitf82f7eb1d816259065b49bd52f6712af32855050 (patch)
treeff06161e4d588f5ca8e31b6b7167d619016b38e4 /src/ielr.c
parent0d472b29ec0bd099a7abf0d83b8095a225896b1f (diff)
downloadbison-f82f7eb1d816259065b49bd52f6712af32855050.tar.gz
style: reduce scopes in state.c and ielr.c
Diffstat (limited to 'src/ielr.c')
-rw-r--r--src/ielr.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/ielr.c b/src/ielr.c
index a205a87d..fe1217b1 100644
--- a/src/ielr.c
+++ b/src/ielr.c
@@ -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);