summaryrefslogtreecommitdiffstats
path: root/usr.bin/yacc/mkpar.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>1999-07-29 08:42:21 +0000
committerobrien <obrien@FreeBSD.org>1999-07-29 08:42:21 +0000
commitd7c5d95faa4a761ee09f697104220c6d7429f997 (patch)
tree48460efc5aa4c1ba532ff1bcc470373797fc420d /usr.bin/yacc/mkpar.c
parente4a8f9d4dac4c656c9ca45bc47f036855a14d08d (diff)
downloadFreeBSD-src-d7c5d95faa4a761ee09f697104220c6d7429f997.zip
FreeBSD-src-d7c5d95faa4a761ee09f697104220c6d7429f997.tar.gz
Add support for Bison's "%expect <int>" directive.
I originally coded this myself, and now I realize {Net,Open}BSD had already coded this. I have tossed my version to reduce diffs between the projects. Obtained from: OpenBSD 2.5
Diffstat (limited to 'usr.bin/yacc/mkpar.c')
-rw-r--r--usr.bin/yacc/mkpar.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/usr.bin/yacc/mkpar.c b/usr.bin/yacc/mkpar.c
index b6ef27d..ad44c4c 100644
--- a/usr.bin/yacc/mkpar.c
+++ b/usr.bin/yacc/mkpar.c
@@ -39,13 +39,14 @@
static char const sccsid[] = "@(#)mkpar.c 5.3 (Berkeley) 1/20/91";
#endif
static const char rcsid[] =
- "$Id: mkpar.c,v 1.7 1997/08/28 06:33:53 charnier Exp $";
+ "$Id: mkpar.c,v 1.8 1999/07/04 17:26:16 billf Exp $";
#endif /* not lint */
#include <stdlib.h>
#include "defs.h"
action **parser;
+int SRexpect;
int SRtotal;
int RRtotal;
short *SRconflicts;
@@ -333,10 +334,14 @@ remove_conflicts()
static void
total_conflicts()
{
- if (SRtotal == 1)
- warnx("1 shift/reduce conflict");
- else if (SRtotal > 1)
- warnx("%d shift/reduce conflicts", SRtotal);
+ /* Warn if s/r != expect or if any r/r */
+ if ((SRtotal != SRexpect) || RRtotal)
+ {
+ if (SRtotal == 1)
+ warnx("1 shift/reduce conflict");
+ else if (SRtotal > 1)
+ warnx("%d shift/reduce conflicts", SRtotal);
+ }
if (RRtotal == 1)
warnx("1 reduce/reduce conflict");
OpenPOWER on IntegriCloud