java: style: fix coding style of yyerror/reportSyntaxError

* data/skeletons/lalr1.java: here.
This commit is contained in:
Akim Demaille
2020-05-01 07:43:00 +02:00
parent 01d5f232a9
commit 611495999f

View File

@@ -308,8 +308,7 @@ import java.text.MessageFormat;
*]b4_locations_if([[ Use a <code>null</code> location.]])[ *]b4_locations_if([[ Use a <code>null</code> location.]])[
* @@param msg The error message. * @@param msg The error message.
*/ */
public final void yyerror (String msg) public final void yyerror(String msg) {
{
yylexer.yyerror(]b4_locations_if([[(]b4_location_type[)null, ]])[msg); yylexer.yyerror(]b4_locations_if([[(]b4_location_type[)null, ]])[msg);
} }
]b4_locations_if([[ ]b4_locations_if([[
@@ -318,8 +317,7 @@ import java.text.MessageFormat;
* @@param loc The location associated with the message. * @@param loc The location associated with the message.
* @@param msg The error message. * @@param msg The error message.
*/ */
public final void yyerror (]b4_location_type[ loc, String msg) public final void yyerror(]b4_location_type[ loc, String msg) {
{
yylexer.yyerror(loc, msg); yylexer.yyerror(loc, msg);
} }
@@ -328,8 +326,7 @@ import java.text.MessageFormat;
* @@param pos The position associated with the message. * @@param pos The position associated with the message.
* @@param msg The error message. * @@param msg The error message.
*/ */
public final void yyerror (]b4_position_type[ pos, String msg) public final void yyerror(]b4_position_type[ pos, String msg) {
{
yylexer.yyerror(new ]b4_location_type[ (pos), msg); yylexer.yyerror(new ]b4_location_type[ (pos), msg);
}]])[ }]])[
]b4_parse_trace_if([[ ]b4_parse_trace_if([[
@@ -1003,22 +1000,20 @@ b4_dollar_popdef[]dnl
* *
* @@param ctx The context of the error. * @@param ctx The context of the error.
*/ */
private void yyreportSyntaxError (Context yyctx) private void yyreportSyntaxError(Context yyctx) {]b4_parse_error_bmatch(
{]b4_parse_error_bmatch(
[custom], [[ [custom], [[
yylexer.reportSyntaxError(yyctx);]], yylexer.reportSyntaxError(yyctx);]],
[detailed\|verbose], [[ [detailed\|verbose], [[
if (yyErrorVerbose) if (yyErrorVerbose) {
{
final int argmax = 5; final int argmax = 5;
SymbolKind[] yyarg = new SymbolKind[argmax]; SymbolKind[] yyarg = new SymbolKind[argmax];
int yycount = yysyntaxErrorArguments(yyctx, yyarg, argmax); int yycount = yysyntaxErrorArguments(yyctx, yyarg, argmax);
String[] yystr = new String[yycount]; String[] yystr = new String[yycount];
for (int yyi = 0; yyi < yycount; ++yyi) for (int yyi = 0; yyi < yycount; ++yyi) {
yystr[yyi] = yyarg[yyi].getName(); yystr[yyi] = yyarg[yyi].getName();
}
String yyformat; String yyformat;
switch (yycount) switch (yycount) {
{
default: default:
case 0: yyformat = ]b4_trans(["syntax error"])[; break; case 0: yyformat = ]b4_trans(["syntax error"])[; break;
case 1: yyformat = ]b4_trans(["syntax error, unexpected {0}"])[; break; case 1: yyformat = ]b4_trans(["syntax error, unexpected {0}"])[; break;
@@ -1028,9 +1023,9 @@ b4_dollar_popdef[]dnl
case 5: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1} or {2} or {3} or {4}"])[; break; case 5: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1} or {2} or {3} or {4}"])[; break;
} }
yyerror(]b4_locations_if([[yyctx.yylocation, ]])[new MessageFormat(yyformat).format(yystr)); yyerror(]b4_locations_if([[yyctx.yylocation, ]])[new MessageFormat(yyformat).format(yystr));
return; } else {
} yyerror(]b4_locations_if([[yyctx.yylocation, ]])["syntax error");
yyerror (]b4_locations_if([[yyctx.yylocation, ]])["syntax error");]], }]],
[simple], [[ [simple], [[
yyerror(]b4_locations_if([[yyctx.yylocation, ]])["syntax error");]])[ yyerror(]b4_locations_if([[yyctx.yylocation, ]])["syntax error");]])[
} }