X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/11707b2b48fb781ff0e7fd3befdfb02f787a76e4..dc450175c0cfc153b228ad503eefe65a039b46c0:/data/java.m4 diff --git a/data/java.m4 b/data/java.m4 index 9872505a..6636bd69 100644 --- a/data/java.m4 +++ b/data/java.m4 @@ -2,7 +2,7 @@ # Java language support for Bison -# Copyright (C) 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -117,11 +117,13 @@ m4_define([b4_int_type_for], m4_define([b4_null], [null]) -# b4_typed_parser_table(TYPE, NAME, DATA) -# --------------------------------------- -m4_define([b4_typed_parser_table], -[[private static final ]$1[ $2[] = $2init(); - private static final ]$1[[] $2init() +# b4_typed_parser_table_define(TYPE, NAME, DATA, COMMENT) +# ------------------------------------------------------- +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() { return new ]$1[[] { @@ -130,10 +132,10 @@ m4_define([b4_typed_parser_table], }]]) -# b4_integral_parser_table(NAME, DATA) -#------------------------------------- -m4_define([b4_integral_parser_table], -[b4_typed_parser_table([b4_int_type_for([$2])], [$1], [$2])]) +# b4_integral_parser_table_define(NAME, DATA, COMMENT) +#----------------------------------------------------- +m4_define([b4_integral_parser_table_define], +[b4_typed_parser_table_define([b4_int_type_for([$2])], [$1], [$2], [$3])]) ## ------------------------- ## @@ -145,7 +147,7 @@ m4_define([b4_integral_parser_table], # Output the definition of this token as an enum. m4_define([b4_token_enum], [ /** Token number, to be returned by the scanner. */ - static final int $1 = $2; + static final int b4_percent_define_get([token.prefix])$1 = $2; ]) @@ -245,7 +247,7 @@ m4_define([b4_lex_param], b4_lex_param) m4_define([b4_parse_param], b4_parse_param) # b4_lex_param_decl -# ------------------- +# ----------------- # Extra formal arguments of the constructor. m4_define([b4_lex_param_decl], [m4_ifset([b4_lex_param], @@ -273,7 +275,7 @@ m4_define([b4_parse_param_decl], # b4_lex_param_call -# ------------------- +# ----------------- # Delegating the lexer parameters to the lexer constructor. m4_define([b4_lex_param_call], [m4_ifset([b4_lex_param],