[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/14] glr2.cc: style: clarify control flow
From: |
Akim Demaille |
Subject: |
[PATCH 06/14] glr2.cc: style: clarify control flow |
Date: |
Sun, 12 Sep 2021 14:07:39 +0200 |
* data/skeletons/glr2.cc (yypreference): Be more functional-style.
---
data/skeletons/glr2.cc | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/data/skeletons/glr2.cc b/data/skeletons/glr2.cc
index b7d33a14..93549639 100644
--- a/data/skeletons/glr2.cc
+++ b/data/skeletons/glr2.cc
@@ -3202,8 +3202,8 @@ namespace ]b4_namespace_ref[
static int
yypreference (const semantic_option& y0, const semantic_option& y1)
{
- rule_num r0 = y0.yyrule, r1 = y1.yyrule;
- int p0 = yydprec[r0], p1 = yydprec[r1];
+ const rule_num r0 = y0.yyrule, r1 = y1.yyrule;
+ const int p0 = yydprec[r0], p1 = yydprec[r1];
if (p0 == p1)
{
@@ -3212,12 +3212,13 @@ namespace ]b4_namespace_ref[
else
return 1;
}
- if (p0 == 0 || p1 == 0)
+ else if (p0 == 0 || p1 == 0)
return 0;
- if (p0 < p1)
+ else if (p0 < p1)
return 3;
- if (p1 < p0)
+ else if (p1 < p0)
return 2;
+ else
return 0;
}
--
2.32.0
- [PATCH 00/14] glr2.cc: fix linking conflicts, Akim Demaille, 2021/09/12
- [PATCH 01/14] glr2.cc: don't publish YY_EXCEPTIONS, Akim Demaille, 2021/09/12
- [PATCH 02/14] glr2.cc: put semantic_option into an unnamed namespace, Akim Demaille, 2021/09/12
- [PATCH 03/14] glr2.cc: prefer unnamed namespace to 'static', Akim Demaille, 2021/09/12
- [PATCH 04/14] glr2.cc: put create_state_set_index in unnamed namespace, Akim Demaille, 2021/09/12
- [PATCH 05/14] glr2.cc: move glr_stack and glr_state into the parser class, Akim Demaille, 2021/09/12
- [PATCH 06/14] glr2.cc: style: clarify control flow,
Akim Demaille <=
- [PATCH 07/14] glr2.cc: move state_stack into the unnamed namespace, Akim Demaille, 2021/09/12
- [PATCH 08/14] glr2.cc: put glr_state_set and glr_stack_item in unnamed namespace, Akim Demaille, 2021/09/12
- [PATCH 09/14] glr2.cc: prefer using, and remove useless type aliases, Akim Demaille, 2021/09/12
- [PATCH 10/14] glr2.cc: use only symbol_kind_type, not yysymbol_kind_t, Akim Demaille, 2021/09/12
- [PATCH 11/14] glr2.cc: move strong_index_alias into the unnamed namespace, Akim Demaille, 2021/09/12
- [PATCH 12/14] glr2.cc: check linking conflicts, Akim Demaille, 2021/09/12
- [PATCH 13/14] glr2.cc: kill trailing white spaces, Akim Demaille, 2021/09/12
- [PATCH 14/14] glr2.cc: don't pass %parse-param to destroy, Akim Demaille, 2021/09/12
- Re: [PATCH 00/14] glr2.cc: fix linking conflicts, Tom Shields, 2021/09/12