Hello,

Some old versions of Yacc (such as the NextStep Yacc) severely limit  
YYMAXDEPTH (sometimes setting it as low as 150 by default).  Bison, on the  
other hand, sets this value to 10000, by default.  This old Yacc limitation  
causes parsing of some standard Ruby files, such as date/format.rb, to fail.   
Among other problems, this limitation manifests by causing "make test" to  
fail.  Here is a patch which corrects the problem when an old Yacc is  
detected.

Eric

---- ChangeLog ----
Tue Dec  2 06:18:48 2003  Eric Sunshine <sunshine / sunshineco.com>

	* configure.in (AC_PROG_YACC): AC_DEFINE(OLD_YACC) if Yacc is found
	  instead of Bison or byacc.

	* parse.y: If OLD_YACC is defined, ensure that YYMAXDEPTH is at least
	  10000 (Bison's default) since some old versions of Yacc define it as
	  low as 150 by default, which is too low for Ruby to parse some files,
	  such as date/format.rb.  Among other issues, the parse problem causes
	  "make test" to fail.
---- ChangeLog ----


diff -u -d -b -w -r1.201 configure.in
--- configure.in	30 Nov 2003 14:47:55 -0000	1.201
+++ configure.in	2 Dec 2003 11:14:56 -0000
@@ -157,6 +157,10 @@
 RUBY_MINGW32

 AC_PROG_YACC
+if test "$YACC" = "yacc"; then
+  AC_DEFINE([OLD_YACC])
+fi
+
 AC_CHECK_TOOL(RANLIB, ranlib, :)
 AC_CHECK_TOOL(AR, ar)
 if test -z "$AR"; then
diff -u -d -b -w -r1.303 parse.y
--- parse.y	24 Nov 2003 22:31:19 -0000	1.303
+++ parse.y	2 Dec 2003 11:15:06 -0000
@@ -177,6 +177,15 @@
 #define nd_paren(node) (char)((node)->u2.id >> CHAR_BIT*2)
 #define nd_nest u3.id

+/* Older versions of Yacc set YYMAXDEPTH to a very low value by default (150,
+   for instance).  This is too low for Ruby to parse some files, such as
+   date/format.rb, therefore bump the value up to at least Bison's default. */
+#ifdef OLD_YACC
+#ifndef YYMAXDEPTH
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
 %}

 %union {