mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 16:53:02 +00:00
Use b4_symbol for printers and destructors everywhere.
* data/bison.m4 (b4_symbol_action_location): New. * data/c.m4 (b4_symbol_actions): Remove. Adjust all callers to use by b4_symbol_foreach and the corresponding b4_symbol_printer/destructor macro. * data/glr.cc: Adjust. * data/lalr1.java: Adjust the %destructor sanity check. * src/output.c (symbol_code_props_output): Remove, we no longer need the b4_symbol_printers/destructors tables.
This commit is contained in:
12
ChangeLog
12
ChangeLog
@@ -1,3 +1,15 @@
|
|||||||
|
2008-12-01 Akim Demaille <demaille@gostai.com>
|
||||||
|
|
||||||
|
Use b4_symbol for printers and destructors everywhere.
|
||||||
|
* data/bison.m4 (b4_symbol_action_location): New.
|
||||||
|
* data/c.m4 (b4_symbol_actions): Remove.
|
||||||
|
Adjust all callers to use by b4_symbol_foreach and the corresponding
|
||||||
|
b4_symbol_printer/destructor macro.
|
||||||
|
* data/glr.cc: Adjust.
|
||||||
|
* data/lalr1.java: Adjust the %destructor sanity check.
|
||||||
|
* src/output.c (symbol_code_props_output): Remove, we no longer
|
||||||
|
need the b4_symbol_printers/destructors tables.
|
||||||
|
|
||||||
2008-12-01 Akim Demaille <demaille@gostai.com>
|
2008-12-01 Akim Demaille <demaille@gostai.com>
|
||||||
|
|
||||||
Use b4_symbol_case_.
|
Use b4_symbol_case_.
|
||||||
|
|||||||
@@ -373,6 +373,13 @@ m4_define([b4_symbol_if],
|
|||||||
[m4_fatal([$0: field $2 of $1 is not a Boolean:] b4_symbol([$1], [$2]))])])
|
[m4_fatal([$0: field $2 of $1 is not a Boolean:] b4_symbol([$1], [$2]))])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_symbol_action_location(SYMBOL-NUM, KIND)
|
||||||
|
# -------------------------------------------
|
||||||
|
# Report the location of the KIND action as FILE:LINE.
|
||||||
|
m4_define([b4_symbol_action_location],
|
||||||
|
[b4_symbol([$1], [$2_file]):b4_syncline([b4_symbol([$1], [$2_line])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_action(SYMBOL-NUM, KIND)
|
# b4_symbol_action(SYMBOL-NUM, KIND)
|
||||||
# ----------------------------------
|
# ----------------------------------
|
||||||
# Run the action KIND (destructor or printer) for SYMBOL-NUM.
|
# Run the action KIND (destructor or printer) for SYMBOL-NUM.
|
||||||
|
|||||||
23
data/c.m4
23
data/c.m4
@@ -404,23 +404,6 @@ $2
|
|||||||
b4_syncline([@oline@], [@ofile@])
|
b4_syncline([@oline@], [@ofile@])
|
||||||
break;])
|
break;])
|
||||||
|
|
||||||
# b4_symbol_actions(FILENAME, LINENO,
|
|
||||||
# SYMBOL-TAG, SYMBOL-NUM,
|
|
||||||
# SYMBOL-ACTION, SYMBOL-TYPENAME)
|
|
||||||
# -------------------------------------------------
|
|
||||||
m4_define([b4_symbol_actions],
|
|
||||||
[m4_pushdef([b4_dollar_dollar],
|
|
||||||
[b4_symbol_value([(*yyvaluep)], [$6])])dnl
|
|
||||||
m4_pushdef([b4_at_dollar], [(*yylocationp)])dnl
|
|
||||||
case $4: /* $3 */
|
|
||||||
b4_syncline([$2], [$1])
|
|
||||||
$5;
|
|
||||||
b4_syncline([@oline@], [@ofile@])
|
|
||||||
break;
|
|
||||||
m4_popdef([b4_at_dollar])dnl
|
|
||||||
m4_popdef([b4_dollar_dollar])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_yydestruct_generate(FUNCTION-DECLARATOR)
|
# b4_yydestruct_generate(FUNCTION-DECLARATOR)
|
||||||
# -------------------------------------------
|
# -------------------------------------------
|
||||||
@@ -452,8 +435,8 @@ b4_parse_param_use[]dnl
|
|||||||
|
|
||||||
switch (yytype)
|
switch (yytype)
|
||||||
{
|
{
|
||||||
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_destructors]))[
|
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
||||||
default:
|
[ default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}]dnl
|
}]dnl
|
||||||
@@ -493,7 +476,7 @@ b4_parse_param_use[]dnl
|
|||||||
# endif
|
# endif
|
||||||
switch (yytype)
|
switch (yytype)
|
||||||
{
|
{
|
||||||
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
|
]b4_symbol_foreach([b4_symbol_printer])dnl
|
||||||
[ default:
|
[ default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
YYUSE (yylocationp);
|
YYUSE (yylocationp);
|
||||||
switch (yytype)
|
switch (yytype)
|
||||||
{
|
{
|
||||||
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
|
]b4_symbol_foreach([b4_symbol_printer])dnl
|
||||||
[ default:
|
[ default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,15 +17,20 @@
|
|||||||
|
|
||||||
m4_include(b4_pkgdatadir/[java.m4])
|
m4_include(b4_pkgdatadir/[java.m4])
|
||||||
|
|
||||||
b4_defines_if([b4_fatal([%s: %%defines does not make sense in Java], [b4_skeleton])])
|
b4_defines_if([b4_fatal([%s: %%defines does not make sense in Java],
|
||||||
m4_ifval(m4_defn([b4_symbol_destructors]),
|
[b4_skeleton])])
|
||||||
[b4_fatal([%s: %%destructor does not make sense in Java], [b4_skeleton])],
|
|
||||||
[])
|
m4_define([b4_symbol_no_destructor_assert],
|
||||||
|
[b4_symbol_if([$1], [has_destructor],
|
||||||
|
[b4_fatal([%s: %s: %%destructor does not make sense in Java],
|
||||||
|
[b4_skeleton],
|
||||||
|
[b4_symbol_action_location([$1], [destructor])])])])
|
||||||
|
b4_symbol_foreach([b4_symbol_no_destructor_assert])
|
||||||
|
|
||||||
m4_divert_push(0)dnl
|
m4_divert_push(0)dnl
|
||||||
@output(b4_parser_file_name@)@
|
@output(b4_parser_file_name@)@
|
||||||
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
||||||
[2007, 2008])
|
[2007, 2008])
|
||||||
|
|
||||||
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
|
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
|
||||||
])[/* First part of user declarations. */
|
])[/* First part of user declarations. */
|
||||||
|
|||||||
41
src/output.c
41
src/output.c
@@ -504,45 +504,6 @@ token_definitions_output (FILE *out)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------.
|
|
||||||
| Output the symbol destructors or printers to OUT. |
|
|
||||||
`---------------------------------------------------*/
|
|
||||||
|
|
||||||
static void
|
|
||||||
symbol_code_props_output (FILE *out, char const *what,
|
|
||||||
code_props const *(*get)(symbol const *))
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
char const *sep = "";
|
|
||||||
|
|
||||||
fputs ("m4_define([b4_symbol_", out);
|
|
||||||
fputs (what, out);
|
|
||||||
fputs ("], \n[", out);
|
|
||||||
for (i = 0; i < nsyms; ++i)
|
|
||||||
{
|
|
||||||
symbol *sym = symbols[i];
|
|
||||||
char const *code = (*get) (sym)->code;
|
|
||||||
if (code)
|
|
||||||
{
|
|
||||||
location loc = (*get) (sym)->location;
|
|
||||||
/* Filename, lineno,
|
|
||||||
Symbol-name, Symbol-number,
|
|
||||||
code, optional typename. */
|
|
||||||
fprintf (out, "%s[", sep);
|
|
||||||
sep = ",\n";
|
|
||||||
escaped_output (out, loc.start.file);
|
|
||||||
fprintf (out, ", %d, ", loc.start.line);
|
|
||||||
escaped_output (out, sym->tag);
|
|
||||||
fprintf (out, ", %d, [[%s]]", sym->number, code);
|
|
||||||
if (sym->type_name)
|
|
||||||
fprintf (out, ", [[%s]]", sym->type_name);
|
|
||||||
fputc (']', out);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fputs ("])\n\n", out);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
prepare_actions (void)
|
prepare_actions (void)
|
||||||
{
|
{
|
||||||
@@ -600,8 +561,6 @@ muscles_output (FILE *out)
|
|||||||
{
|
{
|
||||||
fputs ("m4_init()\n", out);
|
fputs ("m4_init()\n", out);
|
||||||
merger_output (out);
|
merger_output (out);
|
||||||
symbol_code_props_output (out, "destructors", &symbol_destructor_get);
|
|
||||||
symbol_code_props_output (out, "printers", &symbol_printer_get);
|
|
||||||
symbol_numbers_output (out);
|
symbol_numbers_output (out);
|
||||||
token_definitions_output (out);
|
token_definitions_output (out);
|
||||||
type_names_output (out);
|
type_names_output (out);
|
||||||
|
|||||||
Reference in New Issue
Block a user