mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-24 03:33:03 +00:00
* src/print.h: New file.
Propagate its use. * src/print.c: Formatting and ordering changes. (verbose, terse): Replace with... (print_results): this new function. Adjust dependencies.
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,3 +1,13 @@
|
|||||||
|
2000-10-02 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* src/print.h: New file.
|
||||||
|
Propagate its use.
|
||||||
|
* src/print.c: Formatting and ordering changes.
|
||||||
|
(verbose, terse): Replace with...
|
||||||
|
(print_results): this new function.
|
||||||
|
Adjust dependencies.
|
||||||
|
|
||||||
|
|
||||||
2000-10-02 Akim Demaille <akim@epita.fr>
|
2000-10-02 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* src/conflicts.c (conflict_report): New function.
|
* src/conflicts.c (conflict_report): New function.
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ noinst_HEADERS = alloc.h closure.h complain.h conflicts.h \
|
|||||||
derives.h \
|
derives.h \
|
||||||
files.h getargs.h gram.h lalr.h lex.h nullable.h \
|
files.h getargs.h gram.h lalr.h lex.h nullable.h \
|
||||||
output.h state.h \
|
output.h state.h \
|
||||||
reader.h reduce.h symtab.h system.h types.h
|
print.h reader.h reduce.h symtab.h system.h types.h
|
||||||
|
|
||||||
data_DATA = bison.simple bison.hairy
|
data_DATA = bison.simple bison.hairy
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,6 @@ extern int nolinesflag; /* for -l */
|
|||||||
extern int noparserflag; /* for -n */
|
extern int noparserflag; /* for -n */
|
||||||
extern int rawtoknumflag; /* for -r */
|
extern int rawtoknumflag; /* for -r */
|
||||||
extern int toknumflag; /* for -k */
|
extern int toknumflag; /* for -k */
|
||||||
extern int verboseflag; /* for -v */
|
extern int verboseflag; /* for -v */
|
||||||
|
|
||||||
void getargs PARAMS ((int argc, char *argv[]));
|
void getargs PARAMS ((int argc, char *argv[]));
|
||||||
|
|||||||
11
src/main.c
11
src/main.c
@@ -30,6 +30,7 @@
|
|||||||
#include "lalr.h"
|
#include "lalr.h"
|
||||||
#include "reduce.h"
|
#include "reduce.h"
|
||||||
#include "nullable.h"
|
#include "nullable.h"
|
||||||
|
#include "print.h"
|
||||||
|
|
||||||
#if 0 /* XXX currently unused. */
|
#if 0 /* XXX currently unused. */
|
||||||
/* Nonzero means failure has been detected; don't write a parser file. */
|
/* Nonzero means failure has been detected; don't write a parser file. */
|
||||||
@@ -46,8 +47,6 @@ extern char *printable_version PARAMS ((int));
|
|||||||
extern void generate_states PARAMS ((void));
|
extern void generate_states PARAMS ((void));
|
||||||
extern void initialize_conflicts PARAMS ((void));
|
extern void initialize_conflicts PARAMS ((void));
|
||||||
extern void finalize_conflicts PARAMS ((void));
|
extern void finalize_conflicts PARAMS ((void));
|
||||||
extern void verbose PARAMS ((void));
|
|
||||||
extern void terse PARAMS ((void));
|
|
||||||
|
|
||||||
|
|
||||||
/* VMS complained about using `int'. */
|
/* VMS complained about using `int'. */
|
||||||
@@ -96,12 +95,8 @@ main (int argc, char *argv[])
|
|||||||
declarations. */
|
declarations. */
|
||||||
initialize_conflicts ();
|
initialize_conflicts ();
|
||||||
|
|
||||||
/* Print information about results, if requested. In file print.
|
/* Print information about results, if requested. */
|
||||||
*/
|
print_results ();
|
||||||
if (verboseflag)
|
|
||||||
verbose ();
|
|
||||||
else
|
|
||||||
terse ();
|
|
||||||
|
|
||||||
/* Output the tables and the parser to ftable. In file output. */
|
/* Output the tables and the parser to ftable. In file output. */
|
||||||
output ();
|
output ();
|
||||||
|
|||||||
83
src/print.c
83
src/print.c
@@ -26,47 +26,13 @@
|
|||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "lalr.h"
|
#include "lalr.h"
|
||||||
#include "conflicts.h"
|
#include "conflicts.h"
|
||||||
|
#include "getargs.h"
|
||||||
|
#include "state.h"
|
||||||
|
|
||||||
extern char **tags;
|
extern char **tags;
|
||||||
extern int nstates;
|
|
||||||
extern int final_state;
|
extern int final_state;
|
||||||
|
|
||||||
extern void terse PARAMS ((void));
|
#if 0
|
||||||
extern void verbose PARAMS ((void));
|
|
||||||
|
|
||||||
#if 0 /* XXX currently unused. */
|
|
||||||
static void print_token PARAMS ((int, int));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void print_state PARAMS ((int));
|
|
||||||
static void print_core PARAMS ((int));
|
|
||||||
static void print_actions PARAMS ((int));
|
|
||||||
static void print_grammar PARAMS ((void));
|
|
||||||
|
|
||||||
void
|
|
||||||
terse (void)
|
|
||||||
{
|
|
||||||
if (any_conflicts)
|
|
||||||
print_conflicts ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
verbose (void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (any_conflicts)
|
|
||||||
print_conflicts ();
|
|
||||||
|
|
||||||
print_grammar ();
|
|
||||||
|
|
||||||
for (i = 0; i < nstates; i++)
|
|
||||||
print_state (i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#if 0 /* XXX currently unused. */
|
|
||||||
static void
|
static void
|
||||||
print_token (int extnum, int token)
|
print_token (int extnum, int token)
|
||||||
{
|
{
|
||||||
@@ -74,15 +40,10 @@ print_token (int extnum, int token)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void
|
/*================================\
|
||||||
print_state (int state)
|
| Report information on a state. |
|
||||||
{
|
\================================*/
|
||||||
fprintf (foutput, _("\n\nstate %d\n\n"), state);
|
|
||||||
print_core (state);
|
|
||||||
print_actions (state);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_core (int state)
|
print_core (int state)
|
||||||
@@ -130,7 +91,6 @@ print_core (int state)
|
|||||||
putc ('\n', foutput);
|
putc ('\n', foutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_actions (int state)
|
print_actions (int state)
|
||||||
{
|
{
|
||||||
@@ -232,6 +192,18 @@ print_actions (int state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_state (int state)
|
||||||
|
{
|
||||||
|
fprintf (foutput, _("\n\nstate %d\n\n"), state);
|
||||||
|
print_core (state);
|
||||||
|
print_actions (state);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------.
|
||||||
|
| Print information on the whole grammar. |
|
||||||
|
`-----------------------------------------*/
|
||||||
|
|
||||||
#define END_TEST(end) \
|
#define END_TEST(end) \
|
||||||
do { \
|
do { \
|
||||||
if (column + strlen(buffer) > (end)) { \
|
if (column + strlen(buffer) > (end)) { \
|
||||||
@@ -241,6 +213,7 @@ print_actions (int state)
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_grammar (void)
|
print_grammar (void)
|
||||||
{
|
{
|
||||||
@@ -370,3 +343,19 @@ print_grammar (void)
|
|||||||
fprintf (foutput, "%s\n", buffer);
|
fprintf (foutput, "%s\n", buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
print_results (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (any_conflicts)
|
||||||
|
print_conflicts ();
|
||||||
|
|
||||||
|
if (verboseflag)
|
||||||
|
print_grammar ();
|
||||||
|
|
||||||
|
if (verboseflag)
|
||||||
|
for (i = 0; i < nstates; i++)
|
||||||
|
print_state (i);
|
||||||
|
}
|
||||||
|
|||||||
26
src/print.h
Normal file
26
src/print.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/* Print information on generated parser, for bison,
|
||||||
|
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
Bison is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
Bison is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with Bison; see the file COPYING. If not, write to
|
||||||
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifndef PRINT_H_
|
||||||
|
# define PRINT_H_
|
||||||
|
|
||||||
|
void print_results PARAMS ((void));
|
||||||
|
|
||||||
|
#endif /* !PRINT_H_ */
|
||||||
Reference in New Issue
Block a user