java: style: avoid useless initializers

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.
This commit is contained in:
Akim Demaille
2020-02-05 07:04:53 +01:00
parent f705e9abdb
commit ebab1ffca8
2 changed files with 3 additions and 7 deletions

View File

@@ -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)

View File

@@ -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. */