summaryrefslogtreecommitdiff
path: root/data/java.m4
diff options
context:
space:
mode:
authorDi-an Jan <dianj@freeshell.org>2008-11-10 14:29:07 +0100
committerPaolo Bonzini <bonzini@gnu.org>2008-11-10 14:34:52 +0100
commit1979121c96ed6ae55afd2e331b30345000afa780 (patch)
tree19359acc13d61cfe0022db42db5c2a7407370c22 /data/java.m4
parent42f832d680b3f5b405f4b2216b8f223b9e82ee28 (diff)
downloadbison-1979121c96ed6ae55afd2e331b30345000afa780.tar.gz
Various Java skeleton improvements.
* NEWS: Document them. General Java skeleton improvements. * configure.ac (gt_JAVACOMP): Request target of 1.4, which allows using gcj < 4.3 in the testsuite, according to comments in gnulib/m4/javacomp.m4. * data/java.m4 (stype, parser_class_name, lex_throws, throws, location_type, position_type): Remove extraneous brackets from b4_percent_define_default. (b4_lex_param, b4_parse_param): Remove extraneous brackets from m4_define and m4_define_default. * data/lalr1.java (b4_pre_prologue): Change to b4_user_post_prologue, which marks the end of user code with appropriate syncline, like all the other skeletons. (b4_user_post_prologue): Add. Don't silently drop. (yylex): Remove. (parse): Inline yylex. * doc/bison.texinfo (bisonVersion, bisonSkeleton): Document. (%{...%}): Fix typo of %code imports. * tests/java.at (AT_JAVA_COMPILE): Add "java" keyword. Support annotations on parser class with %define annotations. * data/lalr1.java (annotations): Add to parser class modifier. * doc/bison.texinfo (Java Parser Interface): Document %define annotations. (Java Declarations Summary): Document %define annotations. * tests/java.at (Java parser class modifiers): Test annotations. Do not generate code for %error-verbose unless requested. * data/lalr1.java (errorVerbose): Rename to yyErrorVerbose. Make private. Make conditional on %error-verbose. (getErrorVerbose, setErrorVerbose): New. (yytnamerr_): Make conditional on %error-verbose. (yysyntax_error): Make some code conditional on %error-verbose. * doc/bison.texinfo (Java Bison Interface): Remove the parts about %error-verbose having no effect. (getErrorVerbose, setErrorVerbose): Document. Move constants for token names to Lexer interface. * data/lalr1.java (Lexer): Move EOF, b4_token_enums(b4_tokens) here. * data/java.m4 (b4_token_enum): Indent for move to Lexer interface. (parse): Qualify EOF to Lexer.EOF. * doc/bison.texinfo (Java Parser Interface): Move documentation of EOF and token names to Java Lexer Interface. * tests/java.at (_AT_DATA_JAVA_CALC_Y): Remove Calc qualifier. Make yyerror public. * data/lalr1.java (Lexer.yyerror): Use longer parameter name. (yyerror): Change to public. Add Javadoc comments. Use longer parameter names. Make the body rather than the declarator conditional on %locations. * doc/bison.texinfo (yyerror): Document. Don't mark as protected. Allow user to add code to the constructor with %code init. * data/java.m4 (b4_init_throws): New, for %define init_throws. * data/lalr1.java (YYParser.YYParser): Add b4_init_throws. Add %code init to the front of the constructor body. * doc/bison.texinfo (YYParser.YYParser): Document %code init and %define init_throws. (Java Declarations Summary): Document %code init and %define init_throws. * tests/java.at (Java %parse-param and %lex-param): Adjust grep. (Java constructor init and init_throws): Add tests.
Diffstat (limited to 'data/java.m4')
-rw-r--r--data/java.m425
1 files changed, 14 insertions, 11 deletions
diff --git a/data/java.m4 b/data/java.m4
index b3dbd3b3..9c2835d8 100644
--- a/data/java.m4
+++ b/data/java.m4
@@ -125,8 +125,8 @@ m4_define([b4_null], [null])
# ---------------------------------------
# Output the definition of this token as an enum.
m4_define([b4_token_enum],
-[ /** Token number, to be returned by the scanner. */
- public static final int $1 = $2;
+[ /** Token number, to be returned by the scanner. */
+ static final int $1 = $2;
])
@@ -154,24 +154,27 @@ m4_define([b4_case], [ case $1:
## ---------------- ##
m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
-b4_percent_define_default([[stype]], [[Object]])])
+b4_percent_define_default([[stype]], [[Object]])
# %name-prefix
m4_define_default([b4_prefix], [[YY]])
-b4_percent_define_default([[parser_class_name]], [b4_prefix[]Parser])])
+b4_percent_define_default([[parser_class_name]], [b4_prefix[]Parser])
m4_define([b4_parser_class_name], [b4_percent_define_get([[parser_class_name]])])
-b4_percent_define_default([[lex_throws]], [[java.io.IOException]])])
+b4_percent_define_default([[lex_throws]], [[java.io.IOException]])
m4_define([b4_lex_throws], [b4_percent_define_get([[lex_throws]])])
-b4_percent_define_default([[throws]], [])])
+b4_percent_define_default([[throws]], [])
m4_define([b4_throws], [b4_percent_define_get([[throws]])])
-b4_percent_define_default([[location_type]], [Location])])
+b4_percent_define_default([[init_throws]], [])
+m4_define([b4_init_throws], [b4_percent_define_get([[init_throws]])])
+
+b4_percent_define_default([[location_type]], [Location])
m4_define([b4_location_type], [b4_percent_define_get([[location_type]])])
-b4_percent_define_default([[position_type]], [Position])])
+b4_percent_define_default([[position_type]], [Position])
m4_define([b4_position_type], [b4_percent_define_get([[position_type]])])
@@ -218,9 +221,9 @@ m4_define([b4_rhs_location],
# it to be single quoted. Same for b4_parse_param.
# TODO: should be in bison.m4
-m4_define_default([b4_lex_param], [[]]))
-m4_define([b4_lex_param], b4_lex_param))
-m4_define([b4_parse_param], b4_parse_param))
+m4_define_default([b4_lex_param], [[]])
+m4_define([b4_lex_param], b4_lex_param)
+m4_define([b4_parse_param], b4_parse_param)
# b4_lex_param_decl
# -------------------