summaryrefslogtreecommitdiff
path: root/usr.bin/yacc
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-03-27 19:33:22 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-03-27 19:33:22 +0000
commitb4d055c56d56b705a9874806044897b6f933a892 (patch)
treeea6944e4424f24dce67f9a7422a498a2e3e97486 /usr.bin/yacc
parentd413353d829242c97addbbe6aace0c12d53c4772 (diff)
From NetBSD: merge of 960317
Diffstat (limited to 'usr.bin/yacc')
-rw-r--r--usr.bin/yacc/defs.h2
-rw-r--r--usr.bin/yacc/reader.c73
-rw-r--r--usr.bin/yacc/skeleton.c4
3 files changed, 28 insertions, 51 deletions
diff --git a/usr.bin/yacc/defs.h b/usr.bin/yacc/defs.h
index 4772d37c490..440f820ba8f 100644
--- a/usr.bin/yacc/defs.h
+++ b/usr.bin/yacc/defs.h
@@ -1,4 +1,4 @@
-/* $Id: defs.h,v 1.2 1996/02/04 08:37:00 etheisen Exp $ */
+/* $OpenBSD: defs.h,v 1.3 1996/03/27 19:33:18 niklas Exp $ */
#include <assert.h>
#include <ctype.h>
diff --git a/usr.bin/yacc/reader.c b/usr.bin/yacc/reader.c
index f4c0de4df35..e3367fa6569 100644
--- a/usr.bin/yacc/reader.c
+++ b/usr.bin/yacc/reader.c
@@ -1,5 +1,7 @@
+/* $OpenBSD: reader.c,v 1.3 1996/03/27 19:33:19 niklas Exp $ */
+
#ifndef lint
-static char rcsid[] = "$Id: reader.c,v 1.2 1996/02/04 08:37:02 etheisen Exp $";
+static char rcsid[] = "$OpenBSD: reader.c,v 1.3 1996/03/27 19:33:19 niklas Exp $";
#endif /* not lint */
#include "defs.h"
@@ -892,50 +894,6 @@ int assoc;
}
-/*
- * %expect requires special handling
- * as it really isn't part of the yacc
- * grammar only a flag for yacc proper.
- */
-declare_expect(assoc)
-int assoc;
-{
- register int c;
-
- if (assoc != EXPECT) ++prec;
-
- /*
- * Stay away from nextc - doesn't
- * detect EOL and will read to EOF.
- */
- c = *++cptr;
- if (c == EOF) unexpected_EOF();
-
- for(;;)
- {
- if (isdigit(c))
- {
- SRexpect = get_number();
- break;
- }
- /*
- * Looking for number before EOL.
- * Spaces, tabs, and numbers are ok,
- * words, punc., etc. are syntax errors.
- */
- else if (c == '\n' || isalpha(c) || !isspace(c))
- {
- syntax_error(lineno, line, cptr);
- }
- else
- {
- c = *++cptr;
- if (c == EOF) unexpected_EOF();
- }
- }
-}
-
-
declare_types()
{
register int c;
@@ -981,6 +939,23 @@ declare_start()
goal = bp;
}
+handle_expect()
+{
+ register int c;
+ register int num;
+
+ c = nextc();
+ if (c == EOF) unexpected_EOF();
+ if (!isdigit(c))
+ syntax_error(lineno, line, cptr);
+ num = get_number();
+ if (num == 1)
+ fprintf (stderr, "%s: Expect 1 shift/reduce conflict.\n", myname);
+ else
+ fprintf (stderr, "%s: Expect %d shift/reduce conflicts.\n", myname,
+ num);
+}
+
read_declarations()
{
@@ -1019,10 +994,6 @@ read_declarations()
declare_tokens(k);
break;
- case EXPECT:
- declare_expect(k);
- break;
-
case TYPE:
declare_types();
break;
@@ -1030,6 +1001,10 @@ read_declarations()
case START:
declare_start();
break;
+
+ case EXPECT:
+ handle_expect();
+ break;
}
}
}
diff --git a/usr.bin/yacc/skeleton.c b/usr.bin/yacc/skeleton.c
index 387f0437c92..7fa773f16a1 100644
--- a/usr.bin/yacc/skeleton.c
+++ b/usr.bin/yacc/skeleton.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: skeleton.c,v 1.3 1996/03/27 19:33:21 niklas Exp $ */
+
#include "defs.h"
/* The definition of yysccsid in the banner should be replaced with */
@@ -16,7 +18,7 @@ char *banner[] =
{
"#ifndef lint",
"/*static char yysccsid[] = \"from: @(#)yaccpar 1.9 (Berkeley) 02/21/93\";*/",
- "static char yyrcsid[] = \"$Id: skeleton.c,v 1.2 1995/12/22 01:41:55 niklas Exp $\";",
+ "static char yyrcsid[] = \"$OpenBSD: skeleton.c,v 1.3 1996/03/27 19:33:21 niklas Exp $\";",
"#endif",
"#define YYBYACC 1",
"#define YYMAJOR 1",