Prepare the convergence bw C style and Java table generation.

* data/bison.m4 (b4_tables_map, b4_tables_declare)
	(b4_tables_define): Rename as...
	(b4_integral_parser_tables_map, b4_parser_tables_declare)
	(b4_parser_tables_define): these.
	* data/c.m4 (b4_table_define): Rename as...
	(b4_integral_parser_table_define): this.
	* data/lalr1.cc: Adjust.
	(b4_table_define, b4_table_declare): Rename as...
	(b4_integral_parser_table_define)
	(b4_integral_parser_table_declare): these.
	(yyrline_): Move the comment where it is actually used.
	* data/yacc.c: Adjust.
	(yyrline): Use b4_integral_parser_table_define.
This commit is contained in:
Akim Demaille
2008-11-25 21:38:45 +01:00
parent d12f8e4940
commit ba206cf40a
5 changed files with 43 additions and 29 deletions

View File

@@ -1,3 +1,20 @@
2008-11-26 Akim Demaille <demaille@gostai.com>
Prepare the convergence bw C style and Java table generation.
* data/bison.m4 (b4_tables_map, b4_tables_declare)
(b4_tables_define): Rename as...
(b4_integral_parser_tables_map, b4_parser_tables_declare)
(b4_parser_tables_define): these.
* data/c.m4 (b4_table_define): Rename as...
(b4_integral_parser_table_define): this.
* data/lalr1.cc: Adjust.
(b4_table_define, b4_table_declare): Rename as...
(b4_integral_parser_table_define)
(b4_integral_parser_table_declare): these.
(yyrline_): Move the comment where it is actually used.
* data/yacc.c: Adjust.
(yyrline): Use b4_integral_parser_table_define.
2008-11-26 Akim Demaille <demaille@gostai.com> 2008-11-26 Akim Demaille <demaille@gostai.com>
Regen. Regen.

View File

@@ -245,11 +245,11 @@ m4_define([_b4_args],
# b4_tables_map(MACRO) # b4_integral_parser_tables_map(MACRO)
# -------------------- # -------------------------------------
# Map MACRO on all the integral tables. MACRO is expected to have # Map MACRO on all the integral tables. MACRO is expected to have
# the signature MACRO(TABLE-NAME, CONTENT, COMMENT). # the signature MACRO(TABLE-NAME, CONTENT, COMMENT).
m4_define([b4_tables_map], m4_define([b4_integral_parser_tables_map],
[$1([pact], [b4_pact], [$1([pact], [b4_pact],
[[YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing [[YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM.]]) STATE-NUM.]])
@@ -283,15 +283,15 @@ $1([r2], [b4_r2],
]) ])
# b4_tables_declare # b4_parser_tables_declare
# b4_tables_define # b4_parser_tables_define
# ----------------- # ------------------------
# Define/declare the (deterministic) parser tables. # Define/declare the (deterministic) parser tables.
m4_define([b4_tables_declare], m4_define([b4_parser_tables_declare],
[b4_tables_map([b4_table_declare])]) [b4_integral_parser_tables_map([b4_integral_parser_table_declare])])
m4_define([b4_tables_define], m4_define([b4_parser_tables_define],
[b4_tables_map([b4_table_define])]) [b4_integral_parser_tables_map([b4_integral_parser_table_define])])

View File

@@ -169,10 +169,10 @@ m4_define([b4_int_type_for],
m4_define([b4_null], [0]) m4_define([b4_null], [0])
# b4_table_define(TABLE-NAME, CONTENT, COMMENT) # b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
# --------------------------------------------- # -------------------------------------------------------------
# Define "yy<TABLE-NAME>" which contents is CONTENT. # Define "yy<TABLE-NAME>" which contents is CONTENT.
m4_define([b4_table_define], m4_define([b4_integral_parser_table_define],
[m4_ifval([$3], [b4_c_comment([$3], [ ]) [m4_ifval([$3], [b4_c_comment([$3], [ ])
])dnl ])dnl
static const b4_int_type_for([$2]) yy$1[[]] = static const b4_int_type_for([$2]) yy$1[[]] =

View File

@@ -19,19 +19,19 @@
m4_include(b4_pkgdatadir/[c++.m4]) m4_include(b4_pkgdatadir/[c++.m4])
# b4_table_declare(TABLE-NAME, CONTENT, COMMENT) # b4_integral_parser_table_declare(TABLE-NAME, CONTENT, COMMENT)
# ---------------------------------------------- # --------------------------------------------------------------
# Declare "parser::yy<TABLE-NAME>_" which contents is CONTENT. # Declare "parser::yy<TABLE-NAME>_" which contents is CONTENT.
m4_define([b4_table_declare], m4_define([b4_integral_parser_table_declare],
[m4_ifval([$3], [b4_c_comment([$3], [ ]) [m4_ifval([$3], [b4_c_comment([$3], [ ])
])dnl ])dnl
static const b4_int_type_for([$2]) yy$1_[[]];dnl static const b4_int_type_for([$2]) yy$1_[[]];dnl
]) ])
# b4_table_define(TABLE-NAME, CONTENT, COMMENT) # b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
# --------------------------------------------- # ---------------------------------------------
# Define "parser::yy<TABLE-NAME>_" which contents is CONTENT. # Define "parser::yy<TABLE-NAME>_" which contents is CONTENT.
m4_define([b4_table_define], m4_define([b4_integral_parser_table_define],
[ const b4_int_type_for([$2]) [ const b4_int_type_for([$2])
b4_parser_class_name::yy$1_[[]] = b4_parser_class_name::yy$1_[[]] =
{ {
@@ -676,7 +676,7 @@ m4_ifdef([b4_stype],
static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ yytable_ninf_; static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ yytable_ninf_;
/* Tables. */ /* Tables. */
]b4_tables_declare[ ]b4_parser_tables_declare[
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/// For a symbol, its name in clear. /// For a symbol, its name in clear.
@@ -687,7 +687,8 @@ m4_ifdef([b4_stype],
static std::string yytnamerr_ (const char *n);])[ static std::string yytnamerr_ (const char *n);])[
#if YYDEBUG #if YYDEBUG
]b4_table_declare([rline], [b4_rline])[ ]b4_integral_parser_table_declare([rline], [b4_rline],
[YYRLINE[YYN] -- Source line where rule number YYN was defined.])[
/// Report on the debug stream that the rule \a r is going to be reduced. /// Report on the debug stream that the rule \a r is going to be reduced.
virtual void yy_reduce_print_ (int r); virtual void yy_reduce_print_ (int r);
/// Print the state stack on the debug stream. /// Print the state stack on the debug stream.
@@ -1499,7 +1500,7 @@ b4_error_verbose_if([int yystate, int yytoken],
const ]b4_int_type(b4_table_ninf, b4_table_ninf) b4_parser_class_name::yytable_ninf_ = b4_table_ninf[; const ]b4_int_type(b4_table_ninf, b4_table_ninf) b4_parser_class_name::yytable_ninf_ = b4_table_ninf[;
]b4_tables_define[ ]b4_parser_tables_define[
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
@@ -1512,8 +1513,7 @@ b4_error_verbose_if([int yystate, int yytoken],
#endif #endif
#if YYDEBUG #if YYDEBUG
]b4_table_define([rline], [b4_rline], ]b4_integral_parser_table_define([rline], [b4_rline])[
[YYRLINE[YYN] -- Source line where rule number YYN was defined.])[
// Print the state stack on the debug stream. // Print the state stack on the debug stream.
void void

View File

@@ -501,11 +501,8 @@ static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
}; };
#if YYDEBUG #if YYDEBUG
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ ]b4_integral_parser_table_define([rline], [b4_rline],
static const ]b4_int_type_for([b4_rline])[ yyrline[] = [YYRLINE[YYN] -- Source line where rule number YYN was defined.])[
{
]b4_rline[
};
#endif #endif
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
@@ -530,7 +527,7 @@ static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
#define YYTABLE_NINF ]b4_table_ninf[ #define YYTABLE_NINF ]b4_table_ninf[
]b4_tables_define[ ]b4_parser_tables_define[
#define yyerrok (yyerrstatus = 0) #define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY) #define yyclearin (yychar = YYEMPTY)