java: formatting changes

* data/skeletons/java.m4, data/skeletons/lalr1.java: here.
This commit is contained in:
Akim Demaille
2020-02-02 07:42:11 +01:00
parent ba69beafac
commit edf495b38e
4 changed files with 16 additions and 16 deletions

View File

@@ -109,8 +109,8 @@ m4_define([b4_null], [null])
m4_define([b4_typed_parser_table_define], m4_define([b4_typed_parser_table_define],
[m4_ifval([$4], [b4_comment([$4]) [m4_ifval([$4], [b4_comment([$4])
])dnl ])dnl
[private static final ]$1[ yy$2_[] = yy$2_init(); [private static final ]$1[ yy$2_[] = yy$2_init ();
private static final ]$1[[] yy$2_init() private static final ]$1[[] yy$2_init ()
{ {
return new ]$1[[] return new ]$1[[]
{ {

View File

@@ -49,9 +49,9 @@ b4_use_push_for_pull_if([
b4_push_if([m4_define([b4_use_push_for_pull_flag], [[0]])], b4_push_if([m4_define([b4_use_push_for_pull_flag], [[0]])],
[m4_define([b4_push_flag], [[1]])])]) [m4_define([b4_push_flag], [[1]])])])
# Define a macro to encapsulate the parse state variables. # Define a macro to encapsulate the parse state variables. This
# This allows them to be defined either in parse() when doing # allows them to be defined either in parse() when doing pull parsing,
# pull parsing, or as class instance variable when doing push parsing. # or as class instance variable when doing push parsing.
m4_define([b4_define_state],[[ m4_define([b4_define_state],[[
/* Lookahead and lookahead in internal form. */ /* Lookahead and lookahead in internal form. */
int yychar = yyempty_; int yychar = yyempty_;
@@ -239,7 +239,7 @@ m4_define([b4_define_state],[[
public ]b4_parser_class (b4_parse_param_decl([b4_lex_param_decl])[)]b4_maybe_throws([b4_init_throws])[ public ]b4_parser_class (b4_parse_param_decl([b4_lex_param_decl])[)]b4_maybe_throws([b4_init_throws])[
{ {
]b4_percent_code_get([[init]])[ ]b4_percent_code_get([[init]])[
this.yylexer = new YYLexer(]b4_lex_param_call[); this.yylexer = new YYLexer (]b4_lex_param_call[);
]b4_parse_param_cons[ ]b4_parse_param_cons[
} }
]])[ ]])[
@@ -267,7 +267,7 @@ m4_define([b4_define_state],[[
* Set the <tt>PrintStream</tt> on which the debug output is printed. * Set the <tt>PrintStream</tt> on which the debug output is printed.
* @@param s The stream that is used for debugging output. * @@param s The stream that is used for debugging output.
*/ */
public final void setDebugStream(java.io.PrintStream s) { yyDebugStream = s; } public final void setDebugStream (java.io.PrintStream s) { yyDebugStream = s; }
private int yydebug = 0; private int yydebug = 0;
@@ -275,14 +275,14 @@ m4_define([b4_define_state],[[
* Answer the verbosity of the debugging output; 0 means that all kinds of * Answer the verbosity of the debugging output; 0 means that all kinds of
* output from the parser are suppressed. * output from the parser are suppressed.
*/ */
public final int getDebugLevel() { return yydebug; } public final int getDebugLevel () { return yydebug; }
/** /**
* Set the verbosity of the debugging output; 0 means that all kinds of * Set the verbosity of the debugging output; 0 means that all kinds of
* output from the parser are suppressed. * output from the parser are suppressed.
* @@param level The verbosity level for debugging output. * @@param level The verbosity level for debugging output.
*/ */
public final void setDebugLevel(int level) { yydebug = level; } public final void setDebugLevel (int level) { yydebug = level; }
]])[ ]])[
/** /**
@@ -775,8 +775,8 @@ b4_dollar_popdef[]dnl
} }
if (label == YYABORT) if (label == YYABORT)
/* Leave the switch. */ /* Leave the switch. */
break; break;
]b4_locations_if([[ ]b4_locations_if([[
/* Muck with the stack to setup for yylloc. */ /* Muck with the stack to setup for yylloc. */
@@ -811,7 +811,7 @@ b4_dollar_popdef[]dnl
/** /**
* (Re-)Initialize the state of the push parser. * (Re-)Initialize the state of the push parser.
*/ */
public void push_parse_initialize() public void push_parse_initialize ()
{ {
/* Lookahead and lookahead in internal form. */ /* Lookahead and lookahead in internal form. */
this.yychar = yyempty_; this.yychar = yyempty_;
@@ -1002,7 +1002,7 @@ b4_dollar_popdef[]dnl
/* The symbols being reduced. */ /* The symbols being reduced. */
for (int yyi = 0; yyi < yynrhs; yyi++) for (int yyi = 0; yyi < yynrhs; yyi++)
yySymbolPrint (" $" + (yyi + 1) + " =", yySymbolPrint (" $" + (yyi + 1) + " =",
yystos_[yystack.stateAt(yynrhs - (yyi + 1))], yystos_[yystack.stateAt (yynrhs - (yyi + 1))],
]b4_rhs_data(yynrhs, yyi + 1)b4_locations_if([, ]b4_rhs_data(yynrhs, yyi + 1)b4_locations_if([,
b4_rhs_location(yynrhs, yyi + 1)])[); b4_rhs_location(yynrhs, yyi + 1)])[);
}]])[ }]])[

View File

@@ -595,7 +595,7 @@ AT_BISON_CHECK([PUSHPULLFLAG [-o Calc.java Calc.y]])
AT_JAVA_COMPILE([[Calc.java]]) AT_JAVA_COMPILE([[Calc.java]])
# Verify that this is a push parser. # Verify that this is a push parser.
AT_CHECK_JAVA_GREP([[Calc.java]], AT_CHECK_JAVA_GREP([[Calc.java]],
[[.*public void push_parse_initialize().*]]) [[.*public void push_parse_initialize ().*]])
# Capture stderr output for comparison purposes. # Capture stderr output for comparison purposes.
AT_JAVA_PARSER_CHECK([Calc input], 0, [ignore-nolog], [stderr-nolog]) AT_JAVA_PARSER_CHECK([Calc input], 0, [ignore-nolog], [stderr-nolog])
# Extract the "Stack Now" lines from the error output, # Extract the "Stack Now" lines from the error output,
@@ -855,7 +855,7 @@ AT_BISON_CHECK([PUSHPULLFLAG [-o Calc.java Calc.y]])
AT_JAVA_COMPILE([[Calc.java]]) AT_JAVA_COMPILE([[Calc.java]])
# Verify that this is a push parser # Verify that this is a push parser
AT_CHECK_JAVA_GREP([[Calc.java]], AT_CHECK_JAVA_GREP([[Calc.java]],
[[.*public void push_parse_initialize().*]]) [[.*public void push_parse_initialize ().*]])
# Capture the stdout and stderr output for comparison purposes. # Capture the stdout and stderr output for comparison purposes.
AT_JAVA_PARSER_CHECK([Calc input], 0, [stdout-nolog], [stderr-nolog]) AT_JAVA_PARSER_CHECK([Calc input], 0, [stdout-nolog], [stderr-nolog])
# 1. Check that the token locations are correct # 1. Check that the token locations are correct

View File

@@ -845,7 +845,7 @@ m4_define([AT_JAVA_POSITION_DEFINE],
public String toString () public String toString ()
{ {
return Integer.toString (line) + "." + Integer.toString(token); return Integer.toString (line) + "." + Integer.toString (token);
} }
public int lineno () public int lineno ()