[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/13] java: style: avoid useless initializers
From: |
Akim Demaille |
Subject: |
[PATCH 08/13] java: style: avoid useless initializers |
Date: |
Wed, 5 Feb 2020 18:05:00 +0100 |
Instead of
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
private static final byte yypact_[] = yypact_init ();
private static final byte[] yypact_init ()
{
return new byte[]
{
25, -7, -8, 37, -8, 40, -8, 20, -8, 61,
-8, -8, 3, 9, 51, -8, -8, -2, -2, -2,
-2, -2, -2, -8, -8, -8, 1, 66, 66, 3,
3, 3
};
}
generate
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
private static final byte[] yypact_ =
{
25, -7, -8, 37, -8, 40, -8, 20, -8, 61,
-8, -8, 3, 9, 51, -8, -8, -2, -2, -2,
-2, -2, -2, -8, -8, -8, 1, 66, 66, 3,
3, 3
};
I have no idea what motivated the previous approach.
* data/skeletons/java.m4 (b4_typed_parser_table_define): Here.
---
data/skeletons/java.m4 | 8 ++------
data/skeletons/lalr1.java | 2 +-
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/data/skeletons/java.m4 b/data/skeletons/java.m4
index bcf9a993..b36ee3d2 100644
--- a/data/skeletons/java.m4
+++ b/data/skeletons/java.m4
@@ -109,14 +109,10 @@ m4_define([b4_null], [null])
m4_define([b4_typed_parser_table_define],
[m4_ifval([$4], [b4_comment([$4])
])dnl
-[private static final ]$1[[] yy$2_ = yy$2_init ();
- private static final ]$1[[] yy$2_init ()
+[private static final ]$1[[] yy$2_ =
{
- return new ]$1[[]
- {
]$3[
- };
- }]])
+ };]])
# b4_integral_parser_table_define(NAME, DATA, COMMENT)
diff --git a/data/skeletons/lalr1.java b/data/skeletons/lalr1.java
index 7f5e4a1a..24b50795 100644
--- a/data/skeletons/lalr1.java
+++ b/data/skeletons/lalr1.java
@@ -982,7 +982,7 @@ b4_dollar_popdef[]dnl
private static final ]b4_int_type_for([b4_pact])[ yypact_ninf_ =
]b4_pact_ninf[;
private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ =
]b4_table_ninf[;
- ]b4_parser_tables_define[
+]b4_parser_tables_define[
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
--
2.25.0
- [PATCH 00/13] Clean up the Java skeleton and tests, Akim Demaille, 2020/02/05
- [PATCH 03/13] traces: don't print the stack before the gotos, Akim Demaille, 2020/02/05
- [PATCH 01/13] traces: write the "Reading a token" alone on its line, Akim Demaille, 2020/02/05
- [PATCH 02/13] traces: show the stack after reading a token, Akim Demaille, 2020/02/05
- [PATCH 05/13] java: examples: prefer switch to chains of else-if, Akim Demaille, 2020/02/05
- [PATCH 04/13] java: examples: split in two, Akim Demaille, 2020/02/05
- [PATCH 06/13] java: examples: fix the tracking of locations, Akim Demaille, 2020/02/05
- [PATCH 07/13] java: style: prefer putting the square brackets on the type, Akim Demaille, 2020/02/05
- [PATCH 08/13] java: style: avoid useless initializers,
Akim Demaille <=
- [PATCH 09/13] java: tests: prepare the replacement of calculator tests, Akim Demaille, 2020/02/05
- [PATCH 10/13] java: tests: check location tracking in the calculator, Akim Demaille, 2020/02/05
- [PATCH 12/13] java: tests: check push parsers, Akim Demaille, 2020/02/05
- [PATCH 11/13] java: tests: remove now redundant tests, Akim Demaille, 2020/02/05
- [PATCH 13/13] java: tests: remove now redundant tests, Akim Demaille, 2020/02/05