Commit Graph

50 Commits

Author SHA1 Message Date
bde
b8e4beb151 Fixed breakage of K&R support in rev.1.26. yyparse() was defined as
`int yyparse(;) ; { ... }' in K&R mode.  Getting rid of the second
unwanted semicolon in this made the ifdef tangle more tangled than
before.  Fixed a backwards comment in the tangle.
2000-01-17 02:04:06 +00:00
bde
bfe0406281 Fixed breakage of K&R support in rev.1.8 of output.c: don't generate
#elif.  Cleaned up rev.1.8 a bit more: generate the #include of
<stdio.h> closer to the code that needs it.
2000-01-17 01:51:29 +00:00
kris
e3fff9e0de malloc more space for temp file name
Noticed by:	marcel
2000-01-10 20:26:24 +00:00
kris
6daca88507 Feed mkstemp() some more X's to keep it safe. 2000-01-10 08:54:09 +00:00
obrien
2bb47d8a45 Make "YYPARSE_PARAM" and "YYPARSE_PARAM_TYPE" C++/ANSI-C clean. 1999-10-28 15:18:05 +00:00
obrien
57cd2b1ec0 Allow a user specified parameter to 'yyparse()', in a manner similar to
that used by bison.  The names are consistent with the bison implementation
but this one also allows the type of the parameter to be specified.

For a desired prototype of:

	int yyparse __P((struct yyresult *));

and compile like this:

	yacc -dv grammar.y
	cc -c -DYYPARSE_PARAM_TYPE="struct yyresult *" \
	      -DYYPARSE_PARAM="parm" y.tab.c

and use like this:

	${
	#include "usrtypes.h"
	#include "usrproto.h"
	}$

	%token NUMBER

	%%

	goal : NUMBER
		{
		parm->value = yylval;
		} ;

If YYPARSE_PARAM_TYPE isn't specified then "void *" is the default type.
If YYPARSE_PARAM is not specified then the generated code behaves exactly
as traditional byacc.

PR:		13562
Submitted by:	W Gerald Hicks <wghicks@bellsouth.net>
1999-10-27 17:51:37 +00:00
obrien
87996aca56 Emit YYERRCODE into y.tab.h to help `lex' report scanning errors back to
Yacc.

PR:		13562
Submitted by:	W Gerald Hicks <wghicks@bellsouth.net>
1999-10-27 17:46:41 +00:00
peter
e4b04a2b21 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
obrien
8dda709da4 Revert the past 3 commits to what should have been the rev 1.18 -> rev 1.19
change.  (doesn't anybody read commit logs and look at the diffs?)
1999-07-30 15:05:32 +00:00
des
81599402c2 Hyphens are not legal characters in a C identifier.
Broken by:	hoek
1999-07-30 14:52:23 +00:00
hoek
a42049bd03 Even better fix for last commit: rename rcsid[] to _yacc-parser_rcsid[]
(one always gets these ideas just after the commit).
1999-07-30 13:04:19 +00:00
hoek
470459d8ae Don't output rcsid into the output parser. It may have already been
defined in an input file such as src/bin/sh/arith.y.  #if 0 it out.  I did
not add $Id$ back into the comment header (as removed from last commit).
1999-07-30 12:53:21 +00:00
obrien
0a610358a5 Only output `rcsid' (set to our Id string) into the resulting parser file.
Don't output `sccsid' (set to an anchient UCB Id string) into the parser file.

Submitted by:	bde
1999-07-30 06:40:00 +00:00
obrien
b68f30f062 Follow the directions in the comments and add our Id string to the output
file.
1999-07-29 09:59:06 +00:00
obrien
596e3f565c Check that user supplied the required argument; and if not, show usage().
Obtained from:	OpenBSD
1999-07-29 09:47:33 +00:00
obrien
5917e51054 * Don't assume realloc() can take NULL as first arg. Yacc needs to
generate portable code...
* Correctly define yyparse() (ie, K&R vs. C++/ANSI-C)

Obtained from:	OpenBSD revs 1.5 & 1.10
1999-07-29 09:42:14 +00:00
obrien
16bac6026c YYRECOVERING(), not YYRECOVERING.
Obtained from:	OpenBSD rev 1.8 (approved by Robert Corbett)
1999-07-29 08:47:30 +00:00
obrien
2277698a5c 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
1999-07-29 08:42:21 +00:00
hoek
bba2661a9e Regenerate to match changes made in the embedded yacc parser. 1999-07-23 23:13:44 +00:00
hoek
200a9c3217 Regenerate this file. This fixes a y2k bogon. As an unintentional side-effect,
it also fixes that fact that this file badly needed to be regenerated due
to changes in yacc.

Not done by: pst (in misc/1380)
Almost done by: danny (in ftp.y)
1999-07-23 23:10:34 +00:00
billf
251664b7db Clean up some ambiguous nested if/elses. 1999-07-04 17:26:16 +00:00
peter
09399dc41e Clean up the skeleton code a little. There was a #ifdef to avoid
stdlib.h unless on C++.  However, we already included it above, so there
was no point using the redundant declarations instead.
1999-04-18 13:37:49 +00:00
danny
f719fbe423 "19%02", tm.year -> "%d", tm.year+1900 1999-01-18 22:42:05 +00:00
imp
51d799dda0 Use mkstemp rather than mktemp for yacc's temp files. This change was made
to OpenBSD a long time ago and to my tree shortly thereafter.  I think theo
made this change, or one similar to it, but I could be wrong.
1998-06-09 04:20:51 +00:00
jb
ca61421aeb Add #include <string.h> to get prototypes. 1998-02-20 04:33:03 +00:00
charnier
16a280858c Use err(3). Rewrote man page in mdoc format. The user visible change is that
report of s/r and r/r conflicts is now printed in two separate lines beginning
by `yacc: '.
1997-08-28 06:33:53 +00:00
steve
1c9a7f8dc7 Add back the description of the -o option.
Threatened PR by: Tim Vanderhoek :)
1997-05-14 02:33:08 +00:00
steve
2da1f57d27 #include <stdlib.h> in the C++ case and declare getenv and realloc
in the C case so that we don't have to depend on stdlib.h being
present.

Submitted by:	Bruce Evans <bde@freefall.freebsd.org>
1997-04-29 03:07:45 +00:00
steve
493e1746a1 Keep style consistent.
Submitted by:	Bruce Evans <bde@freefall.freebsd.org>
1997-04-29 03:05:38 +00:00
steve
d358ae3bdc Fix problems using -Wwrite-strings and -Wcast-qual with yacc generated
parsers.  Closes PR #2792.

Submitted by:	Tim Vanderhoek
1997-04-28 03:36:13 +00:00
jmg
68a3846d7e `appears'' -> `appeared'' (closes PR#3393, Submitted-by: Josh Gilliam)
add missing Id's
other minor clean ups
1997-04-27 08:45:46 +00:00
bde
a44fe1dc23 Don't generate invalid C++ code (for implicit conversion from `void *' in
assignment).
1997-03-22 01:48:17 +00:00
peter
aef78d145b Revert $FreeBSD$ to $Id$ 1997-02-22 19:58:13 +00:00
steve
2ce5c63dca Implement the -o commandline switch. This does almost exactly
what bison does with -o, except it DTRT with respect to naming
the .code file when the -r switch is also used.

Submitted by: bde
1997-02-16 01:50:25 +00:00
jkh
9c0cd3f9df Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
steve
611706a1af Add RCS id's since these files have left the default branch. 1997-01-12 21:29:55 +00:00
steve
7c124206db This doesn't change any functionality, it simple makes yacc(1)
compile -Wall clean.
1997-01-12 21:16:25 +00:00
steve
a26e6a8607 Revert the '-o output_file_name' option changes. 1997-01-12 04:04:52 +00:00
steve
7206c5f238 Merge Lite2 mods. 1997-01-06 03:07:20 +00:00
steve
3e12b8a0fb Implement and document a '-o output_file_name' option to
allow the generated code to be written to a file other
than the default, y.tab.c.

Inspired by: bde and brian@mediacity.com
1997-01-06 02:05:28 +00:00
hsu
9c3e5c6e68 Add YYLEX and YYEMPTY macros to make byacc look more like bison.
Obtained from:  Cygnus source tree, with permission.
		Original commit by Jim Wilson, wilson@cygnus.com.
1996-11-04 21:54:52 +00:00
steve
8ee9912ed0 Fix for PR# 1427, yacc-generated parser generates warnings
with -Wall.  Tim's work with some minor additions by me.

Submitted by:	Tim Vanderhoek <hoek@freenet.hamilton.on.ca>
1996-09-22 02:05:53 +00:00
peter
c74938b0af Fix -Wall warning in skeleton parser 1996-09-03 10:56:32 +00:00
joerg
54be563bba Make the yacc skeleton aware of C++. It was previously broken in the
YYDEBUG case (getenv() declared wrong).
1996-09-03 08:00:26 +00:00
peter
d52fdbeeb9 Install yacc with a link as byacc (and the man page). Some gnu autoconf
scripts that check for features/fixes in bison also check for byacc and
dont find it unless there is a 'byacc' in the path.
1996-01-08 09:20:16 +00:00
phk
c5936719a5 Make all the tables "const" so that they don't clutter our data-segment. 1996-01-07 22:30:13 +00:00
bde
8a5789682c Change install' to ${INSTALL}' so that default install flags can be
specified in the top level Makefiles.
1995-07-25 00:37:58 +00:00
rgrimes
79e59e9123 Remove trailing whitespace. 1995-05-30 06:41:30 +00:00
jkh
e063628f6d Fix man extents from .0 to .1
Submitted by:	jkh
1994-08-11 01:42:28 +00:00
rgrimes
f9ab90d9d6 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00