diff options
author | Michael Leibowitz <michael.leibowitz@intel.com> | 2013-08-15 15:02:54 -0700 |
---|---|---|
committer | Michael Leibowitz <michael.leibowitz@intel.com> | 2013-08-15 15:02:54 -0700 |
commit | 6b0e2a11aeccf2ebc707c22548a0c15c8c2bae06 (patch) | |
tree | d9d59f4b502927634d32832e963db76629ff5a2e /ext | |
parent | 3b35de2a90e26b99e2a6d4f61dc56d6ce7ded748 (diff) | |
download | ruby-6b0e2a11aeccf2ebc707c22548a0c15c8c2bae06.tar.gz ruby-6b0e2a11aeccf2ebc707c22548a0c15c8c2bae06.tar.bz2 ruby-6b0e2a11aeccf2ebc707c22548a0c15c8c2bae06.zip |
Imported Upstream version 1.9.3.p448upstream/1.9.3.p448upstream
Diffstat (limited to 'ext')
63 files changed, 1953 insertions, 2360 deletions
diff --git a/ext/-test-/add_suffix/bug.c b/ext/-test-/add_suffix/bug.c deleted file mode 100644 index 3dc1201..0000000 --- a/ext/-test-/add_suffix/bug.c +++ /dev/null @@ -1,32 +0,0 @@ -static unsigned long ruby_scan_oct(); -static unsigned long ruby_scan_hex(); -static unsigned long ruby_strtoul(); -static void ruby_qsort(); -static char *ruby_strdup(); -static char *ruby_getcwd(); -static double ruby_strtod(); -static char *ruby_dtoa(); -static void ruby_each_words(); -static char *ruby_hdtoa(); -#include "ruby.h" -#include "ruby/defines.h" -#include "ruby/util.h" -#ifndef HAVE_RUBY_ADD_SUFFIX -#define _WIN32 1 -#include "util.c" -#endif - -static VALUE -add_suffix(VALUE self, VALUE path, VALUE suffix) -{ - StringValueCStr(path); - ruby_add_suffix(path, StringValueCStr(suffix)); - return path; -} - -void -Init_bug(void) -{ - VALUE mBug = rb_define_module("Bug"); - rb_define_module_function(mBug, "add_suffix", add_suffix, 2); -} diff --git a/ext/-test-/add_suffix/depend b/ext/-test-/add_suffix/depend deleted file mode 100644 index 943d0d9..0000000 --- a/ext/-test-/add_suffix/depend +++ /dev/null @@ -1 +0,0 @@ -bug.o: $(hdrdir)/ruby/util.h $(top_srcdir)/util.c diff --git a/ext/-test-/add_suffix/extconf.rb b/ext/-test-/add_suffix/extconf.rb deleted file mode 100644 index bffd155..0000000 --- a/ext/-test-/add_suffix/extconf.rb +++ /dev/null @@ -1,4 +0,0 @@ -unless have_func("ruby_add_suffix", "ruby/util.h") - $INCFLAGS << " -I$(top_srcdir)" -end -create_makefile("-test-/add_suffix/bug") diff --git a/ext/-test-/win32/dln/extconf.rb b/ext/-test-/win32/dln/extconf.rb index cc94a67..0b5089a 100644 --- a/ext/-test-/win32/dln/extconf.rb +++ b/ext/-test-/win32/dln/extconf.rb @@ -1,12 +1,14 @@ if $mingw or $mswin $objs = ["dlntest.o"] - $cleanfiles << "$(topdir)/dlntest.dll" + testdll = "$(topdir)/dlntest.dll" + $cleanfiles << testdll config_string('cleanobjs') {|t| $cleanfiles.concat(t.gsub(/\$\*/, 'dlntest').split)} create_makefile("-test-/win32/dln") m = File.read("Makefile") dlntestlib = "dlntest.#{$LIBEXT}" m.sub!(/^OBJS =.*/) {"#{$&} #{dlntestlib}"} + FileUtils.rm_f(RbConfig.expand(testdll.dup)) open("Makefile", "wb") do |mf| mf.puts m, "\n" sodir = $extout ? "$(RUBYARCHDIR)/" : '' diff --git a/ext/-test-/win32/fd_setsize/depend b/ext/-test-/win32/fd_setsize/depend new file mode 100644 index 0000000..4936d6b --- /dev/null +++ b/ext/-test-/win32/fd_setsize/depend @@ -0,0 +1,2 @@ +fd_setsize.o: $(top_srcdir)/win32/win32.c \ + $(hdrdir)/ruby/ruby.h diff --git a/ext/-test-/win32/fd_setsize/extconf.rb b/ext/-test-/win32/fd_setsize/extconf.rb new file mode 100644 index 0000000..ed40f8b --- /dev/null +++ b/ext/-test-/win32/fd_setsize/extconf.rb @@ -0,0 +1,3 @@ +if $mingw or $mswin + create_makefile("-test-/win32/fd_setsize") +end diff --git a/ext/-test-/win32/fd_setsize/fd_setsize.c b/ext/-test-/win32/fd_setsize/fd_setsize.c new file mode 100644 index 0000000..8da8b1e --- /dev/null +++ b/ext/-test-/win32/fd_setsize/fd_setsize.c @@ -0,0 +1,55 @@ +#undef FD_SETSIZE +/* redefine smaller size then default 64 */ +#define FD_SETSIZE 32 +#include <ruby.h> + +static VALUE +test_select(VALUE self) +{ + int sd = socket(AF_INET, SOCK_DGRAM, 0); + struct timeval zero; + fd_set read; + fd_set write; + fd_set error; + + zero.tv_sec = 0; + zero.tv_usec = 0; + + FD_ZERO(&read); + FD_ZERO(&write); + FD_ZERO(&error); + + FD_SET(sd, &read); + FD_SET(sd, &write); + FD_SET(sd, &error); + + select(sd+1, &read, &write, &error, &zero); + + return Qtrue; +} + +static VALUE +test_fdset(VALUE self) +{ + int i; + fd_set set; + + FD_ZERO(&set); + + for (i = 0; i < FD_SETSIZE * 2; i++) { + int sd = socket(AF_INET, SOCK_DGRAM, 0); + FD_SET(sd, &set); + if (set.fd_count > FD_SETSIZE) { + return Qfalse; + } + } + return Qtrue; +} + +void +Init_fd_setsize(void) +{ + VALUE m = rb_define_module_under(rb_define_module("Bug"), "Win32"); + rb_define_module_function(m, "test_select", test_select, 0); + rb_define_module_function(m, "test_fdset", test_fdset, 0); +} diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index 1dc2f15..14f80b1 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -61,7 +61,7 @@ static ID id_eq; /* MACRO's to guard objects from GC by keeping them in stack */ #define ENTER(n) volatile VALUE vStack[n];int iStack=0 -#define PUSH(x) vStack[iStack++] = (unsigned long)(x); +#define PUSH(x) vStack[iStack++] = (VALUE)(x); #define SAVE(p) PUSH(p->obj); #define GUARD_OBJ(p,y) {p=y;SAVE(p);} @@ -660,7 +660,7 @@ BigDecimal_to_i(VALUE self) ret = rb_funcall(numerator, '*', 1, rb_funcall(INT2FIX(10), rb_intern("**"), 1, INT2FIX(dpower))); - if (TYPE(ret) == T_FLOAT) + if (RB_TYPE_P(ret, T_FLOAT)) rb_raise(rb_eFloatDomainError, "Infinity"); return ret; } @@ -768,11 +768,11 @@ BigDecimal_coerce(VALUE self, VALUE other) VALUE obj; Real *b; - if (TYPE(other) == T_FLOAT) { + if (RB_TYPE_P(other, T_FLOAT)) { obj = rb_assoc_new(other, BigDecimal_to_f(self)); } else { - if (TYPE(other) == T_RATIONAL) { + if (RB_TYPE_P(other, T_RATIONAL)) { Real* pv = DATA_PTR(self); GUARD_OBJ(b, GetVpValueWithPrec(other, pv->Prec*VpBaseFig(), 1)); } @@ -808,23 +808,37 @@ BigDecimal_add(VALUE self, VALUE r) ENTER(5); Real *c, *a, *b; size_t mx; - GUARD_OBJ(a,GetVpValue(self,1)); - b = GetVpValue(r,0); - if(!b) return DoSomeOne(self,r,'+'); + + GUARD_OBJ(a, GetVpValue(self, 1)); + if (RB_TYPE_P(r, T_FLOAT)) { + b = GetVpValueWithPrec(r, DBL_DIG+1, 1); + } + else if (RB_TYPE_P(r, T_RATIONAL)) { + b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1); + } + else { + b = GetVpValue(r,0); + } + + if (!b) return DoSomeOne(self,r,'+'); SAVE(b); - if(VpIsNaN(b)) return b->obj; - if(VpIsNaN(a)) return a->obj; - mx = GetAddSubPrec(a,b); + + if (VpIsNaN(b)) return b->obj; + if (VpIsNaN(a)) return a->obj; + + mx = GetAddSubPrec(a, b); if (mx == (size_t)-1L) { - GUARD_OBJ(c,VpCreateRbObject(VpBaseFig() + 1, "0")); - VpAddSub(c, a, b, 1); - } else { - GUARD_OBJ(c,VpCreateRbObject(mx *(VpBaseFig() + 1), "0")); - if(!mx) { - VpSetInf(c,VpGetSign(a)); - } else { - VpAddSub(c, a, b, 1); - } + GUARD_OBJ(c,VpCreateRbObject(VpBaseFig() + 1, "0")); + VpAddSub(c, a, b, 1); + } + else { + GUARD_OBJ(c, VpCreateRbObject(mx * (VpBaseFig() + 1), "0")); + if(!mx) { + VpSetInf(c, VpGetSign(a)); + } + else { + VpAddSub(c, a, b, 1); + } } return ToValue(c); } @@ -848,7 +862,16 @@ BigDecimal_sub(VALUE self, VALUE r) size_t mx; GUARD_OBJ(a,GetVpValue(self,1)); - b = GetVpValue(r,0); + if (RB_TYPE_P(r, T_FLOAT)) { + b = GetVpValueWithPrec(r, DBL_DIG+1, 1); + } + else if (RB_TYPE_P(r, T_RATIONAL)) { + b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1); + } + else { + b = GetVpValue(r,0); + } + if(!b) return DoSomeOne(self,r,'-'); SAVE(b); @@ -1081,7 +1104,16 @@ BigDecimal_mult(VALUE self, VALUE r) size_t mx; GUARD_OBJ(a,GetVpValue(self,1)); - b = GetVpValue(r,0); + if (RB_TYPE_P(r, T_FLOAT)) { + b = GetVpValueWithPrec(r, DBL_DIG+1, 1); + } + else if (RB_TYPE_P(r, T_RATIONAL)) { + b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1); + } + else { + b = GetVpValue(r,0); + } + if(!b) return DoSomeOne(self,r,'*'); SAVE(b); @@ -1100,9 +1132,19 @@ BigDecimal_divide(Real **c, Real **res, Real **div, VALUE self, VALUE r) size_t mx; GUARD_OBJ(a,GetVpValue(self,1)); - b = GetVpValue(r,0); + if (RB_TYPE_P(r, T_FLOAT)) { + b = GetVpValueWithPrec(r, DBL_DIG+1, 1); + } + else if (RB_TYPE_P(r, T_RATIONAL)) { + b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1); + } + else { + b = GetVpValue(r,0); + } + if(!b) return DoSomeOne(self,r,'/'); SAVE(b); + *div = b; mx = a->Prec + vabs(a->exponent); if(mx<b->Prec + vabs(b->exponent)) mx = b->Prec + vabs(b->exponent); @@ -1163,7 +1205,16 @@ BigDecimal_DoDivmod(VALUE self, VALUE r, Real **div, Real **mod) size_t mx; GUARD_OBJ(a,GetVpValue(self,1)); - b = GetVpValue(r,0); + if (RB_TYPE_P(r, T_FLOAT)) { + b = GetVpValueWithPrec(r, DBL_DIG+1, 1); + } + else if (RB_TYPE_P(r, T_RATIONAL)) { + b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1); + } + else { + b = GetVpValue(r,0); + } + if(!b) return Qfalse; SAVE(b); @@ -1253,7 +1304,16 @@ BigDecimal_divremain(VALUE self, VALUE r, Real **dv, Real **rv) Real *f=NULL; GUARD_OBJ(a,GetVpValue(self,1)); - b = GetVpValue(r,0); + if (RB_TYPE_P(r, T_FLOAT)) { + b = GetVpValueWithPrec(r, DBL_DIG+1, 1); + } + else if (RB_TYPE_P(r, T_RATIONAL)) { + b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1); + } + else { + b = GetVpValue(r,0); + } + if(!b) return DoSomeOne(self,r,rb_intern("remainder")); SAVE(b); @@ -1727,8 +1787,8 @@ static VALUE BigDecimal_to_s(int argc, VALUE *argv, VALUE self) { ENTER(5); - int fmt=0; /* 0:E format */ - int fPlus=0; /* =0:default,=1: set ' ' before digits ,set '+' before digits. */ + int fmt = 0; /* 0:E format */ + int fPlus = 0; /* =0:default,=1: set ' ' before digits ,set '+' before digits. */ Real *vp; volatile VALUE str; char *psz; @@ -1738,42 +1798,53 @@ BigDecimal_to_s(int argc, VALUE *argv, VALUE self) GUARD_OBJ(vp,GetVpValue(self,1)); - if(rb_scan_args(argc,argv,"01",&f)==1) { - if(TYPE(f)==T_STRING) { - SafeStringValue(f); - psz = RSTRING_PTR(f); - if(*psz==' ') { - fPlus = 1; psz++; - } else if(*psz=='+') { - fPlus = 2; psz++; - } - while((ch=*psz++)!=0) { - if(ISSPACE(ch)) continue; - if(!ISDIGIT(ch)) { - if(ch=='F' || ch=='f') fmt = 1; /* F format */ - break; - } - mc = mc * 10 + ch - '0'; - } - } + if (rb_scan_args(argc,argv,"01",&f)==1) { + if (RB_TYPE_P(f, T_STRING)) { + SafeStringValue(f); + psz = RSTRING_PTR(f); + if (*psz == ' ') { + fPlus = 1; + psz++; + } + else if (*psz == '+') { + fPlus = 2; + psz++; + } + while ((ch = *psz++) != 0) { + if (ISSPACE(ch)) { + continue; + } + if (!ISDIGIT(ch)) { + if (ch == 'F' || ch == 'f') { + fmt = 1; /* F format */ + } + break; + } + mc = mc * 10 + ch - '0'; + } + } else { - mc = (size_t)GetPositiveInt(f); - } + mc = (size_t)GetPositiveInt(f); + } } - if(fmt) { - nc = VpNumOfChars(vp,"F"); - } else { - nc = VpNumOfChars(vp,"E"); + if (fmt) { + nc = VpNumOfChars(vp, "F"); + } + else { + nc = VpNumOfChars(vp, "E"); + } + if (mc > 0) { + nc += (nc + mc - 1) / mc + 1; } - if(mc>0) nc += (nc + mc - 1) / mc + 1; str = rb_str_new(0, nc); psz = RSTRING_PTR(str); - if(fmt) { - VpToFString(vp, psz, mc, fPlus); - } else { - VpToString (vp, psz, mc, fPlus); + if (fmt) { + VpToFString(vp, psz, mc, fPlus); + } + else { + VpToString (vp, psz, mc, fPlus); } rb_str_resize(str, strlen(psz)); return str; @@ -1890,7 +1961,7 @@ static VALUE BigMath_s_log(VALUE, VALUE, VALUE); inline static int is_integer(VALUE x) { - return (TYPE(x) == T_FIXNUM || TYPE(x) == T_BIGNUM); + return (RB_TYPE_P(x, T_FIXNUM) || RB_TYPE_P(x, T_BIGNUM)); } inline static int @@ -1899,10 +1970,10 @@ is_negative(VALUE x) if (FIXNUM_P(x)) { return FIX2LONG(x) < 0; } - else if (TYPE(x) == T_BIGNUM) { + else if (RB_TYPE_P(x, T_BIGNUM)) { return RBIGNUM_NEGATIVE_P(x); } - else if (TYPE(x) == T_FLOAT) { + else if (RB_TYPE_P(x, T_FLOAT)) { return RFLOAT_VALUE(x) < 0.0; } return RTEST(rb_funcall(x, '<', 1, INT2FIX(0))); @@ -2161,7 +2232,7 @@ retry: if (exp != NULL) { return rmpd_power_by_big_decimal(x, exp, n); } - else if (TYPE(vexp) == T_BIGNUM) { + else if (RB_TYPE_P(vexp, T_BIGNUM)) { VALUE abs_value = BigDecimal_abs(self); if (is_one(abs_value)) { return ToValue(VpCreateRbObject(n, "1")); @@ -2557,7 +2628,7 @@ BigMath_s_log(VALUE klass, VALUE x, VALUE vprec) double flo; long fix; - if (TYPE(vprec) != T_FIXNUM && TYPE(vprec) != T_BIGNUM) { + if (!is_integer(vprec)) { rb_raise(rb_eArgError, "precision must be an Integer"); } @@ -2802,6 +2873,10 @@ Init_bigdecimal(void) { VALUE arg; + id_BigDecimal_exception_mode = rb_intern_const("BigDecimal.exception_mode"); + id_BigDecimal_rounding_mode = rb_intern_const("BigDecimal.rounding_mode"); + id_BigDecimal_precision_limit = rb_intern_const("BigDecimal.precision_limit"); + /* Initialize VP routines */ VpInit(0UL); @@ -2993,10 +3068,6 @@ Init_bigdecimal(void) rb_define_singleton_method(rb_mBigMath, "exp", BigMath_s_exp, 2); rb_define_singleton_method(rb_mBigMath, "log", BigMath_s_log, 2); - id_BigDecimal_exception_mode = rb_intern_const("BigDecimal.exception_mode"); - id_BigDecimal_rounding_mode = rb_intern_const("BigDecimal.rounding_mode"); - id_BigDecimal_precision_limit = rb_intern_const("BigDecimal.precision_limit"); - id_up = rb_intern_const("up"); id_down = rb_intern_const("down"); id_truncate = rb_intern_const("truncate"); diff --git a/ext/curses/extconf.rb b/ext/curses/extconf.rb index 4172c8a..a1a1613 100644 --- a/ext/curses/extconf.rb +++ b/ext/curses/extconf.rb @@ -16,7 +16,7 @@ elsif have_header(*curses=%w"ncurses/curses.h") and have_library("ncurses", "ini elsif have_header(*curses=%w"curses_colr/curses.h") and have_library("cur_colr", "initscr") curses.unshift("varargs.h") make=true -elsif have_header(*curses=%w"curses.h") and have_library("curses", "initscr") +elsif have_header(*curses=%w"curses.h") and (have_library("curses", "initscr") || have_library("pdcurses", "initscr")) make=true end diff --git a/ext/date/date_core.c b/ext/date/date_core.c index c22a9d4..4048d13 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -7864,7 +7864,7 @@ datetime_s_now(int argc, VALUE *argv, VALUE klass) of = tm.tm_gmtoff; #elif defined(HAVE_VAR_TIMEZONE) #ifdef HAVE_VAR_ALTZONE - of = (long)((tm.tm_isdst > 0) ? altzone : timezone); + of = (long)-((tm.tm_isdst > 0) ? altzone : timezone); #else of = (long)-timezone; if (tm.tm_isdst) { diff --git a/ext/digest/md5/extconf.rb b/ext/digest/md5/extconf.rb index 15646ef..4ed9701 100644 --- a/ext/digest/md5/extconf.rb +++ b/ext/digest/md5/extconf.rb @@ -1,5 +1,5 @@ # $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $ -# $Id: extconf.rb 25189 2009-10-02 12:04:37Z akr $ +# $Id: extconf.rb 35653 2012-05-15 16:10:46Z tenderlove $ require "mkmf" @@ -9,6 +9,7 @@ $INCFLAGS << " -I$(srcdir)/.." $objs = [ "md5init.#{$OBJEXT}" ] dir_config("openssl") +pkg_config("openssl") if !with_config("bundled-md5") && have_library("crypto") && have_header("openssl/md5.h") diff --git a/ext/digest/rmd160/extconf.rb b/ext/digest/rmd160/extconf.rb index f005271..9a18184 100644 --- a/ext/digest/rmd160/extconf.rb +++ b/ext/digest/rmd160/extconf.rb @@ -1,5 +1,5 @@ # $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $ -# $Id: extconf.rb 25189 2009-10-02 12:04:37Z akr $ +# $Id: extconf.rb 35653 2012-05-15 16:10:46Z tenderlove $ require "mkmf" @@ -9,6 +9,7 @@ $INCFLAGS << " -I$(srcdir)/.." $objs = [ "rmd160init.#{$OBJEXT}" ] dir_config("openssl") +pkg_config("openssl") if !with_config("bundled-rmd160") && have_library("crypto") && have_header("openssl/ripemd.h") diff --git a/ext/digest/sha1/extconf.rb b/ext/digest/sha1/extconf.rb index 1a51cd9..b7b38bc 100644 --- a/ext/digest/sha1/extconf.rb +++ b/ext/digest/sha1/extconf.rb @@ -1,5 +1,5 @@ # $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $ -# $Id: extconf.rb 25189 2009-10-02 12:04:37Z akr $ +# $Id: extconf.rb 35653 2012-05-15 16:10:46Z tenderlove $ require "mkmf" @@ -9,6 +9,7 @@ $INCFLAGS << " -I$(srcdir)/.." $objs = [ "sha1init.#{$OBJEXT}" ] dir_config("openssl") +pkg_config("openssl") if !with_config("bundled-sha1") && have_library("crypto") && have_header("openssl/sha.h") diff --git a/ext/digest/sha2/extconf.rb b/ext/digest/sha2/extconf.rb index e1306c0..95109c8 100644 --- a/ext/digest/sha2/extconf.rb +++ b/ext/digest/sha2/extconf.rb @@ -1,5 +1,5 @@ # $RoughId: extconf.rb,v 1.4 2001/08/14 19:54:51 knu Exp $ -# $Id: extconf.rb 27433 2010-04-21 12:25:29Z akr $ +# $Id: extconf.rb 35653 2012-05-15 16:10:46Z tenderlove $ require "mkmf" @@ -9,6 +9,7 @@ $INCFLAGS << " -I$(srcdir)/.." $objs = [ "sha2init.#{$OBJEXT}" ] dir_config("openssl") +pkg_config("openssl") if !with_config("bundled-sha2") && have_library("crypto") && diff --git a/ext/dl/cfunc.c b/ext/dl/cfunc.c index 45e019f..0ee0e25 100644 --- a/ext/dl/cfunc.c +++ b/ext/dl/cfunc.c @@ -1,5 +1,5 @@ /* -*- C -*- - * $Id: cfunc.c 34604 2012-02-14 20:09:27Z naruse $ + * $Id: cfunc.c 37007 2012-09-21 10:53:50Z naruse $ */ #include <ruby.h> @@ -324,7 +324,7 @@ rb_dlcfunc_inspect(VALUE self) } -#if defined(_MSC_VER) && defined(_M_AMD64) && _MSC_VER == 1500 +#if defined(_MSC_VER) && defined(_M_AMD64) && _MSC_VER >= 1400 && _MSC_VER < 1600 # pragma optimize("", off) #endif /* @@ -366,7 +366,11 @@ rb_dlcfunc_call(VALUE self, VALUE ary) stack[i] = (DLSTACK_TYPE)FIX2LONG(arg); } else if (RB_TYPE_P(arg, T_BIGNUM)) { +#if SIZEOF_VOIDP == SIZEOF_LONG stack[i] = (DLSTACK_TYPE)rb_big2ulong_pack(arg); +#else + stack[i] = (DLSTACK_TYPE)rb_big2ull(arg); +#endif } else { Check_Type(arg, T_FIXNUM); @@ -594,7 +598,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary) return result; } -#if defined(_MSC_VER) && defined(_M_AMD64) && _MSC_VER == 1500 +#if defined(_MSC_VER) && defined(_M_AMD64) && _MSC_VER >= 1400 && _MSC_VER < 1600 # pragma optimize("", on) #endif diff --git a/ext/dl/lib/dl/func.rb b/ext/dl/lib/dl/func.rb index 3c2245f..9a984ed 100644 --- a/ext/dl/lib/dl/func.rb +++ b/ext/dl/lib/dl/func.rb @@ -11,13 +11,50 @@ module DL include DL include ValueUtil + if DL.fiddle? + # :stopdoc: + CALL_TYPE_TO_ABI = Hash.new { |h, k| + raise RuntimeError, "unsupported call type: #{k}" + }.merge({ :stdcall => + (Fiddle::Function::STDCALL rescue Fiddle::Function::DEFAULT), + :cdecl => Fiddle::Function::DEFAULT, + nil => Fiddle::Function::DEFAULT + }).freeze + private_constant :CALL_TYPE_TO_ABI + # :startdoc: + + def self.call_type_to_abi(call_type) # :nodoc: + CALL_TYPE_TO_ABI[call_type] + end + private_class_method :call_type_to_abi + + class FiddleClosureCFunc < Fiddle::Closure # :nodoc: all + def initialize ctype, arg, abi, name + @name = name + super(ctype, arg, abi) + end + def name + @name + end + def ptr + to_i + end + end + private_constant :FiddleClosureCFunc + + def self.class_fiddle_closure_cfunc # :nodoc: + FiddleClosureCFunc + end + private_class_method :class_fiddle_closure_cfunc + end + def initialize cfunc, argtypes, abi = nil, &block if DL.fiddle? - abi ||= Fiddle::Function::DEFAULT + abi ||= CALL_TYPE_TO_ABI[(cfunc.calltype rescue nil)] if block_given? - @cfunc = Class.new(Fiddle::Closure) { + @cfunc = Class.new(FiddleClosureCFunc) { define_method(:call, block) - }.new(cfunc.ctype, argtypes) + }.new(cfunc.ctype, argtypes, abi, cfunc.name) else @cfunc = cfunc end @@ -55,6 +92,9 @@ module DL super else funcs = [] + if $SAFE >= 1 && args.any? { |x| x.tainted? } + raise SecurityError, "tainted parameter not allowed" + end _args = wrap_args(args, @stack.types, funcs, &block) r = @cfunc.call(@stack.pack(_args)) funcs.each{|f| f.unbind_at_call()} @@ -76,16 +116,18 @@ module DL def bind(&block) if DL.fiddle? - @cfunc = Class.new(Fiddle::Closure) { - def initialize ctype, args, block - super(ctype, args) + @cfunc = Class.new(FiddleClosureCFunc) { + def initialize ctype, args, abi, name, block + super(ctype, args, abi, name) @block = block end def call *args @block.call(*args) end - }.new(@cfunc.ctype, @args, block) + }.new(@cfunc.ctype, @args, abi, name, block) + @ptr = @cfunc + return nil else if( !block ) raise(RuntimeError, "block must be given.") @@ -118,6 +160,25 @@ module DL end def unbind() + if DL.fiddle? then + if @cfunc.kind_of?(Fiddle::Closure) and @cfunc.ptr != 0 then + call_type = case abi + when CALL_TYPE_TO_ABI[nil] + nil + when CALL_TYPE_TO_ABI[:stdcall] + :stdcall + else + raise(RuntimeError, "unsupported abi: #{abi}") + end + @cfunc = CFunc.new(0, @cfunc.ctype, name, call_type) + return 0 + elsif @cfunc.ptr != 0 then + @cfunc.ptr = 0 + return 0 + else + return nil + end + end if( @cfunc.ptr != 0 ) case @cfunc.calltype when :cdecl diff --git a/ext/dl/lib/dl/import.rb b/ext/dl/lib/dl/import.rb index eec65cd..a4fa406 100644 --- a/ext/dl/lib/dl/import.rb +++ b/ext/dl/lib/dl/import.rb @@ -231,11 +231,13 @@ module DL def bind_function(name, ctype, argtype, call_type = nil, &block) if DL.fiddle? - closure = Class.new(Fiddle::Closure) { + klass = Function.instance_eval { class_fiddle_closure_cfunc } + abi = Function.instance_eval { call_type_to_abi(call_type) } + closure = Class.new(klass) { define_method(:call, block) - }.new(ctype, argtype) + }.new(ctype, argtype, abi, name) - Function.new(closure, argtype) + Function.new(closure, argtype, abi) else f = Function.new(CFunc.new(0, ctype, name, call_type || :cdecl), argtype) f.bind(&block) diff --git a/ext/extmk.rb b/ext/extmk.rb index 5665a96..de6e037 100755 --- a/ext/extmk.rb +++ b/ext/extmk.rb @@ -183,6 +183,8 @@ def extmake(target) end rescue SystemExit # ignore + rescue => error + ok = false ensure rm_f "conftest*" config = $0 @@ -194,7 +196,15 @@ def extmake(target) open(makefile, "w") do |f| f.print(*dummy_makefile(CONFIG["srcdir"])) end - print "Failed to configure #{target}. It will not be installed.\n" + + mess = "Failed to configure #{target}. It will not be installed.\n" + if error + mess.prepend(error.to_s + "\n") + end + + Logging::message(mess) + print(mess) + $stdout.flush return true end args = sysquote($mflags) diff --git a/ext/fiddle/closure.c b/ext/fiddle/closure.c index a3c0792..2179666 100644 --- a/ext/fiddle/closure.c +++ b/ext/fiddle/closure.c @@ -284,7 +284,7 @@ Init_fiddle_closure() /* * Document-method: new * - * call-seq: new(ret, *args, abi = Fiddle::DEFAULT) + * call-seq: new(ret, args, abi = Fiddle::DEFAULT) * * Construct a new Closure object. * diff --git a/ext/fiddle/extconf.rb b/ext/fiddle/extconf.rb index 03b0ac2..2cb9ae0 100644 --- a/ext/fiddle/extconf.rb +++ b/ext/fiddle/extconf.rb @@ -9,16 +9,46 @@ unless have_header('ffi.h') if have_header('ffi/ffi.h') $defs.push(format('-DUSE_HEADER_HACKS')) else - abort "ffi.h is missing. Please install libffi." + raise "ffi.h is missing. Please install libffi." end end unless have_library('ffi') || have_library('libffi') - abort "libffi is missing. Please install libffi." + raise "libffi is missing. Please install libffi." end have_header 'sys/mman.h' +if have_header "dlfcn.h" + have_library "dl" + + %w{ dlopen dlclose dlsym }.each do |func| + abort "missing function #{func}" unless have_func(func) + end + + have_func "dlerror" +elsif have_header "windows.h" + %w{ LoadLibrary FreeLibrary GetProcAddress }.each do |func| + abort "missing function #{func}" unless have_func(func) + end +end + +have_const('FFI_STDCALL', 'ffi.h') || have_const('FFI_STDCALL', 'ffi/ffi.h') + +config = File.read(RbConfig.expand(File.join($arch_hdrdir, "ruby/config.h"))) +types = {"SIZE_T"=>"SSIZE_T", "PTRDIFF_T"=>nil, "INTPTR_T"=>nil} +types.each do |type, signed| + if /^\#define\s+SIZEOF_#{type}\s+(SIZEOF_(.+)|\d+)/ =~ config + if size = $2 and size != 'VOIDP' + size = types.fetch(size) {size} + $defs << format("-DTYPE_%s=TYPE_%s", signed||type, size) + end + if signed + check_signedness(type.downcase, "stddef.h") + end + end +end + create_makefile 'fiddle' # :startdoc: diff --git a/ext/fiddle/function.c b/ext/fiddle/function.c index 6e89099..52f7695 100644 --- a/ext/fiddle/function.c +++ b/ext/fiddle/function.c @@ -101,6 +101,15 @@ function_call(int argc, VALUE argv[], VALUE self) TypedData_Get_Struct(self, ffi_cif, &function_data_type, cif); + if (rb_safe_level() >= 1) { + for (i = 0; i < argc; i++) { + VALUE src = argv[i]; + if (OBJ_TAINTED(src)) { + rb_raise(rb_eSecurityError, "tainted parameter not allowed"); + } + } + } + values = xcalloc((size_t)argc + 1, (size_t)sizeof(void *)); generic_args = xcalloc((size_t)argc, (size_t)sizeof(fiddle_generic)); @@ -179,7 +188,7 @@ Init_fiddle_function(void) */ rb_define_const(cFiddleFunction, "DEFAULT", INT2NUM(FFI_DEFAULT_ABI)); -#ifdef FFI_STDCALL +#ifdef HAVE_CONST_FFI_STDCALL /* * Document-const: STDCALL * @@ -203,7 +212,7 @@ Init_fiddle_function(void) /* * Document-method: new - * call-seq: new(ptr, *args, ret_type, abi = DEFAULT) + * call-seq: new(ptr, args, ret_type, abi = DEFAULT) * * Constructs a Function object. * * +ptr+ is a referenced function, of a DL::Handle diff --git a/ext/json/lib/json/add/core.rb b/ext/json/lib/json/add/core.rb index 1ae00d0..01b8e04 100644 --- a/ext/json/lib/json/add/core.rb +++ b/ext/json/lib/json/add/core.rb @@ -36,8 +36,8 @@ class Time if usec = object.delete('u') # used to be tv_usec -> tv_nsec object['n'] = usec * 1000 end - if respond_to?(:tv_nsec) - at(*object.values_at('s', 'n')) + if instance_methods.include?(:tv_nsec) + at(object['s'], Rational(object['n'], 1000)) else at(object['s'], object['n'] / 1000) end @@ -46,10 +46,13 @@ class Time # Returns a hash, that will be turned into a JSON object and represent this # object. def as_json(*) + nanoseconds = [ tv_usec * 1000 ] + respond_to?(:tv_nsec) and nanoseconds << tv_nsec + nanoseconds = nanoseconds.max { JSON.create_id => self.class.name, 's' => tv_sec, - 'n' => respond_to?(:tv_nsec) ? tv_nsec : tv_usec * 1000 + 'n' => nanoseconds, } end diff --git a/ext/json/lib/json/common.rb b/ext/json/lib/json/common.rb index 43e249c..9ad1fab 100644 --- a/ext/json/lib/json/common.rb +++ b/ext/json/lib/json/common.rb @@ -141,7 +141,7 @@ module JSON # the default. # * *create_additions*: If set to false, the Parser doesn't create # additions even if a matching class and create_id was found. This option - # defaults to true. + # defaults to false. # * *object_class*: Defaults to Hash # * *array_class*: Defaults to Array def parse(source, opts = {}) @@ -162,7 +162,7 @@ module JSON # to true. # * *create_additions*: If set to false, the Parser doesn't create # additions even if a matching class and create_id was found. This option - # defaults to true. + # defaults to false. def parse!(source, opts = {}) opts = { :max_nesting => false, @@ -287,11 +287,18 @@ module JSON # Load a ruby data structure from a JSON _source_ and return it. A source can # either be a string-like object, an IO-like object, or an object responding # to the read method. If _proc_ was given, it will be called with any nested - # Ruby object as an argument recursively in depth first order. + # Ruby object as an argument recursively in depth first order. To modify the + # default options pass in the optional _options_ argument as well. # # This method is part of the implementation of the load/dump interface of # Marshal and YAML. - def load(source, proc = nil) + def load(source, proc = nil, options = {}) + load_default_options = { + :max_nesting => false, + :allow_nan => true, + :create_additions => false + } + opts = load_default_options.merge options if source.respond_to? :to_str source = source.to_str elsif source.respond_to? :to_io @@ -299,7 +306,7 @@ module JSON else source = source.read end - result = parse(source, :max_nesting => false, :allow_nan => true) + result = parse(source, opts) recurse_proc(result, &proc) if proc result end diff --git a/ext/json/lib/json/version.rb b/ext/json/lib/json/version.rb index 2175ac0..baacdc9 100644 --- a/ext/json/lib/json/version.rb +++ b/ext/json/lib/json/version.rb @@ -1,6 +1,6 @@ module JSON # JSON version - VERSION = '1.5.4' + VERSION = '1.5.5' VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc: VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc: VERSION_MINOR = VERSION_ARRAY[1] # :nodoc: diff --git a/ext/json/parser/parser.c b/ext/json/parser/parser.c index c0ec9ec..8a321a8 100644 --- a/ext/json/parser/parser.c +++ b/ext/json/parser/parser.c @@ -1676,7 +1676,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self) if (option_given_p(opts, tmp)) { json->create_additions = RTEST(rb_hash_aref(opts, tmp)); } else { - json->create_additions = 1; + json->create_additions = 0; } tmp = ID2SYM(i_create_id); if (option_given_p(opts, tmp)) { @@ -1723,7 +1723,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self) } -#line 1719 "parser.c" +#line 1722 "parser.c" static const int JSON_start = 1; static const int JSON_first_final = 10; static const int JSON_error = 0; @@ -1731,7 +1731,7 @@ static const int JSON_error = 0; static const int JSON_en_main = 1; -#line 726 "parser.rl" +#line 729 "parser.rl" static VALUE cParser_parse_strict(VALUE self) @@ -1742,16 +1742,16 @@ static VALUE cParser_parse_strict(VALUE self) GET_PARSER; -#line 1738 "parser.c" +#line 1741 "parser.c" { cs = JSON_start; } -#line 736 "parser.rl" +#line 739 "parser.rl" p = json->source; pe = p + json->len; -#line 1747 "parser.c" +#line 1750 "parser.c" { if ( p == pe ) goto _test_eof; @@ -1807,7 +1807,7 @@ case 5: goto st1; goto st5; tr3: -#line 715 "parser.rl" +#line 718 "parser.rl" { char *np; json->current_nesting = 1; @@ -1816,7 +1816,7 @@ tr3: } goto st10; tr4: -#line 708 "parser.rl" +#line 711 "parser.rl" { char *np; json->current_nesting = 1; @@ -1828,7 +1828,7 @@ st10: if ( ++p == pe ) goto _test_eof10; case 10: -#line 1824 "parser.c" +#line 1827 "parser.c" switch( (*p) ) { case 13: goto st10; case 32: goto st10; @@ -1885,7 +1885,7 @@ case 9: _out: {} } -#line 739 "parser.rl" +#line 742 "parser.rl" if (cs >= JSON_first_final && p == pe) { return result; @@ -1897,7 +1897,7 @@ case 9: -#line 1893 "parser.c" +#line 1896 "parser.c" static const int JSON_quirks_mode_start = 1; static const int JSON_quirks_mode_first_final = 10; static const int JSON_quirks_mode_error = 0; @@ -1905,7 +1905,7 @@ static const int JSON_quirks_mode_error = 0; static const int JSON_quirks_mode_en_main = 1; -#line 764 "parser.rl" +#line 767 "parser.rl" static VALUE cParser_parse_quirks_mode(VALUE self) @@ -1916,16 +1916,16 @@ static VALUE cParser_parse_quirks_mode(VALUE self) GET_PARSER; -#line 1912 "parser.c" +#line 1915 "parser.c" { cs = JSON_quirks_mode_start; } -#line 774 "parser.rl" +#line 777 "parser.rl" p = json->source; pe = p + json->len; -#line 1921 "parser.c" +#line 1924 "parser.c" { if ( p == pe ) goto _test_eof; @@ -1959,7 +1959,7 @@ st0: cs = 0; goto _out; tr2: -#line 756 "parser.rl" +#line 759 "parser.rl" { char *np = JSON_parse_value(json, p, pe, &result); if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;} @@ -1969,7 +1969,7 @@ st10: if ( ++p == pe ) goto _test_eof10; case 10: -#line 1965 "parser.c" +#line 1968 "parser.c" switch( (*p) ) { case 13: goto st10; case 32: goto st10; @@ -2058,7 +2058,7 @@ case 9: _out: {} } -#line 777 "parser.rl" +#line 780 "parser.rl" if (cs >= JSON_quirks_mode_first_final && p == pe) { return result; diff --git a/ext/json/parser/parser.rl b/ext/json/parser/parser.rl index dcb5d2d..fe6427a 100644 --- a/ext/json/parser/parser.rl +++ b/ext/json/parser/parser.rl @@ -607,6 +607,9 @@ static VALUE convert_encoding(VALUE source) * defaults to true. * * *object_class*: Defaults to Hash * * *array_class*: Defaults to Array + * * *quirks_mode*: Enables quirks_mode for parser, that is for example + * parsing single JSON values instead of documents is possible. + * */ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self) { @@ -657,7 +660,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self) if (option_given_p(opts, tmp)) { json->create_additions = RTEST(rb_hash_aref(opts, tmp)); } else { - json->create_additions = 1; + json->create_additions = 0; } tmp = ID2SYM(i_create_id); if (option_given_p(opts, tmp)) { diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c index 65e0d84..109cfbd 100644 --- a/ext/objspace/objspace.c +++ b/ext/objspace/objspace.c @@ -2,7 +2,7 @@ objspace.c - ObjectSpace extender for MRI. - $Author: ktsj $ + $Author: usa $ created at: Wed Jun 17 07:39:17 2009 NOTE: This extension library is not expected to exist except C Ruby. @@ -531,7 +531,7 @@ count_nodes(int argc, VALUE *argv, VALUE os) COUNT_NODE(NODE_LAMBDA); COUNT_NODE(NODE_OPTBLOCK); #undef COUNT_NODE - default: node = INT2FIX(nodes[i]); + default: node = INT2FIX(i); } rb_hash_aset(hash, node, SIZET2NUM(nodes[i])); } diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb index f515847..bfb1ea4 100644 --- a/ext/openssl/extconf.rb +++ b/ext/openssl/extconf.rb @@ -11,7 +11,7 @@ (See the file 'LICENCE'.) = Version - $Id: extconf.rb 32230 2011-06-26 01:32:03Z emboss $ + $Id: extconf.rb 36929 2012-09-09 06:39:23Z kosaki $ =end require "mkmf" @@ -58,8 +58,7 @@ unless result end unless have_header("openssl/conf_api.h") - message "OpenSSL 0.9.6 or later required.\n" - exit 1 + raise "OpenSSL 0.9.6 or later required." end %w"rb_str_set_len rb_block_call".each {|func| have_func(func, "ruby.h")} diff --git a/ext/openssl/lib/openssl/ssl-internal.rb b/ext/openssl/lib/openssl/ssl-internal.rb index 9c0320c..d750471 100644 --- a/ext/openssl/lib/openssl/ssl-internal.rb +++ b/ext/openssl/lib/openssl/ssl-internal.rb @@ -11,7 +11,7 @@ (See the file 'LICENCE'.) = Version - $Id: ssl-internal.rb 29189 2010-09-06 01:53:00Z nahi $ + $Id: ssl-internal.rb 41673 2013-06-27 11:13:08Z usa $ =end require "openssl/buffering" @@ -88,14 +88,22 @@ module OpenSSL should_verify_common_name = true cert.extensions.each{|ext| next if ext.oid != "subjectAltName" - ext.value.split(/,\s+/).each{|general_name| - if /\ADNS:(.*)/ =~ general_name + id, ostr = OpenSSL::ASN1.decode(ext.to_der).value + sequence = OpenSSL::ASN1.decode(ostr.value) + sequence.value.each{|san| + case san.tag + when 2 # dNSName in GeneralName (RFC5280) should_verify_common_name = false - reg = Regexp.escape($1).gsub(/\\\*/, "[^.]+") + reg = Regexp.escape(san.value).gsub(/\\\*/, "[^.]+") return true if /\A#{reg}\z/i =~ hostname - elsif /\AIP Address:(.*)/ =~ general_name + when 7 # iPAddress in GeneralName (RFC5280) should_verify_common_name = false - return true if $1 == hostname + # follows GENERAL_NAME_print() in x509v3/v3_alt.c + if san.value.size == 4 + return true if san.value.unpack('C*').join('.') == hostname + elsif san.value.size == 16 + return true if san.value.unpack('n*').map { |e| sprintf("%X", e) }.join(':') == hostname + end end } } diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c index 2a50b75..3cc2645 100644 --- a/ext/openssl/ossl_asn1.c +++ b/ext/openssl/ossl_asn1.c @@ -1,5 +1,5 @@ /* - * $Id: ossl_asn1.c 34505 2012-02-09 03:25:07Z nobu $ + * $Id: ossl_asn1.c 39980 2013-03-28 09:19:07Z usa $ * 'OpenSSL for Ruby' team members * Copyright (C) 2003 * All rights reserved. @@ -149,11 +149,16 @@ num_to_asn1integer(VALUE obj, ASN1_INTEGER *ai) ASN1_INTEGER * num_to_asn1integer(VALUE obj, ASN1_INTEGER *ai) { - BIGNUM *bn = GetBNPtr(obj); + BIGNUM *bn; + + if (NIL_P(obj)) + ossl_raise(rb_eTypeError, "Can't convert nil into Integer"); - if (!(ai = BN_to_ASN1_INTEGER(bn, ai))) { + bn = GetBNPtr(obj); + + if (!(ai = BN_to_ASN1_INTEGER(bn, ai))) ossl_raise(eOSSLError, NULL); - } + return ai; } #endif @@ -219,6 +224,9 @@ static ID sivVALUE, sivTAG, sivTAG_CLASS, sivTAGGING, sivINFINITE_LENGTH, sivUNU static ASN1_BOOLEAN obj_to_asn1bool(VALUE obj) { + if (NIL_P(obj)) + ossl_raise(rb_eTypeError, "Can't convert nil into Boolean"); + #if OPENSSL_VERSION_NUMBER < 0x00907000L return RTEST(obj) ? 0xff : 0x100; #else diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c index 855082d..72e9350 100644 --- a/ext/openssl/ossl_ssl.c +++ b/ext/openssl/ossl_ssl.c @@ -1,5 +1,5 @@ /* - * $Id: ossl_ssl.c 34524 2012-02-09 17:04:41Z emboss $ + * $Id: ossl_ssl.c 40717 2013-05-14 02:35:39Z usa $ * 'OpenSSL for Ruby' project * Copyright (C) 2000-2002 GOTOU Yuuzou <gotoyuzo@notwork.org> * Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz> @@ -995,7 +995,6 @@ ossl_ssl_shutdown(SSL *ssl) static void ossl_ssl_free(SSL *ssl) { - ossl_ssl_shutdown(ssl); SSL_free(ssl); } @@ -1405,9 +1404,16 @@ ossl_ssl_close(VALUE self) SSL *ssl; Data_Get_Struct(self, SSL, ssl); - ossl_ssl_shutdown(ssl); - if (RTEST(ossl_ssl_get_sync_close(self))) - rb_funcall(ossl_ssl_get_io(self), rb_intern("close"), 0); + if (ssl) { + VALUE io = ossl_ssl_get_io(self); + if (!RTEST(rb_funcall(io, rb_intern("closed?"), 0))) { + ossl_ssl_shutdown(ssl); + SSL_free(ssl); + DATA_PTR(self) = NULL; + if (RTEST(ossl_ssl_get_sync_close(self))) + rb_funcall(io, rb_intern("close"), 0); + } + } return Qnil; } diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c index e1632c5..e35c19d 100644 --- a/ext/pathname/pathname.c +++ b/ext/pathname/pathname.c @@ -1,4 +1,5 @@ #include "ruby.h" +#include "ruby/encoding.h" static VALUE rb_cPathname; static ID id_at_path, id_to_path; @@ -184,15 +185,15 @@ path_sub_ext(VALUE self, VALUE repl) StringValue(repl); p = RSTRING_PTR(str); - ext = ruby_find_extname(p, &extlen); + extlen = RSTRING_LEN(str); + ext = ruby_enc_find_extname(p, &extlen, rb_enc_get(str)); if (ext == NULL) { ext = p + RSTRING_LEN(str); } else if (extlen <= 1) { ext += extlen; } - str2 = rb_str_dup(str); - rb_str_resize(str2, ext-p); + str2 = rb_str_subseq(str, 0, ext-p); rb_str_append(str2, repl); OBJ_INFECT(str2, str); return rb_class_new_instance(1, &str2, rb_obj_class(self)); diff --git a/ext/psych/emitter.c b/ext/psych/emitter.c index 15fdcfe..f0d0326 100644 --- a/ext/psych/emitter.c +++ b/ext/psych/emitter.c @@ -2,6 +2,9 @@ VALUE cPsychEmitter; static ID id_write; +static ID id_line_width; +static ID id_indentation; +static ID id_canonical; static void emit(yaml_emitter_t * emitter, yaml_event_t * event) { @@ -39,15 +42,30 @@ static VALUE allocate(VALUE klass) return Data_Wrap_Struct(klass, 0, dealloc, emitter); } -/* call-seq: Psych::Emitter.new(io) +/* call-seq: Psych::Emitter.new(io, options = Psych::Emitter::OPTIONS) * * Create a new Psych::Emitter that writes to +io+. */ -static VALUE initialize(VALUE self, VALUE io) +static VALUE initialize(int argc, VALUE *argv, VALUE self) { yaml_emitter_t * emitter; + VALUE io, options; + VALUE line_width; + VALUE indent; + VALUE canonical; + Data_Get_Struct(self, yaml_emitter_t, emitter); + if (rb_scan_args(argc, argv, "11", &io, &options) == 2) { + line_width = rb_funcall(options, id_line_width, 0); + indent = rb_funcall(options, id_indentation, 0); + canonical = rb_funcall(options, id_canonical, 0); + + yaml_emitter_set_width(emitter, NUM2INT(line_width)); + yaml_emitter_set_indent(emitter, NUM2INT(indent)); + yaml_emitter_set_canonical(emitter, Qtrue == canonical ? 1 : 0); + } + yaml_emitter_set_output(emitter, writer, (void *)io); return self; @@ -494,7 +512,7 @@ void Init_psych_emitter() rb_define_alloc_func(cPsychEmitter, allocate); - rb_define_method(cPsychEmitter, "initialize", initialize, 1); + rb_define_method(cPsychEmitter, "initialize", initialize, -1); rb_define_method(cPsychEmitter, "start_stream", start_stream, 1); rb_define_method(cPsychEmitter, "end_stream", end_stream, 0); rb_define_method(cPsychEmitter, "start_document", start_document, 3); @@ -512,6 +530,9 @@ void Init_psych_emitter() rb_define_method(cPsychEmitter, "line_width", line_width, 0); rb_define_method(cPsychEmitter, "line_width=", set_line_width, 1); - id_write = rb_intern("write"); + id_write = rb_intern("write"); + id_line_width = rb_intern("line_width"); + id_indentation = rb_intern("indentation"); + id_canonical = rb_intern("canonical"); } /* vim: set noet sws=4 sw=4: */ diff --git a/ext/psych/extconf.rb b/ext/psych/extconf.rb index 11f44ac..ccc8c9c 100644 --- a/ext/psych/extconf.rb +++ b/ext/psych/extconf.rb @@ -5,7 +5,7 @@ require 'mkmf' dir_config 'libyaml' def asplode missing - abort "#{missing} is missing. Please install libyaml." + raise "#{missing} is missing. Please install libyaml." end asplode('yaml.h') unless find_header 'yaml.h' diff --git a/ext/psych/lib/psych.rb b/ext/psych/lib/psych.rb index 1895be6..19d8b2b 100644 --- a/ext/psych/lib/psych.rb +++ b/ext/psych/lib/psych.rb @@ -93,7 +93,7 @@ require 'psych/handlers/document_stream' module Psych # The version is Psych you're using - VERSION = '1.3.2' + VERSION = '1.3.4' # The version of libyaml Psych is using LIBYAML_VERSION = Psych.libyaml_version.join '.' diff --git a/ext/psych/lib/psych/handler.rb b/ext/psych/lib/psych/handler.rb index a2aa6bb..d3b9963 100644 --- a/ext/psych/lib/psych/handler.rb +++ b/ext/psych/lib/psych/handler.rb @@ -11,6 +11,21 @@ module Psych # See Psych::Parser for more details class Handler ### + # Configuration options for dumping YAML. + class DumperOptions + attr_accessor :line_width, :indentation, :canonical + + def initialize + @line_width = 0 + @indentation = 2 + @canonical = false + end + end + + # Default dumping options + OPTIONS = DumperOptions.new + + ### # Called with +encoding+ when the YAML stream starts. This method is # called once per stream. A stream may contain multiple documents. # diff --git a/ext/psych/lib/psych/json/yaml_events.rb b/ext/psych/lib/psych/json/yaml_events.rb index 01d4660..d054d9b 100644 --- a/ext/psych/lib/psych/json/yaml_events.rb +++ b/ext/psych/lib/psych/json/yaml_events.rb @@ -10,11 +10,11 @@ module Psych end def start_mapping anchor, tag, implicit, style - super(anchor, nil, implicit, Nodes::Mapping::FLOW) + super(anchor, nil, true, Nodes::Mapping::FLOW) end def start_sequence anchor, tag, implicit, style - super(anchor, nil, implicit, Nodes::Sequence::FLOW) + super(anchor, nil, true, Nodes::Sequence::FLOW) end def scalar value, anchor, tag, plain, quoted, style diff --git a/ext/psych/lib/psych/visitors/emitter.rb b/ext/psych/lib/psych/visitors/emitter.rb index 30db176..c886e50 100644 --- a/ext/psych/lib/psych/visitors/emitter.rb +++ b/ext/psych/lib/psych/visitors/emitter.rb @@ -2,10 +2,17 @@ module Psych module Visitors class Emitter < Psych::Visitors::Visitor def initialize io, options = {} - @handler = Psych::Emitter.new io - @handler.indentation = options[:indentation] if options[:indentation] - @handler.canonical = options[:canonical] if options[:canonical] - @handler.line_width = options[:line_width] if options[:line_width] + opts = [:indentation, :canonical, :line_width].find_all { |opt| + options.key?(opt) + } + + if opts.empty? + @handler = Psych::Emitter.new io + else + du = Handler::DumperOptions.new + opts.each { |option| du.send :"#{option}=", options[option] } + @handler = Psych::Emitter.new io, du + end end def visit_Psych_Nodes_Stream o diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb index 2e082f9..088301a 100644 --- a/ext/psych/lib/psych/visitors/to_ruby.rb +++ b/ext/psych/lib/psych/visitors/to_ruby.rb @@ -147,8 +147,8 @@ module Psych string = members.delete 'str' if klass - string = klass.allocate - string.replace string + string = klass.allocate.replace string + register(o, string) end init_with(string, members.map { |k,v| [k.to_s.sub(/^@/, ''),v] }, o) @@ -222,6 +222,13 @@ module Psych when /^!map:(.*)$/, /^!ruby\/hash:(.*)$/ revive_hash resolve_class($1).new, o + when '!omap', 'tag:yaml.org,2002:omap' + map = register(o, Psych::Omap.new) + o.children.each_slice(2) do |l,r| + map[accept(l)] = accept r + end + map + else revive_hash({}, o) end diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb index 80af046..948a976 100644 --- a/ext/psych/lib/psych/visitors/yaml_tree.rb +++ b/ext/psych/lib/psych/visitors/yaml_tree.rb @@ -20,6 +20,7 @@ module Psych @st = {} @ss = ss @options = options + @coders = [] @dispatch_cache = Hash.new do |h,klass| method = "visit_#{(klass.name || '').split('::').join('_')}" @@ -253,7 +254,7 @@ module Psych maptag = '!ruby/string' maptag << ":#{o.class}" unless o.class == ::String - @emitter.start_mapping nil, maptag, false, Nodes::Mapping::BLOCK + register o, @emitter.start_mapping(nil, maptag, false, Nodes::Mapping::BLOCK) @emitter.scalar 'str', nil, nil, true, false, Nodes::Scalar::ANY @emitter.scalar str, nil, tag, plain, quote, style @@ -406,6 +407,7 @@ module Psych end def dump_coder o + @coders << o tag = Psych.dump_tags[o.class] unless tag klass = o.class == Object ? nil : o.class.name diff --git a/ext/psych/parser.c b/ext/psych/parser.c index 6f4c456..0908a1b 100644 --- a/ext/psych/parser.c +++ b/ext/psych/parser.c @@ -79,8 +79,8 @@ static VALUE make_exception(yaml_parser_t * parser, VALUE path) static VALUE transcode_string(VALUE src, int * parser_encoding) { int utf8 = rb_utf8_encindex(); - int utf16le = rb_enc_find_index("UTF16_LE"); - int utf16be = rb_enc_find_index("UTF16_BE"); + int utf16le = rb_enc_find_index("UTF-16LE"); + int utf16be = rb_enc_find_index("UTF-16BE"); int source_encoding = rb_enc_get_index(src); if (source_encoding == utf8) { diff --git a/ext/readline/extconf.rb b/ext/readline/extconf.rb index b8e9e0f..e1c37ce 100644 --- a/ext/readline/extconf.rb +++ b/ext/readline/extconf.rb @@ -40,14 +40,14 @@ when true unless (have_readline_header("editline/readline.h") || have_readline_header("readline/readline.h")) && have_library("edit", "readline") - exit + raise "libedit not found" end when false # --disable-libedit unless ((have_readline_header("readline/readline.h") && have_readline_header("readline/history.h")) && have_library("readline", "readline")) - exit + raise "readline not found" end else # does not specify @@ -57,7 +57,7 @@ else have_library("edit", "readline"))) || (have_readline_header("editline/readline.h") && have_library("edit", "readline")) - exit + raise "readline nor libedit not found" end end diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 6dae5cd..c09bbdd 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -2,13 +2,13 @@ readline.c - GNU Readline module - $Author: nobu $ + $Author: usa $ created at: Wed Jan 20 13:59:32 JST 1999 Copyright (C) 1997-2008 Shugo Maeda Copyright (C) 2008-2009 TAKAO Kouji - $Id: readline.c 34505 2012-02-09 03:25:07Z nobu $ + $Id: readline.c 39377 2013-02-22 05:27:47Z usa $ Contact: - TAKAO Kouji <kouji at takao7 dot net> (current maintainer) @@ -1678,10 +1678,8 @@ Init_readline() rl_attempted_completion_function = readline_attempted_completion_function; #ifdef HAVE_RL_CATCH_SIGNALS rl_catch_signals = 0; -#endif -#ifdef HAVE_RL_CATCH_SIGWINCH - rl_catch_sigwinch = 0; -#endif +#endif + #ifdef HAVE_RL_CLEAR_SIGNALS rl_clear_signals(); #endif diff --git a/ext/ripper/ripper.c b/ext/ripper/ripper.c index 40bd701..6b34695 100644 --- a/ext/ripper/ripper.c +++ b/ext/ripper/ripper.c @@ -1,21 +1,24 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 2.3. */ -/* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program 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 3 of the License, or - (at your option) any later version. - + the Free Software Foundation; either version 2, or (at your option) + any later version. + This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -26,7 +29,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -44,7 +47,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.5" +#define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -52,20 +55,261 @@ /* Pure parsers. */ #define YYPURE 1 -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - /* Using locations. */ #define YYLSP_NEEDED 0 -/* Copy the first part of user declarations. */ +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + keyword_class = 258, + keyword_module = 259, + keyword_def = 260, + keyword_undef = 261, + keyword_begin = 262, + keyword_rescue = 263, + keyword_ensure = 264, + keyword_end = 265, + keyword_if = 266, + keyword_unless = 267, + keyword_then = 268, + keyword_elsif = 269, + keyword_else = 270, + keyword_case = 271, + keyword_when = 272, + keyword_while = 273, + keyword_until = 274, + keyword_for = 275, + keyword_break = 276, + keyword_next = 277, + keyword_redo = 278, + keyword_retry = 279, + keyword_in = 280, + keyword_do = 281, + keyword_do_cond = 282, + keyword_do_block = 283, + keyword_do_LAMBDA = 284, + keyword_return = 285, + keyword_yield = 286, + keyword_super = 287, + keyword_self = 288, + keyword_nil = 289, + keyword_true = 290, + keyword_false = 291, + keyword_and = 292, + keyword_or = 293, + keyword_not = 294, + modifier_if = 295, + modifier_unless = 296, + modifier_while = 297, + modifier_until = 298, + modifier_rescue = 299, + keyword_alias = 300, + keyword_defined = 301, + keyword_BEGIN = 302, + keyword_END = 303, + keyword__LINE__ = 304, + keyword__FILE__ = 305, + keyword__ENCODING__ = 306, + tIDENTIFIER = 307, + tFID = 308, + tGVAR = 309, + tIVAR = 310, + tCONSTANT = 311, + tCVAR = 312, + tLABEL = 313, + tINTEGER = 314, + tFLOAT = 315, + tSTRING_CONTENT = 316, + tCHAR = 317, + tNTH_REF = 318, + tBACK_REF = 319, + tREGEXP_END = 320, + tUPLUS = 321, + tUMINUS = 322, + tPOW = 323, + tCMP = 324, + tEQ = 325, + tEQQ = 326, + tNEQ = 327, + tGEQ = 328, + tLEQ = 329, + tANDOP = 330, + tOROP = 331, + tMATCH = 332, + tNMATCH = 333, + tDOT2 = 334, + tDOT3 = 335, + tAREF = 336, + tASET = 337, + tLSHFT = 338, + tRSHFT = 339, + tCOLON2 = 340, + tCOLON3 = 341, + tOP_ASGN = 342, + tASSOC = 343, + tLPAREN = 344, + tLPAREN_ARG = 345, + tRPAREN = 346, + tLBRACK = 347, + tLBRACE = 348, + tLBRACE_ARG = 349, + tSTAR = 350, + tAMPER = 351, + tLAMBDA = 352, + tSYMBEG = 353, + tSTRING_BEG = 354, + tXSTRING_BEG = 355, + tREGEXP_BEG = 356, + tWORDS_BEG = 357, + tQWORDS_BEG = 358, + tSTRING_DBEG = 359, + tSTRING_DVAR = 360, + tSTRING_END = 361, + tLAMBEG = 362, + tLOWEST = 363, + tUMINUS_NUM = 364, + idNULL = 365, + idRespond_to = 366, + idIFUNC = 367, + idCFUNC = 368, + id_core_set_method_alias = 369, + id_core_set_variable_alias = 370, + id_core_undef_method = 371, + id_core_define_method = 372, + id_core_define_singleton_method = 373, + id_core_set_postexe = 374, + tLAST_TOKEN = 375 + }; +#endif +/* Tokens. */ +#define keyword_class 258 +#define keyword_module 259 +#define keyword_def 260 +#define keyword_undef 261 +#define keyword_begin 262 +#define keyword_rescue 263 +#define keyword_ensure 264 +#define keyword_end 265 +#define keyword_if 266 +#define keyword_unless 267 +#define keyword_then 268 +#define keyword_elsif 269 +#define keyword_else 270 +#define keyword_case 271 +#define keyword_when 272 +#define keyword_while 273 +#define keyword_until 274 +#define keyword_for 275 +#define keyword_break 276 +#define keyword_next 277 +#define keyword_redo 278 +#define keyword_retry 279 +#define keyword_in 280 +#define keyword_do 281 +#define keyword_do_cond 282 +#define keyword_do_block 283 +#define keyword_do_LAMBDA 284 +#define keyword_return 285 +#define keyword_yield 286 +#define keyword_super 287 +#define keyword_self 288 +#define keyword_nil 289 +#define keyword_true 290 +#define keyword_false 291 +#define keyword_and 292 +#define keyword_or 293 +#define keyword_not 294 +#define modifier_if 295 +#define modifier_unless 296 +#define modifier_while 297 +#define modifier_until 298 +#define modifier_rescue 299 +#define keyword_alias 300 +#define keyword_defined 301 +#define keyword_BEGIN 302 +#define keyword_END 303 +#define keyword__LINE__ 304 +#define keyword__FILE__ 305 +#define keyword__ENCODING__ 306 +#define tIDENTIFIER 307 +#define tFID 308 +#define tGVAR 309 +#define tIVAR 310 +#define tCONSTANT 311 +#define tCVAR 312 +#define tLABEL 313 +#define tINTEGER 314 +#define tFLOAT 315 +#define tSTRING_CONTENT 316 +#define tCHAR 317 +#define tNTH_REF 318 +#define tBACK_REF 319 +#define tREGEXP_END 320 +#define tUPLUS 321 +#define tUMINUS 322 +#define tPOW 323 +#define tCMP 324 +#define tEQ 325 +#define tEQQ 326 +#define tNEQ 327 +#define tGEQ 328 +#define tLEQ 329 +#define tANDOP 330 +#define tOROP 331 +#define tMATCH 332 +#define tNMATCH 333 +#define tDOT2 334 +#define tDOT3 335 +#define tAREF 336 +#define tASET 337 +#define tLSHFT 338 +#define tRSHFT 339 +#define tCOLON2 340 +#define tCOLON3 341 +#define tOP_ASGN 342 +#define tASSOC 343 +#define tLPAREN 344 +#define tLPAREN_ARG 345 +#define tRPAREN 346 +#define tLBRACK 347 +#define tLBRACE 348 +#define tLBRACE_ARG 349 +#define tSTAR 350 +#define tAMPER 351 +#define tLAMBDA 352 +#define tSYMBEG 353 +#define tSTRING_BEG 354 +#define tXSTRING_BEG 355 +#define tREGEXP_BEG 356 +#define tWORDS_BEG 357 +#define tQWORDS_BEG 358 +#define tSTRING_DBEG 359 +#define tSTRING_DVAR 360 +#define tSTRING_END 361 +#define tLAMBEG 362 +#define tLOWEST 363 +#define tUMINUS_NUM 364 +#define idNULL 365 +#define idRespond_to 366 +#define idIFUNC 367 +#define idCFUNC 368 +#define id_core_set_method_alias 369 +#define id_core_set_variable_alias 370 +#define id_core_undef_method 371 +#define id_core_define_method 372 +#define id_core_define_singleton_method 373 +#define id_core_set_postexe 374 +#define tLAST_TOKEN 375 + + -/* Line 268 of yacc.c */ + +/* Copy the first part of user declarations. */ #line 12 "ripper.y" @@ -668,9 +912,6 @@ static void token_info_pop(struct parser_params*, const char *token); #endif -/* Line 268 of yacc.c */ -#line 673 "parse.c" - /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -689,165 +930,31 @@ static void token_info_pop(struct parser_params*, const char *token); # define YYTOKEN_TABLE 0 #endif - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - keyword_class = 258, - keyword_module = 259, - keyword_def = 260, - keyword_undef = 261, - keyword_begin = 262, - keyword_rescue = 263, - keyword_ensure = 264, - keyword_end = 265, - keyword_if = 266, - keyword_unless = 267, - keyword_then = 268, - keyword_elsif = 269, - keyword_else = 270, - keyword_case = 271, - keyword_when = 272, - keyword_while = 273, - keyword_until = 274, - keyword_for = 275, - keyword_break = 276, - keyword_next = 277, - keyword_redo = 278, - keyword_retry = 279, - keyword_in = 280, - keyword_do = 281, - keyword_do_cond = 282, - keyword_do_block = 283, - keyword_do_LAMBDA = 284, - keyword_return = 285, - keyword_yield = 286, - keyword_super = 287, - keyword_self = 288, - keyword_nil = 289, - keyword_true = 290, - keyword_false = 291, - keyword_and = 292, - keyword_or = 293, - keyword_not = 294, - modifier_if = 295, - modifier_unless = 296, - modifier_while = 297, - modifier_until = 298, - modifier_rescue = 299, - keyword_alias = 300, - keyword_defined = 301, - keyword_BEGIN = 302, - keyword_END = 303, - keyword__LINE__ = 304, - keyword__FILE__ = 305, - keyword__ENCODING__ = 306, - tIDENTIFIER = 307, - tFID = 308, - tGVAR = 309, - tIVAR = 310, - tCONSTANT = 311, - tCVAR = 312, - tLABEL = 313, - tINTEGER = 314, - tFLOAT = 315, - tSTRING_CONTENT = 316, - tCHAR = 317, - tNTH_REF = 318, - tBACK_REF = 319, - tREGEXP_END = 320, - tUPLUS = 321, - tUMINUS = 322, - tPOW = 323, - tCMP = 324, - tEQ = 325, - tEQQ = 326, - tNEQ = 327, - tGEQ = 328, - tLEQ = 329, - tANDOP = 330, - tOROP = 331, - tMATCH = 332, - tNMATCH = 333, - tDOT2 = 334, - tDOT3 = 335, - tAREF = 336, - tASET = 337, - tLSHFT = 338, - tRSHFT = 339, - tCOLON2 = 340, - tCOLON3 = 341, - tOP_ASGN = 342, - tASSOC = 343, - tLPAREN = 344, - tLPAREN_ARG = 345, - tRPAREN = 346, - tLBRACK = 347, - tLBRACE = 348, - tLBRACE_ARG = 349, - tSTAR = 350, - tAMPER = 351, - tLAMBDA = 352, - tSYMBEG = 353, - tSTRING_BEG = 354, - tXSTRING_BEG = 355, - tREGEXP_BEG = 356, - tWORDS_BEG = 357, - tQWORDS_BEG = 358, - tSTRING_DBEG = 359, - tSTRING_DVAR = 360, - tSTRING_END = 361, - tLAMBEG = 362, - tLOWEST = 363, - tUMINUS_NUM = 364, - idNULL = 365, - idRespond_to = 366, - idIFUNC = 367, - idCFUNC = 368, - id_core_set_method_alias = 369, - id_core_set_variable_alias = 370, - id_core_undef_method = 371, - id_core_define_method = 372, - id_core_define_singleton_method = 373, - id_core_set_postexe = 374, - tLAST_TOKEN = 375 - }; -#endif - - - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -{ - -/* Line 293 of yacc.c */ #line 616 "ripper.y" - +{ VALUE val; NODE *node; ID id; int num; const struct vtable *vars; - - - -/* Line 293 of yacc.c */ -#line 839 "parse.c" -} YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 +} +/* Line 187 of yacc.c. */ +#line 945 "parse.c" + YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif + /* Copy the second part of user declarations. */ -/* Line 343 of yacc.c */ -#line 851 "parse.c" +/* Line 216 of yacc.c. */ +#line 958 "parse.c" #ifdef short # undef short @@ -897,7 +1004,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS +# if YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -922,14 +1029,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int yyi) +YYID (int i) #else static int -YYID (yyi) - int yyi; +YYID (i) + int i; #endif { - return yyi; + return i; } #endif @@ -950,11 +1057,11 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 +# ifndef _STDLIB_H +# define _STDLIB_H 1 # endif # endif # endif @@ -977,24 +1084,24 @@ YYID (yyi) # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined EXIT_SUCCESS \ +# if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 +# ifndef _STDLIB_H +# define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif @@ -1010,9 +1117,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; + yytype_int16 yyss; + YYSTYPE yyvs; + }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -1023,27 +1130,6 @@ union yyalloc ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) -# define YYCOPY_NEEDED 1 - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) - -#endif - -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY @@ -1061,7 +1147,24 @@ union yyalloc while (YYID (0)) # endif # endif -#endif /* !YYCOPY_NEEDED */ + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 @@ -1426,15 +1529,15 @@ static const yytype_uint16 yyrline[] = 4155, 4181, 4189, 4197, 4205, 4208, 4219, 4220, 4221, 4222, 4225, 4255, 4256, 4257, 4265, 4275, 4276, 4277, 4278, 4279, 4282, 4283, 4284, 4285, 4286, 4287, 4288, 4291, 4304, 4314, - 4322, 4332, 4333, 4336, 4345, 4344, 4352, 4364, 4374, 4380, - 4388, 4396, 4404, 4412, 4420, 4428, 4436, 4444, 4452, 4460, - 4468, 4476, 4484, 4493, 4502, 4511, 4520, 4529, 4540, 4541, - 4548, 4557, 4576, 4583, 4596, 4608, 4620, 4628, 4644, 4652, - 4668, 4669, 4672, 4685, 4696, 4697, 4700, 4717, 4721, 4731, - 4741, 4741, 4770, 4771, 4781, 4788, 4798, 4806, 4816, 4817, - 4818, 4821, 4822, 4823, 4824, 4827, 4828, 4829, 4832, 4837, - 4844, 4845, 4848, 4849, 4852, 4855, 4858, 4859, 4860, 4863, - 4864, 4867, 4868, 4872 + 4322, 4332, 4333, 4336, 4345, 4344, 4352, 4364, 4374, 4382, + 4390, 4398, 4406, 4414, 4422, 4430, 4438, 4446, 4454, 4462, + 4470, 4478, 4486, 4495, 4504, 4513, 4522, 4531, 4542, 4543, + 4550, 4559, 4578, 4585, 4598, 4610, 4622, 4630, 4646, 4654, + 4670, 4671, 4674, 4687, 4698, 4699, 4702, 4719, 4723, 4733, + 4743, 4743, 4772, 4773, 4783, 4790, 4800, 4808, 4818, 4819, + 4820, 4823, 4824, 4825, 4826, 4829, 4830, 4831, 4834, 4839, + 4846, 4847, 4850, 4851, 4854, 4857, 4860, 4861, 4862, 4865, + 4866, 4869, 4870, 4874 }; #endif @@ -1472,35 +1575,34 @@ static const char *const yytname[] = "id_core_define_method", "id_core_define_singleton_method", "id_core_set_postexe", "tLAST_TOKEN", "'{'", "'}'", "'['", "'.'", "','", "'`'", "'('", "')'", "']'", "';'", "' '", "'\\n'", "$accept", "program", - "$@1", "top_compstmt", "top_stmts", "top_stmt", "$@2", "bodystmt", - "compstmt", "stmts", "stmt", "$@3", "command_asgn", "expr", "expr_value", + "@1", "top_compstmt", "top_stmts", "top_stmt", "@2", "bodystmt", + "compstmt", "stmts", "stmt", "@3", "command_asgn", "expr", "expr_value", "command_call", "block_command", "cmd_brace_block", "@4", "command", "mlhs", "mlhs_inner", "mlhs_basic", "mlhs_item", "mlhs_head", "mlhs_post", "mlhs_node", "lhs", "cname", "cpath", "fname", "fsym", - "fitem", "undef_list", "$@5", "op", "reswords", "arg", "$@6", - "arg_value", "aref_args", "paren_args", "opt_paren_args", - "opt_call_args", "call_args", "command_args", "@7", "block_arg", - "opt_block_arg", "args", "mrhs", "primary", "@8", "$@9", "$@10", "$@11", - "$@12", "$@13", "$@14", "$@15", "$@16", "@17", "@18", "@19", "@20", - "@21", "$@22", "$@23", "primary_value", "k_begin", "k_if", "k_unless", - "k_while", "k_until", "k_case", "k_for", "k_class", "k_module", "k_def", - "k_end", "then", "do", "if_tail", "opt_else", "for_var", "f_marg", - "f_marg_list", "f_margs", "block_param", "opt_block_param", - "block_param_def", "opt_bv_decl", "bv_decls", "bvar", "lambda", "@24", - "@25", "f_larglist", "lambda_body", "do_block", "@26", "block_call", - "method_call", "brace_block", "@27", "@28", "case_body", "cases", - "opt_rescue", "exc_list", "exc_var", "opt_ensure", "literal", "strings", - "string", "string1", "xstring", "regexp", "words", "word_list", "word", - "qwords", "qword_list", "string_contents", "xstring_contents", - "regexp_contents", "string_content", "@29", "@30", "@31", "string_dvar", - "symbol", "sym", "dsym", "numeric", "user_variable", "keyword_variable", - "var_ref", "var_lhs", "backref", "superclass", "$@32", "f_arglist", - "f_args", "f_bad_arg", "f_norm_arg", "f_arg_item", "f_arg", "f_opt", - "f_block_opt", "f_block_optarg", "f_optarg", "restarg_mark", - "f_rest_arg", "blkarg_mark", "f_block_arg", "opt_f_block_arg", - "singleton", "$@33", "assoc_list", "assocs", "assoc", "operation", - "operation2", "operation3", "dot_or_colon", "opt_terms", "opt_nl", - "rparen", "rbracket", "trailer", "term", "terms", "none", 0 + "fitem", "undef_list", "@5", "op", "reswords", "arg", "@6", "arg_value", + "aref_args", "paren_args", "opt_paren_args", "opt_call_args", + "call_args", "command_args", "@7", "block_arg", "opt_block_arg", "args", + "mrhs", "primary", "@8", "@9", "@10", "@11", "@12", "@13", "@14", "@15", + "@16", "@17", "@18", "@19", "@20", "@21", "@22", "@23", "primary_value", + "k_begin", "k_if", "k_unless", "k_while", "k_until", "k_case", "k_for", + "k_class", "k_module", "k_def", "k_end", "then", "do", "if_tail", + "opt_else", "for_var", "f_marg", "f_marg_list", "f_margs", "block_param", + "opt_block_param", "block_param_def", "opt_bv_decl", "bv_decls", "bvar", + "lambda", "@24", "@25", "f_larglist", "lambda_body", "do_block", "@26", + "block_call", "method_call", "brace_block", "@27", "@28", "case_body", + "cases", "opt_rescue", "exc_list", "exc_var", "opt_ensure", "literal", + "strings", "string", "string1", "xstring", "regexp", "words", + "word_list", "word", "qwords", "qword_list", "string_contents", + "xstring_contents", "regexp_contents", "string_content", "@29", "@30", + "@31", "string_dvar", "symbol", "sym", "dsym", "numeric", + "user_variable", "keyword_variable", "var_ref", "var_lhs", "backref", + "superclass", "@32", "f_arglist", "f_args", "f_bad_arg", "f_norm_arg", + "f_arg_item", "f_arg", "f_opt", "f_block_opt", "f_block_optarg", + "f_optarg", "restarg_mark", "f_rest_arg", "blkarg_mark", "f_block_arg", + "opt_f_block_arg", "singleton", "@33", "assoc_list", "assocs", "assoc", + "operation", "operation2", "operation3", "dot_or_colon", "opt_terms", + "opt_nl", "rparen", "rbracket", "trailer", "term", "terms", "none", 0 }; #endif @@ -1653,8 +1755,8 @@ static const yytype_uint8 yyr2[] = 1, 1, 2, 0 }; -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint16 yydefact[] = { @@ -1915,7 +2017,8 @@ static const yytype_int16 yypgoto[] = /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which - number is the opposite. If YYTABLE_NINF, syntax error. */ + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -574 static const yytype_int16 yytable[] = { @@ -2996,12 +3099,6 @@ static const yytype_int16 yytable[] = 325, 326, 327, 328, 329, 330, 331, 332, 333 }; -#define yypact_value_is_default(yystate) \ - ((yystate) == (-747)) - -#define yytable_value_is_error(yytable_value) \ - ((yytable_value) == (-574)) - static const yytype_int16 yycheck[] = { 2, 55, 340, 28, 2, 454, 4, 52, 593, 16, @@ -4199,18 +4296,9 @@ static const yytype_uint16 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ + Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif #define YYRECOVERING() (!!yyerrstatus) @@ -4220,6 +4308,7 @@ do \ { \ yychar = (Token); \ yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ @@ -4261,10 +4350,19 @@ while (YYID (0)) #endif -/* This macro is provided for backward compatibility. */ +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif #endif @@ -4371,20 +4469,17 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, parser) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } @@ -4419,11 +4514,11 @@ yy_reduce_print (yyvsp, yyrule, parser) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - YYFPRINTF (stderr, " $%d = ", yyi + 1); + fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , parser); - YYFPRINTF (stderr, "\n"); + fprintf (stderr, "\n"); } } @@ -4462,6 +4557,7 @@ int yydebug; # define YYMAXDEPTH 10000 #endif + #if YYERROR_VERBOSE @@ -4564,142 +4660,115 @@ yytnamerr (char *yyres, const char *yystr) } # endif -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) { - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = 0; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> - for details. YYERROR is fine as it does not invoke this - function. - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } + int yyn = yypact[yystate]; - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } - yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } + if (yysize_overflow) + return YYSIZE_MAXIMUM; - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } } #endif /* YYERROR_VERBOSE */ + /*-----------------------------------------------. | Release the memory associated to this symbol. | @@ -4733,9 +4802,10 @@ yydestruct (yymsg, yytype, yyvaluep, parser) break; } } - + /* Prevent warnings from -Wmissing-prototypes. */ + #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -4751,6 +4821,10 @@ int yyparse (); #endif /* ! YYPARSE_PARAM */ + + + + /*----------. | yyparse. | `----------*/ @@ -4777,46 +4851,22 @@ yyparse (parser) #endif #endif { -/* The lookahead symbol. */ + /* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; - /* Number of syntax errors so far. */ - int yynerrs; - - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; +/* Number of syntax errors so far. */ +int yynerrs; + int yystate; int yyn; int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; @@ -4824,28 +4874,51 @@ YYSTYPE yylval; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; - yystacksize = YYINITDEPTH; - YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ + yyssp = yyss; yyvsp = yyvs; @@ -4875,6 +4948,7 @@ YYSTYPE yylval; YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; + /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -4882,6 +4956,7 @@ YYSTYPE yylval; yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); yyss = yyss1; @@ -4904,8 +4979,9 @@ YYSTYPE yylval; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -4916,6 +4992,7 @@ YYSTYPE yylval; yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; + YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -4925,9 +5002,6 @@ YYSTYPE yylval; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - if (yystate == YYFINAL) - YYACCEPT; - goto yybackup; /*-----------. @@ -4936,16 +5010,16 @@ YYSTYPE yylval; yybackup: /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ + look-ahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; - if (yypact_value_is_default (yyn)) + if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -4971,22 +5045,26 @@ yybackup: yyn = yytable[yyn]; if (yyn <= 0) { - if (yytable_value_is_error (yyn)) - goto yyerrlab; + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; yyn = -yyn; goto yyreduce; } + if (yyn == YYFINAL) + YYACCEPT; + /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the lookahead token. */ + /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token. */ - yychar = YYEMPTY; + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -5026,8 +5104,6 @@ yyreduce: switch (yyn) { case 2: - -/* Line 1806 of yacc.c */ #line 782 "ripper.y" { lex_state = EXPR_BEG; @@ -5036,12 +5112,10 @@ yyreduce: #endif local_push(0); - } + ;} break; case 3: - -/* Line 1806 of yacc.c */ #line 791 "ripper.y" { #if 0 @@ -5062,12 +5136,10 @@ yyreduce: parser->result = dispatch1(program, (yyval.val)); local_pop(); - } + ;} break; case 4: - -/* Line 1806 of yacc.c */ #line 814 "ripper.y" { #if 0 @@ -5076,12 +5148,10 @@ yyreduce: #endif (yyval.val) = (yyvsp[(1) - (2)].val); - } + ;} break; case 5: - -/* Line 1806 of yacc.c */ #line 825 "ripper.y" { #if 0 @@ -5090,12 +5160,10 @@ yyreduce: (yyval.val) = dispatch2(stmts_add, dispatch0(stmts_new), dispatch0(void_stmt)); - } + ;} break; case 6: - -/* Line 1806 of yacc.c */ #line 834 "ripper.y" { #if 0 @@ -5103,12 +5171,10 @@ yyreduce: #endif (yyval.val) = dispatch2(stmts_add, dispatch0(stmts_new), (yyvsp[(1) - (1)].val)); - } + ;} break; case 7: - -/* Line 1806 of yacc.c */ #line 842 "ripper.y" { #if 0 @@ -5116,21 +5182,17 @@ yyreduce: #endif (yyval.val) = dispatch2(stmts_add, (yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 8: - -/* Line 1806 of yacc.c */ #line 850 "ripper.y" { (yyval.val) = remove_begin((yyvsp[(2) - (2)].val)); - } + ;} break; case 10: - -/* Line 1806 of yacc.c */ #line 857 "ripper.y" { if (in_def || in_single) { @@ -5140,12 +5202,10 @@ yyreduce: /* local_push(0); */ #endif - } + ;} break; case 11: - -/* Line 1806 of yacc.c */ #line 867 "ripper.y" { #if 0 @@ -5157,12 +5217,10 @@ yyreduce: #endif (yyval.val) = dispatch1(BEGIN, (yyvsp[(4) - (5)].val)); - } + ;} break; case 12: - -/* Line 1806 of yacc.c */ #line 884 "ripper.y" { #if 0 @@ -5190,12 +5248,10 @@ yyreduce: escape_Qundef((yyvsp[(3) - (4)].val)), escape_Qundef((yyvsp[(4) - (4)].val))); - } + ;} break; case 13: - -/* Line 1806 of yacc.c */ #line 914 "ripper.y" { #if 0 @@ -5204,12 +5260,10 @@ yyreduce: #endif (yyval.val) = (yyvsp[(1) - (2)].val); - } + ;} break; case 14: - -/* Line 1806 of yacc.c */ #line 925 "ripper.y" { #if 0 @@ -5218,12 +5272,10 @@ yyreduce: (yyval.val) = dispatch2(stmts_add, dispatch0(stmts_new), dispatch0(void_stmt)); - } + ;} break; case 15: - -/* Line 1806 of yacc.c */ #line 934 "ripper.y" { #if 0 @@ -5231,12 +5283,10 @@ yyreduce: #endif (yyval.val) = dispatch2(stmts_add, dispatch0(stmts_new), (yyvsp[(1) - (1)].val)); - } + ;} break; case 16: - -/* Line 1806 of yacc.c */ #line 942 "ripper.y" { #if 0 @@ -5244,28 +5294,22 @@ yyreduce: #endif (yyval.val) = dispatch2(stmts_add, (yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 17: - -/* Line 1806 of yacc.c */ #line 950 "ripper.y" { (yyval.val) = remove_begin((yyvsp[(2) - (2)].val)); - } + ;} break; case 18: - -/* Line 1806 of yacc.c */ #line 955 "ripper.y" - {lex_state = EXPR_FNAME;} + {lex_state = EXPR_FNAME;;} break; case 19: - -/* Line 1806 of yacc.c */ #line 956 "ripper.y" { #if 0 @@ -5273,12 +5317,10 @@ yyreduce: #endif (yyval.val) = dispatch2(alias, (yyvsp[(2) - (4)].val), (yyvsp[(4) - (4)].val)); - } + ;} break; case 20: - -/* Line 1806 of yacc.c */ #line 964 "ripper.y" { #if 0 @@ -5286,12 +5328,10 @@ yyreduce: #endif (yyval.val) = dispatch2(var_alias, (yyvsp[(2) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 21: - -/* Line 1806 of yacc.c */ #line 972 "ripper.y" { #if 0 @@ -5302,12 +5342,10 @@ yyreduce: #endif (yyval.val) = dispatch2(var_alias, (yyvsp[(2) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 22: - -/* Line 1806 of yacc.c */ #line 983 "ripper.y" { #if 0 @@ -5317,12 +5355,10 @@ yyreduce: (yyval.val) = dispatch2(var_alias, (yyvsp[(2) - (3)].val), (yyvsp[(3) - (3)].val)); (yyval.val) = dispatch1(alias_error, (yyval.val)); - } + ;} break; case 23: - -/* Line 1806 of yacc.c */ #line 993 "ripper.y" { #if 0 @@ -5330,12 +5366,10 @@ yyreduce: #endif (yyval.val) = dispatch1(undef, (yyvsp[(2) - (2)].val)); - } + ;} break; case 24: - -/* Line 1806 of yacc.c */ #line 1001 "ripper.y" { #if 0 @@ -5344,12 +5378,10 @@ yyreduce: #endif (yyval.val) = dispatch2(if_mod, (yyvsp[(3) - (3)].val), (yyvsp[(1) - (3)].val)); - } + ;} break; case 25: - -/* Line 1806 of yacc.c */ #line 1010 "ripper.y" { #if 0 @@ -5358,12 +5390,10 @@ yyreduce: #endif (yyval.val) = dispatch2(unless_mod, (yyvsp[(3) - (3)].val), (yyvsp[(1) - (3)].val)); - } + ;} break; case 26: - -/* Line 1806 of yacc.c */ #line 1019 "ripper.y" { #if 0 @@ -5376,12 +5406,10 @@ yyreduce: #endif (yyval.val) = dispatch2(while_mod, (yyvsp[(3) - (3)].val), (yyvsp[(1) - (3)].val)); - } + ;} break; case 27: - -/* Line 1806 of yacc.c */ #line 1032 "ripper.y" { #if 0 @@ -5394,12 +5422,10 @@ yyreduce: #endif (yyval.val) = dispatch2(until_mod, (yyvsp[(3) - (3)].val), (yyvsp[(1) - (3)].val)); - } + ;} break; case 28: - -/* Line 1806 of yacc.c */ #line 1045 "ripper.y" { #if 0 @@ -5408,12 +5434,10 @@ yyreduce: #endif (yyval.val) = dispatch2(rescue_mod, (yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 29: - -/* Line 1806 of yacc.c */ #line 1054 "ripper.y" { if (in_def || in_single) { @@ -5425,12 +5449,10 @@ yyreduce: #endif (yyval.val) = dispatch1(END, (yyvsp[(3) - (4)].val)); - } + ;} break; case 31: - -/* Line 1806 of yacc.c */ #line 1067 "ripper.y" { #if 0 @@ -5440,12 +5462,10 @@ yyreduce: #endif (yyval.val) = dispatch2(massign, (yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 32: - -/* Line 1806 of yacc.c */ #line 1077 "ripper.y" { #if 0 @@ -5474,12 +5494,10 @@ yyreduce: #endif (yyval.val) = dispatch3(opassign, (yyvsp[(1) - (3)].val), (yyvsp[(2) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 33: - -/* Line 1806 of yacc.c */ #line 1106 "ripper.y" { #if 0 @@ -5500,12 +5518,10 @@ yyreduce: (yyval.val) = dispatch2(aref_field, (yyvsp[(1) - (6)].val), escape_Qundef((yyvsp[(3) - (6)].val))); (yyval.val) = dispatch3(opassign, (yyval.val), (yyvsp[(5) - (6)].val), (yyvsp[(6) - (6)].val)); - } + ;} break; case 34: - -/* Line 1806 of yacc.c */ #line 1127 "ripper.y" { #if 0 @@ -5522,12 +5538,10 @@ yyreduce: (yyval.val) = dispatch3(field, (yyvsp[(1) - (5)].val), ripper_id2sym('.'), (yyvsp[(3) - (5)].val)); (yyval.val) = dispatch3(opassign, (yyval.val), (yyvsp[(4) - (5)].val), (yyvsp[(5) - (5)].val)); - } + ;} break; case 35: - -/* Line 1806 of yacc.c */ #line 1144 "ripper.y" { #if 0 @@ -5544,12 +5558,10 @@ yyreduce: (yyval.val) = dispatch3(field, (yyvsp[(1) - (5)].val), ripper_id2sym('.'), (yyvsp[(3) - (5)].val)); (yyval.val) = dispatch3(opassign, (yyval.val), (yyvsp[(4) - (5)].val), (yyvsp[(5) - (5)].val)); - } + ;} break; case 36: - -/* Line 1806 of yacc.c */ #line 1161 "ripper.y" { #if 0 @@ -5560,12 +5572,10 @@ yyreduce: (yyval.val) = dispatch3(opassign, (yyval.val), (yyvsp[(4) - (5)].val), (yyvsp[(5) - (5)].val)); (yyval.val) = dispatch1(assign_error, (yyval.val)); - } + ;} break; case 37: - -/* Line 1806 of yacc.c */ #line 1172 "ripper.y" { #if 0 @@ -5582,12 +5592,10 @@ yyreduce: (yyval.val) = dispatch3(field, (yyvsp[(1) - (5)].val), ripper_intern("::"), (yyvsp[(3) - (5)].val)); (yyval.val) = dispatch3(opassign, (yyval.val), (yyvsp[(4) - (5)].val), (yyvsp[(5) - (5)].val)); - } + ;} break; case 38: - -/* Line 1806 of yacc.c */ #line 1189 "ripper.y" { #if 0 @@ -5597,12 +5605,10 @@ yyreduce: (yyval.val) = dispatch2(assign, dispatch1(var_field, (yyvsp[(1) - (3)].val)), (yyvsp[(3) - (3)].val)); (yyval.val) = dispatch1(assign_error, (yyval.val)); - } + ;} break; case 39: - -/* Line 1806 of yacc.c */ #line 1199 "ripper.y" { #if 0 @@ -5611,12 +5617,10 @@ yyreduce: #endif (yyval.val) = dispatch2(assign, (yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 40: - -/* Line 1806 of yacc.c */ #line 1208 "ripper.y" { #if 0 @@ -5625,12 +5629,10 @@ yyreduce: #endif (yyval.val) = dispatch2(massign, (yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 41: - -/* Line 1806 of yacc.c */ #line 1217 "ripper.y" { #if 0 @@ -5639,12 +5641,10 @@ yyreduce: #endif (yyval.val) = dispatch2(massign, (yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 43: - -/* Line 1806 of yacc.c */ #line 1229 "ripper.y" { #if 0 @@ -5653,12 +5653,10 @@ yyreduce: #endif (yyval.val) = dispatch2(assign, (yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 44: - -/* Line 1806 of yacc.c */ #line 1238 "ripper.y" { #if 0 @@ -5667,12 +5665,10 @@ yyreduce: #endif (yyval.val) = dispatch2(assign, (yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 46: - -/* Line 1806 of yacc.c */ #line 1251 "ripper.y" { #if 0 @@ -5680,12 +5676,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ripper_intern("and"), (yyvsp[(3) - (3)].val)); - } + ;} break; case 47: - -/* Line 1806 of yacc.c */ #line 1259 "ripper.y" { #if 0 @@ -5693,12 +5687,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ripper_intern("or"), (yyvsp[(3) - (3)].val)); - } + ;} break; case 48: - -/* Line 1806 of yacc.c */ #line 1267 "ripper.y" { #if 0 @@ -5706,12 +5698,10 @@ yyreduce: #endif (yyval.val) = dispatch2(unary, ripper_intern("not"), (yyvsp[(3) - (3)].val)); - } + ;} break; case 49: - -/* Line 1806 of yacc.c */ #line 1275 "ripper.y" { #if 0 @@ -5719,12 +5709,10 @@ yyreduce: #endif (yyval.val) = dispatch2(unary, ripper_id2sym('!'), (yyvsp[(2) - (2)].val)); - } + ;} break; case 51: - -/* Line 1806 of yacc.c */ #line 1286 "ripper.y" { #if 0 @@ -5734,12 +5722,10 @@ yyreduce: #endif (yyval.val) = (yyvsp[(1) - (1)].val); - } + ;} break; case 55: - -/* Line 1806 of yacc.c */ #line 1303 "ripper.y" { #if 0 @@ -5748,12 +5734,10 @@ yyreduce: (yyval.val) = dispatch3(call, (yyvsp[(1) - (4)].val), ripper_id2sym('.'), (yyvsp[(3) - (4)].val)); (yyval.val) = method_arg((yyval.val), (yyvsp[(4) - (4)].val)); - } + ;} break; case 56: - -/* Line 1806 of yacc.c */ #line 1312 "ripper.y" { #if 0 @@ -5762,12 +5746,10 @@ yyreduce: (yyval.val) = dispatch3(call, (yyvsp[(1) - (4)].val), ripper_intern("::"), (yyvsp[(3) - (4)].val)); (yyval.val) = method_arg((yyval.val), (yyvsp[(4) - (4)].val)); - } + ;} break; case 57: - -/* Line 1806 of yacc.c */ #line 1323 "ripper.y" { (yyvsp[(1) - (1)].vars) = dyna_push(); @@ -5775,12 +5757,10 @@ yyreduce: (yyval.num) = ruby_sourceline; #endif - } + ;} break; case 58: - -/* Line 1806 of yacc.c */ #line 1333 "ripper.y" { #if 0 @@ -5790,12 +5770,10 @@ yyreduce: (yyval.val) = dispatch2(brace_block, escape_Qundef((yyvsp[(3) - (5)].val)), (yyvsp[(4) - (5)].val)); dyna_pop((yyvsp[(1) - (5)].vars)); - } + ;} break; case 59: - -/* Line 1806 of yacc.c */ #line 1345 "ripper.y" { #if 0 @@ -5804,12 +5782,10 @@ yyreduce: #endif (yyval.val) = dispatch2(command, (yyvsp[(1) - (2)].val), (yyvsp[(2) - (2)].val)); - } + ;} break; case 60: - -/* Line 1806 of yacc.c */ #line 1354 "ripper.y" { #if 0 @@ -5821,12 +5797,10 @@ yyreduce: (yyval.val) = dispatch2(command, (yyvsp[(1) - (3)].val), (yyvsp[(2) - (3)].val)); (yyval.val) = method_add_block((yyval.val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 61: - -/* Line 1806 of yacc.c */ #line 1366 "ripper.y" { #if 0 @@ -5835,12 +5809,10 @@ yyreduce: #endif (yyval.val) = dispatch4(command_call, (yyvsp[(1) - (4)].val), ripper_id2sym('.'), (yyvsp[(3) - (4)].val), (yyvsp[(4) - (4)].val)); - } + ;} break; case 62: - -/* Line 1806 of yacc.c */ #line 1375 "ripper.y" { #if 0 @@ -5852,12 +5824,10 @@ yyreduce: (yyval.val) = dispatch4(command_call, (yyvsp[(1) - (5)].val), ripper_id2sym('.'), (yyvsp[(3) - (5)].val), (yyvsp[(4) - (5)].val)); (yyval.val) = method_add_block((yyval.val), (yyvsp[(5) - (5)].val)); - } + ;} break; case 63: - -/* Line 1806 of yacc.c */ #line 1387 "ripper.y" { #if 0 @@ -5866,12 +5836,10 @@ yyreduce: #endif (yyval.val) = dispatch4(command_call, (yyvsp[(1) - (4)].val), ripper_intern("::"), (yyvsp[(3) - (4)].val), (yyvsp[(4) - (4)].val)); - } + ;} break; case 64: - -/* Line 1806 of yacc.c */ #line 1396 "ripper.y" { #if 0 @@ -5883,12 +5851,10 @@ yyreduce: (yyval.val) = dispatch4(command_call, (yyvsp[(1) - (5)].val), ripper_intern("::"), (yyvsp[(3) - (5)].val), (yyvsp[(4) - (5)].val)); (yyval.val) = method_add_block((yyval.val), (yyvsp[(5) - (5)].val)); - } + ;} break; case 65: - -/* Line 1806 of yacc.c */ #line 1408 "ripper.y" { #if 0 @@ -5897,12 +5863,10 @@ yyreduce: #endif (yyval.val) = dispatch1(super, (yyvsp[(2) - (2)].val)); - } + ;} break; case 66: - -/* Line 1806 of yacc.c */ #line 1417 "ripper.y" { #if 0 @@ -5911,12 +5875,10 @@ yyreduce: #endif (yyval.val) = dispatch1(yield, (yyvsp[(2) - (2)].val)); - } + ;} break; case 67: - -/* Line 1806 of yacc.c */ #line 1426 "ripper.y" { #if 0 @@ -5924,12 +5886,10 @@ yyreduce: #endif (yyval.val) = dispatch1(return, (yyvsp[(2) - (2)].val)); - } + ;} break; case 68: - -/* Line 1806 of yacc.c */ #line 1434 "ripper.y" { #if 0 @@ -5937,12 +5897,10 @@ yyreduce: #endif (yyval.val) = dispatch1(break, (yyvsp[(2) - (2)].val)); - } + ;} break; case 69: - -/* Line 1806 of yacc.c */ #line 1442 "ripper.y" { #if 0 @@ -5950,12 +5908,10 @@ yyreduce: #endif (yyval.val) = dispatch1(next, (yyvsp[(2) - (2)].val)); - } + ;} break; case 71: - -/* Line 1806 of yacc.c */ #line 1453 "ripper.y" { #if 0 @@ -5963,12 +5919,10 @@ yyreduce: #endif (yyval.val) = dispatch1(mlhs_paren, (yyvsp[(2) - (3)].val)); - } + ;} break; case 73: - -/* Line 1806 of yacc.c */ #line 1464 "ripper.y" { #if 0 @@ -5976,12 +5930,10 @@ yyreduce: #endif (yyval.val) = dispatch1(mlhs_paren, (yyvsp[(2) - (3)].val)); - } + ;} break; case 74: - -/* Line 1806 of yacc.c */ #line 1474 "ripper.y" { #if 0 @@ -5989,12 +5941,10 @@ yyreduce: #endif (yyval.val) = (yyvsp[(1) - (1)].val); - } + ;} break; case 75: - -/* Line 1806 of yacc.c */ #line 1482 "ripper.y" { #if 0 @@ -6002,12 +5952,10 @@ yyreduce: #endif (yyval.val) = mlhs_add((yyvsp[(1) - (2)].val), (yyvsp[(2) - (2)].val)); - } + ;} break; case 76: - -/* Line 1806 of yacc.c */ #line 1490 "ripper.y" { #if 0 @@ -6015,12 +5963,10 @@ yyreduce: #endif (yyval.val) = mlhs_add_star((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 77: - -/* Line 1806 of yacc.c */ #line 1498 "ripper.y" { #if 0 @@ -6029,12 +5975,10 @@ yyreduce: (yyvsp[(1) - (5)].val) = mlhs_add_star((yyvsp[(1) - (5)].val), (yyvsp[(3) - (5)].val)); (yyval.val) = mlhs_add((yyvsp[(1) - (5)].val), (yyvsp[(5) - (5)].val)); - } + ;} break; case 78: - -/* Line 1806 of yacc.c */ #line 1507 "ripper.y" { #if 0 @@ -6042,12 +5986,10 @@ yyreduce: #endif (yyval.val) = mlhs_add_star((yyvsp[(1) - (2)].val), Qnil); - } + ;} break; case 79: - -/* Line 1806 of yacc.c */ #line 1515 "ripper.y" { #if 0 @@ -6056,12 +5998,10 @@ yyreduce: (yyvsp[(1) - (4)].val) = mlhs_add_star((yyvsp[(1) - (4)].val), Qnil); (yyval.val) = mlhs_add((yyvsp[(1) - (4)].val), (yyvsp[(4) - (4)].val)); - } + ;} break; case 80: - -/* Line 1806 of yacc.c */ #line 1524 "ripper.y" { #if 0 @@ -6069,12 +6009,10 @@ yyreduce: #endif (yyval.val) = mlhs_add_star(mlhs_new(), (yyvsp[(2) - (2)].val)); - } + ;} break; case 81: - -/* Line 1806 of yacc.c */ #line 1532 "ripper.y" { #if 0 @@ -6083,12 +6021,10 @@ yyreduce: (yyvsp[(2) - (4)].val) = mlhs_add_star(mlhs_new(), (yyvsp[(2) - (4)].val)); (yyval.val) = mlhs_add((yyvsp[(2) - (4)].val), (yyvsp[(4) - (4)].val)); - } + ;} break; case 82: - -/* Line 1806 of yacc.c */ #line 1541 "ripper.y" { #if 0 @@ -6096,12 +6032,10 @@ yyreduce: #endif (yyval.val) = mlhs_add_star(mlhs_new(), Qnil); - } + ;} break; case 83: - -/* Line 1806 of yacc.c */ #line 1549 "ripper.y" { #if 0 @@ -6110,12 +6044,10 @@ yyreduce: (yyval.val) = mlhs_add_star(mlhs_new(), Qnil); (yyval.val) = mlhs_add((yyval.val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 85: - -/* Line 1806 of yacc.c */ #line 1561 "ripper.y" { #if 0 @@ -6123,12 +6055,10 @@ yyreduce: #endif (yyval.val) = dispatch1(mlhs_paren, (yyvsp[(2) - (3)].val)); - } + ;} break; case 86: - -/* Line 1806 of yacc.c */ #line 1571 "ripper.y" { #if 0 @@ -6136,12 +6066,10 @@ yyreduce: #endif (yyval.val) = mlhs_add(mlhs_new(), (yyvsp[(1) - (2)].val)); - } + ;} break; case 87: - -/* Line 1806 of yacc.c */ #line 1579 "ripper.y" { #if 0 @@ -6149,12 +6077,10 @@ yyreduce: #endif (yyval.val) = mlhs_add((yyvsp[(1) - (3)].val), (yyvsp[(2) - (3)].val)); - } + ;} break; case 88: - -/* Line 1806 of yacc.c */ #line 1589 "ripper.y" { #if 0 @@ -6162,12 +6088,10 @@ yyreduce: #endif (yyval.val) = mlhs_add(mlhs_new(), (yyvsp[(1) - (1)].val)); - } + ;} break; case 89: - -/* Line 1806 of yacc.c */ #line 1597 "ripper.y" { #if 0 @@ -6175,30 +6099,24 @@ yyreduce: #endif (yyval.val) = mlhs_add((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 90: - -/* Line 1806 of yacc.c */ #line 1607 "ripper.y" { (yyval.val) = assignable((yyvsp[(1) - (1)].val), 0); - } + ;} break; case 91: - -/* Line 1806 of yacc.c */ #line 1611 "ripper.y" { (yyval.val) = assignable((yyvsp[(1) - (1)].val), 0); - } + ;} break; case 92: - -/* Line 1806 of yacc.c */ #line 1615 "ripper.y" { #if 0 @@ -6206,12 +6124,10 @@ yyreduce: #endif (yyval.val) = dispatch2(aref_field, (yyvsp[(1) - (4)].val), escape_Qundef((yyvsp[(3) - (4)].val))); - } + ;} break; case 93: - -/* Line 1806 of yacc.c */ #line 1623 "ripper.y" { #if 0 @@ -6219,12 +6135,10 @@ yyreduce: #endif (yyval.val) = dispatch3(field, (yyvsp[(1) - (3)].val), ripper_id2sym('.'), (yyvsp[(3) - (3)].val)); - } + ;} break; case 94: - -/* Line 1806 of yacc.c */ #line 1631 "ripper.y" { #if 0 @@ -6232,12 +6146,10 @@ yyreduce: #endif (yyval.val) = dispatch2(const_path_field, (yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 95: - -/* Line 1806 of yacc.c */ #line 1639 "ripper.y" { #if 0 @@ -6245,12 +6157,10 @@ yyreduce: #endif (yyval.val) = dispatch3(field, (yyvsp[(1) - (3)].val), ripper_id2sym('.'), (yyvsp[(3) - (3)].val)); - } + ;} break; case 96: - -/* Line 1806 of yacc.c */ #line 1647 "ripper.y" { #if 0 @@ -6262,12 +6172,10 @@ yyreduce: yyerror("dynamic constant assignment"); (yyval.val) = dispatch2(const_path_field, (yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 97: - -/* Line 1806 of yacc.c */ #line 1659 "ripper.y" { #if 0 @@ -6277,12 +6185,10 @@ yyreduce: #endif (yyval.val) = dispatch1(top_const_field, (yyvsp[(2) - (2)].val)); - } + ;} break; case 98: - -/* Line 1806 of yacc.c */ #line 1669 "ripper.y" { #if 0 @@ -6292,12 +6198,10 @@ yyreduce: (yyval.val) = dispatch1(var_field, (yyvsp[(1) - (1)].val)); (yyval.val) = dispatch1(assign_error, (yyval.val)); - } + ;} break; case 99: - -/* Line 1806 of yacc.c */ #line 1681 "ripper.y" { (yyval.val) = assignable((yyvsp[(1) - (1)].val), 0); @@ -6306,12 +6210,10 @@ yyreduce: #endif (yyval.val) = dispatch1(var_field, (yyval.val)); - } + ;} break; case 100: - -/* Line 1806 of yacc.c */ #line 1690 "ripper.y" { (yyval.val) = assignable((yyvsp[(1) - (1)].val), 0); @@ -6320,12 +6222,10 @@ yyreduce: #endif (yyval.val) = dispatch1(var_field, (yyval.val)); - } + ;} break; case 101: - -/* Line 1806 of yacc.c */ #line 1699 "ripper.y" { #if 0 @@ -6333,12 +6233,10 @@ yyreduce: #endif (yyval.val) = dispatch2(aref_field, (yyvsp[(1) - (4)].val), escape_Qundef((yyvsp[(3) - (4)].val))); - } + ;} break; case 102: - -/* Line 1806 of yacc.c */ #line 1707 "ripper.y" { #if 0 @@ -6346,12 +6244,10 @@ yyreduce: #endif (yyval.val) = dispatch3(field, (yyvsp[(1) - (3)].val), ripper_id2sym('.'), (yyvsp[(3) - (3)].val)); - } + ;} break; case 103: - -/* Line 1806 of yacc.c */ #line 1715 "ripper.y" { #if 0 @@ -6359,12 +6255,10 @@ yyreduce: #endif (yyval.val) = dispatch3(field, (yyvsp[(1) - (3)].val), ripper_intern("::"), (yyvsp[(3) - (3)].val)); - } + ;} break; case 104: - -/* Line 1806 of yacc.c */ #line 1723 "ripper.y" { #if 0 @@ -6372,12 +6266,10 @@ yyreduce: #endif (yyval.val) = dispatch3(field, (yyvsp[(1) - (3)].val), ripper_id2sym('.'), (yyvsp[(3) - (3)].val)); - } + ;} break; case 105: - -/* Line 1806 of yacc.c */ #line 1731 "ripper.y" { #if 0 @@ -6390,12 +6282,10 @@ yyreduce: (yyval.val) = dispatch1(assign_error, (yyval.val)); } - } + ;} break; case 106: - -/* Line 1806 of yacc.c */ #line 1744 "ripper.y" { #if 0 @@ -6408,12 +6298,10 @@ yyreduce: (yyval.val) = dispatch1(assign_error, (yyval.val)); } - } + ;} break; case 107: - -/* Line 1806 of yacc.c */ #line 1757 "ripper.y" { #if 0 @@ -6422,12 +6310,10 @@ yyreduce: #endif (yyval.val) = dispatch1(assign_error, (yyvsp[(1) - (1)].val)); - } + ;} break; case 108: - -/* Line 1806 of yacc.c */ #line 1768 "ripper.y" { #if 0 @@ -6435,12 +6321,10 @@ yyreduce: #endif (yyval.val) = dispatch1(class_name_error, (yyvsp[(1) - (1)].val)); - } + ;} break; case 110: - -/* Line 1806 of yacc.c */ #line 1779 "ripper.y" { #if 0 @@ -6448,12 +6332,10 @@ yyreduce: #endif (yyval.val) = dispatch1(top_const_ref, (yyvsp[(2) - (2)].val)); - } + ;} break; case 111: - -/* Line 1806 of yacc.c */ #line 1787 "ripper.y" { #if 0 @@ -6461,12 +6343,10 @@ yyreduce: #endif (yyval.val) = dispatch1(const_ref, (yyvsp[(1) - (1)].val)); - } + ;} break; case 112: - -/* Line 1806 of yacc.c */ #line 1795 "ripper.y" { #if 0 @@ -6474,22 +6354,18 @@ yyreduce: #endif (yyval.val) = dispatch2(const_path_ref, (yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 116: - -/* Line 1806 of yacc.c */ #line 1808 "ripper.y" { lex_state = EXPR_ENDFN; (yyval.val) = (yyvsp[(1) - (1)].val); - } + ;} break; case 117: - -/* Line 1806 of yacc.c */ #line 1813 "ripper.y" { lex_state = EXPR_ENDFN; @@ -6498,12 +6374,10 @@ yyreduce: #endif (yyval.val) = (yyvsp[(1) - (1)].val); - } + ;} break; case 120: - -/* Line 1806 of yacc.c */ #line 1828 "ripper.y" { #if 0 @@ -6511,12 +6385,10 @@ yyreduce: #endif (yyval.val) = dispatch1(symbol_literal, (yyvsp[(1) - (1)].val)); - } + ;} break; case 122: - -/* Line 1806 of yacc.c */ #line 1839 "ripper.y" { #if 0 @@ -6524,19 +6396,15 @@ yyreduce: #endif (yyval.val) = rb_ary_new3(1, (yyvsp[(1) - (1)].val)); - } + ;} break; case 123: - -/* Line 1806 of yacc.c */ #line 1846 "ripper.y" - {lex_state = EXPR_FNAME;} + {lex_state = EXPR_FNAME;;} break; case 124: - -/* Line 1806 of yacc.c */ #line 1847 "ripper.y" { #if 0 @@ -6544,215 +6412,155 @@ yyreduce: #endif rb_ary_push((yyvsp[(1) - (4)].val), (yyvsp[(4) - (4)].val)); - } + ;} break; case 125: - -/* Line 1806 of yacc.c */ #line 1856 "ripper.y" - { ifndef_ripper((yyval.val) = '|'); } + { ifndef_ripper((yyval.val) = '|'); ;} break; case 126: - -/* Line 1806 of yacc.c */ #line 1857 "ripper.y" - { ifndef_ripper((yyval.val) = '^'); } + { ifndef_ripper((yyval.val) = '^'); ;} break; case 127: - -/* Line 1806 of yacc.c */ #line 1858 "ripper.y" - { ifndef_ripper((yyval.val) = '&'); } + { ifndef_ripper((yyval.val) = '&'); ;} break; case 128: - -/* Line 1806 of yacc.c */ #line 1859 "ripper.y" - { ifndef_ripper((yyval.val) = tCMP); } + { ifndef_ripper((yyval.val) = tCMP); ;} break; case 129: - -/* Line 1806 of yacc.c */ #line 1860 "ripper.y" - { ifndef_ripper((yyval.val) = tEQ); } + { ifndef_ripper((yyval.val) = tEQ); ;} break; case 130: - -/* Line 1806 of yacc.c */ #line 1861 "ripper.y" - { ifndef_ripper((yyval.val) = tEQQ); } + { ifndef_ripper((yyval.val) = tEQQ); ;} break; case 131: - -/* Line 1806 of yacc.c */ #line 1862 "ripper.y" - { ifndef_ripper((yyval.val) = tMATCH); } + { ifndef_ripper((yyval.val) = tMATCH); ;} break; case 132: - -/* Line 1806 of yacc.c */ #line 1863 "ripper.y" - { ifndef_ripper((yyval.val) = tNMATCH); } + { ifndef_ripper((yyval.val) = tNMATCH); ;} break; case 133: - -/* Line 1806 of yacc.c */ #line 1864 "ripper.y" - { ifndef_ripper((yyval.val) = '>'); } + { ifndef_ripper((yyval.val) = '>'); ;} break; case 134: - -/* Line 1806 of yacc.c */ #line 1865 "ripper.y" - { ifndef_ripper((yyval.val) = tGEQ); } + { ifndef_ripper((yyval.val) = tGEQ); ;} break; case 135: - -/* Line 1806 of yacc.c */ #line 1866 "ripper.y" - { ifndef_ripper((yyval.val) = '<'); } + { ifndef_ripper((yyval.val) = '<'); ;} break; case 136: - -/* Line 1806 of yacc.c */ #line 1867 "ripper.y" - { ifndef_ripper((yyval.val) = tLEQ); } + { ifndef_ripper((yyval.val) = tLEQ); ;} break; case 137: - -/* Line 1806 of yacc.c */ #line 1868 "ripper.y" - { ifndef_ripper((yyval.val) = tNEQ); } + { ifndef_ripper((yyval.val) = tNEQ); ;} break; case 138: - -/* Line 1806 of yacc.c */ #line 1869 "ripper.y" - { ifndef_ripper((yyval.val) = tLSHFT); } + { ifndef_ripper((yyval.val) = tLSHFT); ;} break; case 139: - -/* Line 1806 of yacc.c */ #line 1870 "ripper.y" - { ifndef_ripper((yyval.val) = tRSHFT); } + { ifndef_ripper((yyval.val) = tRSHFT); ;} break; case 140: - -/* Line 1806 of yacc.c */ #line 1871 "ripper.y" - { ifndef_ripper((yyval.val) = '+'); } + { ifndef_ripper((yyval.val) = '+'); ;} break; case 141: - -/* Line 1806 of yacc.c */ #line 1872 "ripper.y" - { ifndef_ripper((yyval.val) = '-'); } + { ifndef_ripper((yyval.val) = '-'); ;} break; case 142: - -/* Line 1806 of yacc.c */ #line 1873 "ripper.y" - { ifndef_ripper((yyval.val) = '*'); } + { ifndef_ripper((yyval.val) = '*'); ;} break; case 143: - -/* Line 1806 of yacc.c */ #line 1874 "ripper.y" - { ifndef_ripper((yyval.val) = '*'); } + { ifndef_ripper((yyval.val) = '*'); ;} break; case 144: - -/* Line 1806 of yacc.c */ #line 1875 "ripper.y" - { ifndef_ripper((yyval.val) = '/'); } + { ifndef_ripper((yyval.val) = '/'); ;} break; case 145: - -/* Line 1806 of yacc.c */ #line 1876 "ripper.y" - { ifndef_ripper((yyval.val) = '%'); } + { ifndef_ripper((yyval.val) = '%'); ;} break; case 146: - -/* Line 1806 of yacc.c */ #line 1877 "ripper.y" - { ifndef_ripper((yyval.val) = tPOW); } + { ifndef_ripper((yyval.val) = tPOW); ;} break; case 147: - -/* Line 1806 of yacc.c */ #line 1878 "ripper.y" - { ifndef_ripper((yyval.val) = '!'); } + { ifndef_ripper((yyval.val) = '!'); ;} break; case 148: - -/* Line 1806 of yacc.c */ #line 1879 "ripper.y" - { ifndef_ripper((yyval.val) = '~'); } + { ifndef_ripper((yyval.val) = '~'); ;} break; case 149: - -/* Line 1806 of yacc.c */ #line 1880 "ripper.y" - { ifndef_ripper((yyval.val) = tUPLUS); } + { ifndef_ripper((yyval.val) = tUPLUS); ;} break; case 150: - -/* Line 1806 of yacc.c */ #line 1881 "ripper.y" - { ifndef_ripper((yyval.val) = tUMINUS); } + { ifndef_ripper((yyval.val) = tUMINUS); ;} break; case 151: - -/* Line 1806 of yacc.c */ #line 1882 "ripper.y" - { ifndef_ripper((yyval.val) = tAREF); } + { ifndef_ripper((yyval.val) = tAREF); ;} break; case 152: - -/* Line 1806 of yacc.c */ #line 1883 "ripper.y" - { ifndef_ripper((yyval.val) = tASET); } + { ifndef_ripper((yyval.val) = tASET); ;} break; case 153: - -/* Line 1806 of yacc.c */ #line 1884 "ripper.y" - { ifndef_ripper((yyval.val) = '`'); } + { ifndef_ripper((yyval.val) = '`'); ;} break; case 195: - -/* Line 1806 of yacc.c */ #line 1902 "ripper.y" { #if 0 @@ -6761,12 +6569,10 @@ yyreduce: #endif (yyval.val) = dispatch2(assign, (yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 196: - -/* Line 1806 of yacc.c */ #line 1911 "ripper.y" { #if 0 @@ -6776,12 +6582,10 @@ yyreduce: #endif (yyval.val) = dispatch2(assign, (yyvsp[(1) - (5)].val), dispatch2(rescue_mod, (yyvsp[(3) - (5)].val), (yyvsp[(5) - (5)].val))); - } + ;} break; case 197: - -/* Line 1806 of yacc.c */ #line 1921 "ripper.y" { #if 0 @@ -6810,12 +6614,10 @@ yyreduce: #endif (yyval.val) = dispatch3(opassign, (yyvsp[(1) - (3)].val), (yyvsp[(2) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 198: - -/* Line 1806 of yacc.c */ #line 1950 "ripper.y" { #if 0 @@ -6846,12 +6648,10 @@ yyreduce: (yyvsp[(3) - (5)].val) = dispatch2(rescue_mod, (yyvsp[(3) - (5)].val), (yyvsp[(5) - (5)].val)); (yyval.val) = dispatch3(opassign, (yyvsp[(1) - (5)].val), (yyvsp[(2) - (5)].val), (yyvsp[(3) - (5)].val)); - } + ;} break; case 199: - -/* Line 1806 of yacc.c */ #line 1981 "ripper.y" { #if 0 @@ -6877,12 +6677,10 @@ yyreduce: (yyvsp[(1) - (6)].val) = dispatch2(aref_field, (yyvsp[(1) - (6)].val), escape_Qundef((yyvsp[(3) - (6)].val))); (yyval.val) = dispatch3(opassign, (yyvsp[(1) - (6)].val), (yyvsp[(5) - (6)].val), (yyvsp[(6) - (6)].val)); - } + ;} break; case 200: - -/* Line 1806 of yacc.c */ #line 2007 "ripper.y" { #if 0 @@ -6899,12 +6697,10 @@ yyreduce: (yyvsp[(1) - (5)].val) = dispatch3(field, (yyvsp[(1) - (5)].val), ripper_id2sym('.'), (yyvsp[(3) - (5)].val)); (yyval.val) = dispatch3(opassign, (yyvsp[(1) - (5)].val), (yyvsp[(4) - (5)].val), (yyvsp[(5) - (5)].val)); - } + ;} break; case 201: - -/* Line 1806 of yacc.c */ #line 2024 "ripper.y" { #if 0 @@ -6921,12 +6717,10 @@ yyreduce: (yyvsp[(1) - (5)].val) = dispatch3(field, (yyvsp[(1) - (5)].val), ripper_id2sym('.'), (yyvsp[(3) - (5)].val)); (yyval.val) = dispatch3(opassign, (yyvsp[(1) - (5)].val), (yyvsp[(4) - (5)].val), (yyvsp[(5) - (5)].val)); - } + ;} break; case 202: - -/* Line 1806 of yacc.c */ #line 2041 "ripper.y" { #if 0 @@ -6943,12 +6737,10 @@ yyreduce: (yyvsp[(1) - (5)].val) = dispatch3(field, (yyvsp[(1) - (5)].val), ripper_intern("::"), (yyvsp[(3) - (5)].val)); (yyval.val) = dispatch3(opassign, (yyvsp[(1) - (5)].val), (yyvsp[(4) - (5)].val), (yyvsp[(5) - (5)].val)); - } + ;} break; case 203: - -/* Line 1806 of yacc.c */ #line 2058 "ripper.y" { #if 0 @@ -6959,12 +6751,10 @@ yyreduce: (yyval.val) = dispatch3(opassign, (yyval.val), (yyvsp[(4) - (5)].val), (yyvsp[(5) - (5)].val)); (yyval.val) = dispatch1(assign_error, (yyval.val)); - } + ;} break; case 204: - -/* Line 1806 of yacc.c */ #line 2069 "ripper.y" { #if 0 @@ -6975,12 +6765,10 @@ yyreduce: (yyval.val) = dispatch3(opassign, (yyval.val), (yyvsp[(3) - (4)].val), (yyvsp[(4) - (4)].val)); (yyval.val) = dispatch1(assign_error, (yyval.val)); - } + ;} break; case 205: - -/* Line 1806 of yacc.c */ #line 2080 "ripper.y" { #if 0 @@ -6991,12 +6779,10 @@ yyreduce: (yyval.val) = dispatch3(opassign, (yyval.val), (yyvsp[(2) - (3)].val), (yyvsp[(3) - (3)].val)); (yyval.val) = dispatch1(assign_error, (yyval.val)); - } + ;} break; case 206: - -/* Line 1806 of yacc.c */ #line 2091 "ripper.y" { #if 0 @@ -7010,12 +6796,10 @@ yyreduce: #endif (yyval.val) = dispatch2(dot2, (yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 207: - -/* Line 1806 of yacc.c */ #line 2105 "ripper.y" { #if 0 @@ -7029,12 +6813,10 @@ yyreduce: #endif (yyval.val) = dispatch2(dot3, (yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 208: - -/* Line 1806 of yacc.c */ #line 2119 "ripper.y" { #if 0 @@ -7042,12 +6824,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ID2SYM('+'), (yyvsp[(3) - (3)].val)); - } + ;} break; case 209: - -/* Line 1806 of yacc.c */ #line 2127 "ripper.y" { #if 0 @@ -7055,12 +6835,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ID2SYM('-'), (yyvsp[(3) - (3)].val)); - } + ;} break; case 210: - -/* Line 1806 of yacc.c */ #line 2135 "ripper.y" { #if 0 @@ -7068,12 +6846,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ID2SYM('*'), (yyvsp[(3) - (3)].val)); - } + ;} break; case 211: - -/* Line 1806 of yacc.c */ #line 2143 "ripper.y" { #if 0 @@ -7081,12 +6857,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ID2SYM('/'), (yyvsp[(3) - (3)].val)); - } + ;} break; case 212: - -/* Line 1806 of yacc.c */ #line 2151 "ripper.y" { #if 0 @@ -7094,12 +6868,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ID2SYM('%'), (yyvsp[(3) - (3)].val)); - } + ;} break; case 213: - -/* Line 1806 of yacc.c */ #line 2159 "ripper.y" { #if 0 @@ -7107,12 +6879,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ripper_intern("**"), (yyvsp[(3) - (3)].val)); - } + ;} break; case 214: - -/* Line 1806 of yacc.c */ #line 2167 "ripper.y" { #if 0 @@ -7121,12 +6891,10 @@ yyreduce: (yyval.val) = dispatch3(binary, (yyvsp[(2) - (4)].val), ripper_intern("**"), (yyvsp[(4) - (4)].val)); (yyval.val) = dispatch2(unary, ripper_intern("-@"), (yyval.val)); - } + ;} break; case 215: - -/* Line 1806 of yacc.c */ #line 2176 "ripper.y" { #if 0 @@ -7135,12 +6903,10 @@ yyreduce: (yyval.val) = dispatch3(binary, (yyvsp[(2) - (4)].val), ripper_intern("**"), (yyvsp[(4) - (4)].val)); (yyval.val) = dispatch2(unary, ripper_intern("-@"), (yyval.val)); - } + ;} break; case 216: - -/* Line 1806 of yacc.c */ #line 2185 "ripper.y" { #if 0 @@ -7148,12 +6914,10 @@ yyreduce: #endif (yyval.val) = dispatch2(unary, ripper_intern("+@"), (yyvsp[(2) - (2)].val)); - } + ;} break; case 217: - -/* Line 1806 of yacc.c */ #line 2193 "ripper.y" { #if 0 @@ -7161,12 +6925,10 @@ yyreduce: #endif (yyval.val) = dispatch2(unary, ripper_intern("-@"), (yyvsp[(2) - (2)].val)); - } + ;} break; case 218: - -/* Line 1806 of yacc.c */ #line 2201 "ripper.y" { #if 0 @@ -7174,12 +6936,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ID2SYM('|'), (yyvsp[(3) - (3)].val)); - } + ;} break; case 219: - -/* Line 1806 of yacc.c */ #line 2209 "ripper.y" { #if 0 @@ -7187,12 +6947,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ID2SYM('^'), (yyvsp[(3) - (3)].val)); - } + ;} break; case 220: - -/* Line 1806 of yacc.c */ #line 2217 "ripper.y" { #if 0 @@ -7200,12 +6958,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ID2SYM('&'), (yyvsp[(3) - (3)].val)); - } + ;} break; case 221: - -/* Line 1806 of yacc.c */ #line 2225 "ripper.y" { #if 0 @@ -7213,12 +6969,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ripper_intern("<=>"), (yyvsp[(3) - (3)].val)); - } + ;} break; case 222: - -/* Line 1806 of yacc.c */ #line 2233 "ripper.y" { #if 0 @@ -7226,12 +6980,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ID2SYM('>'), (yyvsp[(3) - (3)].val)); - } + ;} break; case 223: - -/* Line 1806 of yacc.c */ #line 2241 "ripper.y" { #if 0 @@ -7239,12 +6991,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ripper_intern(">="), (yyvsp[(3) - (3)].val)); - } + ;} break; case 224: - -/* Line 1806 of yacc.c */ #line 2249 "ripper.y" { #if 0 @@ -7252,12 +7002,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ID2SYM('<'), (yyvsp[(3) - (3)].val)); - } + ;} break; case 225: - -/* Line 1806 of yacc.c */ #line 2257 "ripper.y" { #if 0 @@ -7265,12 +7013,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ripper_intern("<="), (yyvsp[(3) - (3)].val)); - } + ;} break; case 226: - -/* Line 1806 of yacc.c */ #line 2265 "ripper.y" { #if 0 @@ -7278,12 +7024,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ripper_intern("=="), (yyvsp[(3) - (3)].val)); - } + ;} break; case 227: - -/* Line 1806 of yacc.c */ #line 2273 "ripper.y" { #if 0 @@ -7291,12 +7035,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ripper_intern("==="), (yyvsp[(3) - (3)].val)); - } + ;} break; case 228: - -/* Line 1806 of yacc.c */ #line 2281 "ripper.y" { #if 0 @@ -7304,12 +7046,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ripper_intern("!="), (yyvsp[(3) - (3)].val)); - } + ;} break; case 229: - -/* Line 1806 of yacc.c */ #line 2289 "ripper.y" { #if 0 @@ -7320,12 +7060,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ripper_intern("=~"), (yyvsp[(3) - (3)].val)); - } + ;} break; case 230: - -/* Line 1806 of yacc.c */ #line 2300 "ripper.y" { #if 0 @@ -7333,12 +7071,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ripper_intern("!~"), (yyvsp[(3) - (3)].val)); - } + ;} break; case 231: - -/* Line 1806 of yacc.c */ #line 2308 "ripper.y" { #if 0 @@ -7346,12 +7082,10 @@ yyreduce: #endif (yyval.val) = dispatch2(unary, ID2SYM('!'), (yyvsp[(2) - (2)].val)); - } + ;} break; case 232: - -/* Line 1806 of yacc.c */ #line 2316 "ripper.y" { #if 0 @@ -7359,12 +7093,10 @@ yyreduce: #endif (yyval.val) = dispatch2(unary, ID2SYM('~'), (yyvsp[(2) - (2)].val)); - } + ;} break; case 233: - -/* Line 1806 of yacc.c */ #line 2324 "ripper.y" { #if 0 @@ -7372,12 +7104,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ripper_intern("<<"), (yyvsp[(3) - (3)].val)); - } + ;} break; case 234: - -/* Line 1806 of yacc.c */ #line 2332 "ripper.y" { #if 0 @@ -7385,12 +7115,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ripper_intern(">>"), (yyvsp[(3) - (3)].val)); - } + ;} break; case 235: - -/* Line 1806 of yacc.c */ #line 2340 "ripper.y" { #if 0 @@ -7398,12 +7126,10 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ripper_intern("&&"), (yyvsp[(3) - (3)].val)); - } + ;} break; case 236: - -/* Line 1806 of yacc.c */ #line 2348 "ripper.y" { #if 0 @@ -7411,19 +7137,15 @@ yyreduce: #endif (yyval.val) = dispatch3(binary, (yyvsp[(1) - (3)].val), ripper_intern("||"), (yyvsp[(3) - (3)].val)); - } + ;} break; case 237: - -/* Line 1806 of yacc.c */ #line 2355 "ripper.y" - {in_defined = 1;} + {in_defined = 1;;} break; case 238: - -/* Line 1806 of yacc.c */ #line 2356 "ripper.y" { #if 0 @@ -7433,12 +7155,10 @@ yyreduce: in_defined = 0; (yyval.val) = dispatch1(defined, (yyvsp[(4) - (4)].val)); - } + ;} break; case 239: - -/* Line 1806 of yacc.c */ #line 2366 "ripper.y" { #if 0 @@ -7448,21 +7168,17 @@ yyreduce: #endif (yyval.val) = dispatch3(ifop, (yyvsp[(1) - (6)].val), (yyvsp[(3) - (6)].val), (yyvsp[(6) - (6)].val)); - } + ;} break; case 240: - -/* Line 1806 of yacc.c */ #line 2376 "ripper.y" { (yyval.val) = (yyvsp[(1) - (1)].val); - } + ;} break; case 241: - -/* Line 1806 of yacc.c */ #line 2382 "ripper.y" { #if 0 @@ -7472,21 +7188,17 @@ yyreduce: #endif (yyval.val) = (yyvsp[(1) - (1)].val); - } + ;} break; case 243: - -/* Line 1806 of yacc.c */ #line 2395 "ripper.y" { (yyval.val) = (yyvsp[(1) - (2)].val); - } + ;} break; case 244: - -/* Line 1806 of yacc.c */ #line 2399 "ripper.y" { #if 0 @@ -7494,12 +7206,10 @@ yyreduce: #endif (yyval.val) = arg_add_assocs((yyvsp[(1) - (4)].val), (yyvsp[(3) - (4)].val)); - } + ;} break; case 245: - -/* Line 1806 of yacc.c */ #line 2407 "ripper.y" { #if 0 @@ -7507,12 +7217,10 @@ yyreduce: #endif (yyval.val) = arg_add_assocs(arg_new(), (yyvsp[(1) - (2)].val)); - } + ;} break; case 246: - -/* Line 1806 of yacc.c */ #line 2417 "ripper.y" { #if 0 @@ -7520,21 +7228,17 @@ yyreduce: #endif (yyval.val) = dispatch1(arg_paren, escape_Qundef((yyvsp[(2) - (3)].val))); - } + ;} break; case 251: - -/* Line 1806 of yacc.c */ #line 2433 "ripper.y" { (yyval.val) = (yyvsp[(1) - (2)].val); - } + ;} break; case 252: - -/* Line 1806 of yacc.c */ #line 2437 "ripper.y" { #if 0 @@ -7542,12 +7246,10 @@ yyreduce: #endif (yyval.val) = arg_add_assocs((yyvsp[(1) - (4)].val), (yyvsp[(3) - (4)].val)); - } + ;} break; case 253: - -/* Line 1806 of yacc.c */ #line 2445 "ripper.y" { #if 0 @@ -7555,12 +7257,10 @@ yyreduce: #endif (yyval.val) = arg_add_assocs(arg_new(), (yyvsp[(1) - (2)].val)); - } + ;} break; case 254: - -/* Line 1806 of yacc.c */ #line 2455 "ripper.y" { #if 0 @@ -7569,12 +7269,10 @@ yyreduce: #endif (yyval.val) = arg_add(arg_new(), (yyvsp[(1) - (1)].val)); - } + ;} break; case 255: - -/* Line 1806 of yacc.c */ #line 2464 "ripper.y" { #if 0 @@ -7582,12 +7280,10 @@ yyreduce: #endif (yyval.val) = arg_add_optblock((yyvsp[(1) - (2)].val), (yyvsp[(2) - (2)].val)); - } + ;} break; case 256: - -/* Line 1806 of yacc.c */ #line 2472 "ripper.y" { #if 0 @@ -7597,12 +7293,10 @@ yyreduce: (yyval.val) = arg_add_assocs(arg_new(), (yyvsp[(1) - (2)].val)); (yyval.val) = arg_add_optblock((yyval.val), (yyvsp[(2) - (2)].val)); - } + ;} break; case 257: - -/* Line 1806 of yacc.c */ #line 2482 "ripper.y" { #if 0 @@ -7611,42 +7305,34 @@ yyreduce: #endif (yyval.val) = arg_add_optblock(arg_add_assocs((yyvsp[(1) - (4)].val), (yyvsp[(3) - (4)].val)), (yyvsp[(4) - (4)].val)); - } + ;} break; case 258: - -/* Line 1806 of yacc.c */ #line 2493 "ripper.y" { (yyval.val) = arg_add_block(arg_new(), (yyvsp[(1) - (1)].val)); - } + ;} break; case 259: - -/* Line 1806 of yacc.c */ #line 2499 "ripper.y" { (yyval.val) = cmdarg_stack; CMDARG_PUSH(1); - } + ;} break; case 260: - -/* Line 1806 of yacc.c */ #line 2504 "ripper.y" { /* CMDARG_POP() */ cmdarg_stack = (yyvsp[(1) - (2)].val); (yyval.val) = (yyvsp[(2) - (2)].val); - } + ;} break; case 261: - -/* Line 1806 of yacc.c */ #line 2512 "ripper.y" { #if 0 @@ -7654,30 +7340,24 @@ yyreduce: #endif (yyval.val) = (yyvsp[(2) - (2)].val); - } + ;} break; case 262: - -/* Line 1806 of yacc.c */ #line 2522 "ripper.y" { (yyval.val) = (yyvsp[(2) - (2)].val); - } + ;} break; case 263: - -/* Line 1806 of yacc.c */ #line 2526 "ripper.y" { (yyval.val) = 0; - } + ;} break; case 264: - -/* Line 1806 of yacc.c */ #line 2532 "ripper.y" { #if 0 @@ -7685,12 +7365,10 @@ yyreduce: #endif (yyval.val) = arg_add(arg_new(), (yyvsp[(1) - (1)].val)); - } + ;} break; case 265: - -/* Line 1806 of yacc.c */ #line 2540 "ripper.y" { #if 0 @@ -7698,12 +7376,10 @@ yyreduce: #endif (yyval.val) = arg_add_star(arg_new(), (yyvsp[(2) - (2)].val)); - } + ;} break; case 266: - -/* Line 1806 of yacc.c */ #line 2548 "ripper.y" { #if 0 @@ -7717,12 +7393,10 @@ yyreduce: #endif (yyval.val) = arg_add((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 267: - -/* Line 1806 of yacc.c */ #line 2562 "ripper.y" { #if 0 @@ -7736,12 +7410,10 @@ yyreduce: #endif (yyval.val) = arg_add_star((yyvsp[(1) - (4)].val), (yyvsp[(4) - (4)].val)); - } + ;} break; case 268: - -/* Line 1806 of yacc.c */ #line 2578 "ripper.y" { #if 0 @@ -7755,12 +7427,10 @@ yyreduce: #endif (yyval.val) = mrhs_add(args2mrhs((yyvsp[(1) - (3)].val)), (yyvsp[(3) - (3)].val)); - } + ;} break; case 269: - -/* Line 1806 of yacc.c */ #line 2592 "ripper.y" { #if 0 @@ -7775,12 +7445,10 @@ yyreduce: #endif (yyval.val) = mrhs_add_star(args2mrhs((yyvsp[(1) - (4)].val)), (yyvsp[(4) - (4)].val)); - } + ;} break; case 270: - -/* Line 1806 of yacc.c */ #line 2607 "ripper.y" { #if 0 @@ -7788,12 +7456,10 @@ yyreduce: #endif (yyval.val) = mrhs_add_star(mrhs_new(), (yyvsp[(2) - (2)].val)); - } + ;} break; case 279: - -/* Line 1806 of yacc.c */ #line 2625 "ripper.y" { #if 0 @@ -7801,24 +7467,20 @@ yyreduce: #endif (yyval.val) = method_arg(dispatch1(fcall, (yyvsp[(1) - (1)].val)), arg_new()); - } + ;} break; case 280: - -/* Line 1806 of yacc.c */ #line 2633 "ripper.y" { #if 0 (yyval.num) = ruby_sourceline; #endif - } + ;} break; case 281: - -/* Line 1806 of yacc.c */ #line 2641 "ripper.y" { #if 0 @@ -7835,19 +7497,15 @@ yyreduce: #endif (yyval.val) = dispatch1(begin, (yyvsp[(3) - (4)].val)); - } + ;} break; case 282: - -/* Line 1806 of yacc.c */ #line 2657 "ripper.y" - {lex_state = EXPR_ENDARG;} + {lex_state = EXPR_ENDARG;;} break; case 283: - -/* Line 1806 of yacc.c */ #line 2658 "ripper.y" { rb_warning0("(...) interpreted as grouped expression"); @@ -7856,12 +7514,10 @@ yyreduce: #endif (yyval.val) = dispatch1(paren, (yyvsp[(2) - (4)].val)); - } + ;} break; case 284: - -/* Line 1806 of yacc.c */ #line 2667 "ripper.y" { #if 0 @@ -7869,12 +7525,10 @@ yyreduce: #endif (yyval.val) = dispatch1(paren, (yyvsp[(2) - (3)].val)); - } + ;} break; case 285: - -/* Line 1806 of yacc.c */ #line 2675 "ripper.y" { #if 0 @@ -7882,12 +7536,10 @@ yyreduce: #endif (yyval.val) = dispatch2(const_path_ref, (yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 286: - -/* Line 1806 of yacc.c */ #line 2683 "ripper.y" { #if 0 @@ -7895,12 +7547,10 @@ yyreduce: #endif (yyval.val) = dispatch1(top_const_ref, (yyvsp[(2) - (2)].val)); - } + ;} break; case 287: - -/* Line 1806 of yacc.c */ #line 2691 "ripper.y" { #if 0 @@ -7913,12 +7563,10 @@ yyreduce: #endif (yyval.val) = dispatch1(array, escape_Qundef((yyvsp[(2) - (3)].val))); - } + ;} break; case 288: - -/* Line 1806 of yacc.c */ #line 2704 "ripper.y" { #if 0 @@ -7926,12 +7574,10 @@ yyreduce: #endif (yyval.val) = dispatch1(hash, escape_Qundef((yyvsp[(2) - (3)].val))); - } + ;} break; case 289: - -/* Line 1806 of yacc.c */ #line 2712 "ripper.y" { #if 0 @@ -7939,12 +7585,10 @@ yyreduce: #endif (yyval.val) = dispatch0(return0); - } + ;} break; case 290: - -/* Line 1806 of yacc.c */ #line 2720 "ripper.y" { #if 0 @@ -7952,12 +7596,10 @@ yyreduce: #endif (yyval.val) = dispatch1(yield, dispatch1(paren, (yyvsp[(3) - (4)].val))); - } + ;} break; case 291: - -/* Line 1806 of yacc.c */ #line 2728 "ripper.y" { #if 0 @@ -7965,12 +7607,10 @@ yyreduce: #endif (yyval.val) = dispatch1(yield, dispatch1(paren, arg_new())); - } + ;} break; case 292: - -/* Line 1806 of yacc.c */ #line 2736 "ripper.y" { #if 0 @@ -7978,19 +7618,15 @@ yyreduce: #endif (yyval.val) = dispatch0(yield0); - } + ;} break; case 293: - -/* Line 1806 of yacc.c */ #line 2743 "ripper.y" - {in_defined = 1;} + {in_defined = 1;;} break; case 294: - -/* Line 1806 of yacc.c */ #line 2744 "ripper.y" { #if 0 @@ -8000,12 +7636,10 @@ yyreduce: in_defined = 0; (yyval.val) = dispatch1(defined, (yyvsp[(5) - (6)].val)); - } + ;} break; case 295: - -/* Line 1806 of yacc.c */ #line 2754 "ripper.y" { #if 0 @@ -8013,12 +7647,10 @@ yyreduce: #endif (yyval.val) = dispatch2(unary, ripper_intern("not"), (yyvsp[(3) - (4)].val)); - } + ;} break; case 296: - -/* Line 1806 of yacc.c */ #line 2762 "ripper.y" { #if 0 @@ -8026,12 +7658,10 @@ yyreduce: #endif (yyval.val) = dispatch2(unary, ripper_intern("not"), Qnil); - } + ;} break; case 297: - -/* Line 1806 of yacc.c */ #line 2770 "ripper.y" { #if 0 @@ -8042,12 +7672,10 @@ yyreduce: (yyval.val) = method_arg(dispatch1(fcall, (yyvsp[(1) - (2)].val)), arg_new()); (yyval.val) = method_add_block((yyval.val), (yyvsp[(2) - (2)].val)); - } + ;} break; case 299: - -/* Line 1806 of yacc.c */ #line 2782 "ripper.y" { #if 0 @@ -8058,21 +7686,17 @@ yyreduce: #endif (yyval.val) = method_add_block((yyvsp[(1) - (2)].val), (yyvsp[(2) - (2)].val)); - } + ;} break; case 300: - -/* Line 1806 of yacc.c */ #line 2793 "ripper.y" { (yyval.val) = (yyvsp[(2) - (2)].val); - } + ;} break; case 301: - -/* Line 1806 of yacc.c */ #line 2800 "ripper.y" { #if 0 @@ -8081,12 +7705,10 @@ yyreduce: #endif (yyval.val) = dispatch3(if, (yyvsp[(2) - (6)].val), (yyvsp[(4) - (6)].val), escape_Qundef((yyvsp[(5) - (6)].val))); - } + ;} break; case 302: - -/* Line 1806 of yacc.c */ #line 2812 "ripper.y" { #if 0 @@ -8095,26 +7717,20 @@ yyreduce: #endif (yyval.val) = dispatch3(unless, (yyvsp[(2) - (6)].val), (yyvsp[(4) - (6)].val), escape_Qundef((yyvsp[(5) - (6)].val))); - } + ;} break; case 303: - -/* Line 1806 of yacc.c */ #line 2820 "ripper.y" - {COND_PUSH(1);} + {COND_PUSH(1);;} break; case 304: - -/* Line 1806 of yacc.c */ #line 2820 "ripper.y" - {COND_POP();} + {COND_POP();;} break; case 305: - -/* Line 1806 of yacc.c */ #line 2823 "ripper.y" { #if 0 @@ -8123,26 +7739,20 @@ yyreduce: #endif (yyval.val) = dispatch2(while, (yyvsp[(3) - (7)].val), (yyvsp[(6) - (7)].val)); - } + ;} break; case 306: - -/* Line 1806 of yacc.c */ #line 2831 "ripper.y" - {COND_PUSH(1);} + {COND_PUSH(1);;} break; case 307: - -/* Line 1806 of yacc.c */ #line 2831 "ripper.y" - {COND_POP();} + {COND_POP();;} break; case 308: - -/* Line 1806 of yacc.c */ #line 2834 "ripper.y" { #if 0 @@ -8151,12 +7761,10 @@ yyreduce: #endif (yyval.val) = dispatch2(until, (yyvsp[(3) - (7)].val), (yyvsp[(6) - (7)].val)); - } + ;} break; case 309: - -/* Line 1806 of yacc.c */ #line 2845 "ripper.y" { #if 0 @@ -8165,12 +7773,10 @@ yyreduce: #endif (yyval.val) = dispatch2(case, (yyvsp[(2) - (5)].val), (yyvsp[(4) - (5)].val)); - } + ;} break; case 310: - -/* Line 1806 of yacc.c */ #line 2854 "ripper.y" { #if 0 @@ -8178,26 +7784,20 @@ yyreduce: #endif (yyval.val) = dispatch2(case, Qnil, (yyvsp[(3) - (4)].val)); - } + ;} break; case 311: - -/* Line 1806 of yacc.c */ #line 2862 "ripper.y" - {COND_PUSH(1);} + {COND_PUSH(1);;} break; case 312: - -/* Line 1806 of yacc.c */ #line 2864 "ripper.y" - {COND_POP();} + {COND_POP();;} break; case 313: - -/* Line 1806 of yacc.c */ #line 2867 "ripper.y" { #if 0 @@ -8258,12 +7858,10 @@ yyreduce: #endif (yyval.val) = dispatch3(for, (yyvsp[(2) - (9)].val), (yyvsp[(5) - (9)].val), (yyvsp[(8) - (9)].val)); - } + ;} break; case 314: - -/* Line 1806 of yacc.c */ #line 2928 "ripper.y" { if (in_def || in_single) @@ -8273,12 +7871,10 @@ yyreduce: (yyval.num) = ruby_sourceline; #endif - } + ;} break; case 315: - -/* Line 1806 of yacc.c */ #line 2939 "ripper.y" { #if 0 @@ -8288,33 +7884,27 @@ yyreduce: (yyval.val) = dispatch3(class, (yyvsp[(2) - (6)].val), (yyvsp[(3) - (6)].val), (yyvsp[(5) - (6)].val)); local_pop(); - } + ;} break; case 316: - -/* Line 1806 of yacc.c */ #line 2949 "ripper.y" { (yyval.num) = in_def; in_def = 0; - } + ;} break; case 317: - -/* Line 1806 of yacc.c */ #line 2954 "ripper.y" { (yyval.num) = in_single; in_single = 0; local_push(0); - } + ;} break; case 318: - -/* Line 1806 of yacc.c */ #line 2961 "ripper.y" { #if 0 @@ -8326,12 +7916,10 @@ yyreduce: local_pop(); in_def = (yyvsp[(4) - (8)].num); in_single = (yyvsp[(6) - (8)].num); - } + ;} break; case 319: - -/* Line 1806 of yacc.c */ #line 2973 "ripper.y" { if (in_def || in_single) @@ -8341,12 +7929,10 @@ yyreduce: (yyval.num) = ruby_sourceline; #endif - } + ;} break; case 320: - -/* Line 1806 of yacc.c */ #line 2984 "ripper.y" { #if 0 @@ -8356,24 +7942,20 @@ yyreduce: (yyval.val) = dispatch2(module, (yyvsp[(2) - (5)].val), (yyvsp[(4) - (5)].val)); local_pop(); - } + ;} break; case 321: - -/* Line 1806 of yacc.c */ #line 2994 "ripper.y" { (yyval.id) = cur_mid; cur_mid = (yyvsp[(2) - (2)].val); in_def++; local_push(0); - } + ;} break; case 322: - -/* Line 1806 of yacc.c */ #line 3003 "ripper.y" { #if 0 @@ -8387,30 +7969,24 @@ yyreduce: local_pop(); in_def--; cur_mid = (yyvsp[(3) - (6)].id); - } + ;} break; case 323: - -/* Line 1806 of yacc.c */ #line 3016 "ripper.y" - {lex_state = EXPR_FNAME;} + {lex_state = EXPR_FNAME;;} break; case 324: - -/* Line 1806 of yacc.c */ #line 3017 "ripper.y" { in_single++; lex_state = EXPR_ENDFN; /* force for args */ local_push(0); - } + ;} break; case 325: - -/* Line 1806 of yacc.c */ #line 3025 "ripper.y" { #if 0 @@ -8423,12 +7999,10 @@ yyreduce: local_pop(); in_single--; - } + ;} break; case 326: - -/* Line 1806 of yacc.c */ #line 3038 "ripper.y" { #if 0 @@ -8436,12 +8010,10 @@ yyreduce: #endif (yyval.val) = dispatch1(break, arg_new()); - } + ;} break; case 327: - -/* Line 1806 of yacc.c */ #line 3046 "ripper.y" { #if 0 @@ -8449,12 +8021,10 @@ yyreduce: #endif (yyval.val) = dispatch1(next, arg_new()); - } + ;} break; case 328: - -/* Line 1806 of yacc.c */ #line 3054 "ripper.y" { #if 0 @@ -8462,12 +8032,10 @@ yyreduce: #endif (yyval.val) = dispatch0(redo); - } + ;} break; case 329: - -/* Line 1806 of yacc.c */ #line 3062 "ripper.y" { #if 0 @@ -8475,12 +8043,10 @@ yyreduce: #endif (yyval.val) = dispatch0(retry); - } + ;} break; case 330: - -/* Line 1806 of yacc.c */ #line 3072 "ripper.y" { #if 0 @@ -8490,93 +8056,73 @@ yyreduce: #endif (yyval.val) = (yyvsp[(1) - (1)].val); - } + ;} break; case 331: - -/* Line 1806 of yacc.c */ #line 3084 "ripper.y" { token_info_push("begin"); - } + ;} break; case 332: - -/* Line 1806 of yacc.c */ #line 3090 "ripper.y" { token_info_push("if"); - } + ;} break; case 333: - -/* Line 1806 of yacc.c */ #line 3096 "ripper.y" { token_info_push("unless"); - } + ;} break; case 334: - -/* Line 1806 of yacc.c */ #line 3102 "ripper.y" { token_info_push("while"); - } + ;} break; case 335: - -/* Line 1806 of yacc.c */ #line 3108 "ripper.y" { token_info_push("until"); - } + ;} break; case 336: - -/* Line 1806 of yacc.c */ #line 3114 "ripper.y" { token_info_push("case"); - } + ;} break; case 337: - -/* Line 1806 of yacc.c */ #line 3120 "ripper.y" { token_info_push("for"); - } + ;} break; case 338: - -/* Line 1806 of yacc.c */ #line 3126 "ripper.y" { token_info_push("class"); - } + ;} break; case 339: - -/* Line 1806 of yacc.c */ #line 3132 "ripper.y" { token_info_push("module"); - } + ;} break; case 340: - -/* Line 1806 of yacc.c */ #line 3138 "ripper.y" { token_info_push("def"); @@ -8584,42 +8130,32 @@ yyreduce: (yyval.num) = ruby_sourceline; #endif - } + ;} break; case 341: - -/* Line 1806 of yacc.c */ #line 3148 "ripper.y" { token_info_pop("end"); - } + ;} break; case 342: - -/* Line 1806 of yacc.c */ #line 3156 "ripper.y" - { (yyval.val) = Qnil; } + { (yyval.val) = Qnil; ;} break; case 344: - -/* Line 1806 of yacc.c */ #line 3162 "ripper.y" - { (yyval.val) = (yyvsp[(2) - (2)].val); } + { (yyval.val) = (yyvsp[(2) - (2)].val); ;} break; case 345: - -/* Line 1806 of yacc.c */ #line 3169 "ripper.y" - { (yyval.val) = Qnil; } + { (yyval.val) = Qnil; ;} break; case 348: - -/* Line 1806 of yacc.c */ #line 3178 "ripper.y" { #if 0 @@ -8628,12 +8164,10 @@ yyreduce: #endif (yyval.val) = dispatch3(elsif, (yyvsp[(2) - (5)].val), (yyvsp[(4) - (5)].val), escape_Qundef((yyvsp[(5) - (5)].val))); - } + ;} break; case 350: - -/* Line 1806 of yacc.c */ #line 3190 "ripper.y" { #if 0 @@ -8641,12 +8175,10 @@ yyreduce: #endif (yyval.val) = dispatch1(else, (yyvsp[(2) - (2)].val)); - } + ;} break; case 353: - -/* Line 1806 of yacc.c */ #line 3204 "ripper.y" { (yyval.val) = assignable((yyvsp[(1) - (1)].val), 0); @@ -8654,12 +8186,10 @@ yyreduce: #endif (yyval.val) = dispatch1(mlhs_paren, (yyval.val)); - } + ;} break; case 354: - -/* Line 1806 of yacc.c */ #line 3212 "ripper.y" { #if 0 @@ -8667,12 +8197,10 @@ yyreduce: #endif (yyval.val) = dispatch1(mlhs_paren, (yyvsp[(2) - (3)].val)); - } + ;} break; case 355: - -/* Line 1806 of yacc.c */ #line 3222 "ripper.y" { #if 0 @@ -8680,12 +8208,10 @@ yyreduce: #endif (yyval.val) = mlhs_add(mlhs_new(), (yyvsp[(1) - (1)].val)); - } + ;} break; case 356: - -/* Line 1806 of yacc.c */ #line 3230 "ripper.y" { #if 0 @@ -8693,12 +8219,10 @@ yyreduce: #endif (yyval.val) = mlhs_add((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 357: - -/* Line 1806 of yacc.c */ #line 3240 "ripper.y" { #if 0 @@ -8706,12 +8230,10 @@ yyreduce: #endif (yyval.val) = (yyvsp[(1) - (1)].val); - } + ;} break; case 358: - -/* Line 1806 of yacc.c */ #line 3248 "ripper.y" { (yyval.val) = assignable((yyvsp[(4) - (4)].val), 0); @@ -8720,12 +8242,10 @@ yyreduce: #endif (yyval.val) = mlhs_add_star((yyvsp[(1) - (4)].val), (yyval.val)); - } + ;} break; case 359: - -/* Line 1806 of yacc.c */ #line 3257 "ripper.y" { (yyval.val) = assignable((yyvsp[(4) - (6)].val), 0); @@ -8734,12 +8254,10 @@ yyreduce: #endif (yyval.val) = mlhs_add_star((yyvsp[(1) - (6)].val), (yyval.val)); - } + ;} break; case 360: - -/* Line 1806 of yacc.c */ #line 3266 "ripper.y" { #if 0 @@ -8747,12 +8265,10 @@ yyreduce: #endif (yyval.val) = mlhs_add_star((yyvsp[(1) - (3)].val), Qnil); - } + ;} break; case 361: - -/* Line 1806 of yacc.c */ #line 3274 "ripper.y" { #if 0 @@ -8760,12 +8276,10 @@ yyreduce: #endif (yyval.val) = mlhs_add_star((yyvsp[(1) - (5)].val), (yyvsp[(5) - (5)].val)); - } + ;} break; case 362: - -/* Line 1806 of yacc.c */ #line 3282 "ripper.y" { (yyval.val) = assignable((yyvsp[(2) - (2)].val), 0); @@ -8774,12 +8288,10 @@ yyreduce: #endif (yyval.val) = mlhs_add_star(mlhs_new(), (yyval.val)); - } + ;} break; case 363: - -/* Line 1806 of yacc.c */ #line 3291 "ripper.y" { (yyval.val) = assignable((yyvsp[(2) - (4)].val), 0); @@ -8791,12 +8303,10 @@ yyreduce: #endif (yyval.val) = mlhs_add_star((yyval.val), (yyvsp[(4) - (4)].val)); - } + ;} break; case 364: - -/* Line 1806 of yacc.c */ #line 3303 "ripper.y" { #if 0 @@ -8804,12 +8314,10 @@ yyreduce: #endif (yyval.val) = mlhs_add_star(mlhs_new(), Qnil); - } + ;} break; case 365: - -/* Line 1806 of yacc.c */ #line 3311 "ripper.y" { #if 0 @@ -8817,12 +8325,10 @@ yyreduce: #endif (yyval.val) = mlhs_add_star(mlhs_new(), Qnil); - } + ;} break; case 366: - -/* Line 1806 of yacc.c */ #line 3321 "ripper.y" { #if 0 @@ -8830,12 +8336,10 @@ yyreduce: #endif (yyval.val) = params_new((yyvsp[(1) - (6)].val), (yyvsp[(3) - (6)].val), (yyvsp[(5) - (6)].val), Qnil, escape_Qundef((yyvsp[(6) - (6)].val))); - } + ;} break; case 367: - -/* Line 1806 of yacc.c */ #line 3329 "ripper.y" { #if 0 @@ -8843,12 +8347,10 @@ yyreduce: #endif (yyval.val) = params_new((yyvsp[(1) - (8)].val), (yyvsp[(3) - (8)].val), (yyvsp[(5) - (8)].val), (yyvsp[(7) - (8)].val), escape_Qundef((yyvsp[(8) - (8)].val))); - } + ;} break; case 368: - -/* Line 1806 of yacc.c */ #line 3337 "ripper.y" { #if 0 @@ -8856,12 +8358,10 @@ yyreduce: #endif (yyval.val) = params_new((yyvsp[(1) - (4)].val), (yyvsp[(3) - (4)].val), Qnil, Qnil, escape_Qundef((yyvsp[(4) - (4)].val))); - } + ;} break; case 369: - -/* Line 1806 of yacc.c */ #line 3345 "ripper.y" { #if 0 @@ -8869,12 +8369,10 @@ yyreduce: #endif (yyval.val) = params_new((yyvsp[(1) - (6)].val), (yyvsp[(3) - (6)].val), Qnil, (yyvsp[(5) - (6)].val), escape_Qundef((yyvsp[(6) - (6)].val))); - } + ;} break; case 370: - -/* Line 1806 of yacc.c */ #line 3353 "ripper.y" { #if 0 @@ -8882,12 +8380,10 @@ yyreduce: #endif (yyval.val) = params_new((yyvsp[(1) - (4)].val), Qnil, (yyvsp[(3) - (4)].val), Qnil, escape_Qundef((yyvsp[(4) - (4)].val))); - } + ;} break; case 371: - -/* Line 1806 of yacc.c */ #line 3361 "ripper.y" { #if 0 @@ -8896,12 +8392,10 @@ yyreduce: (yyval.val) = params_new((yyvsp[(1) - (2)].val), Qnil, Qnil, Qnil, Qnil); dispatch1(excessed_comma, (yyval.val)); - } + ;} break; case 372: - -/* Line 1806 of yacc.c */ #line 3370 "ripper.y" { #if 0 @@ -8909,12 +8403,10 @@ yyreduce: #endif (yyval.val) = params_new((yyvsp[(1) - (6)].val), Qnil, (yyvsp[(3) - (6)].val), (yyvsp[(5) - (6)].val), escape_Qundef((yyvsp[(6) - (6)].val))); - } + ;} break; case 373: - -/* Line 1806 of yacc.c */ #line 3378 "ripper.y" { #if 0 @@ -8922,12 +8414,10 @@ yyreduce: #endif (yyval.val) = params_new((yyvsp[(1) - (2)].val), Qnil,Qnil, Qnil, escape_Qundef((yyvsp[(2) - (2)].val))); - } + ;} break; case 374: - -/* Line 1806 of yacc.c */ #line 3386 "ripper.y" { #if 0 @@ -8935,12 +8425,10 @@ yyreduce: #endif (yyval.val) = params_new(Qnil, (yyvsp[(1) - (4)].val), (yyvsp[(3) - (4)].val), Qnil, escape_Qundef((yyvsp[(4) - (4)].val))); - } + ;} break; case 375: - -/* Line 1806 of yacc.c */ #line 3394 "ripper.y" { #if 0 @@ -8948,12 +8436,10 @@ yyreduce: #endif (yyval.val) = params_new(Qnil, (yyvsp[(1) - (6)].val), (yyvsp[(3) - (6)].val), (yyvsp[(5) - (6)].val), escape_Qundef((yyvsp[(6) - (6)].val))); - } + ;} break; case 376: - -/* Line 1806 of yacc.c */ #line 3402 "ripper.y" { #if 0 @@ -8961,12 +8447,10 @@ yyreduce: #endif (yyval.val) = params_new(Qnil, (yyvsp[(1) - (2)].val), Qnil, Qnil,escape_Qundef((yyvsp[(2) - (2)].val))); - } + ;} break; case 377: - -/* Line 1806 of yacc.c */ #line 3410 "ripper.y" { #if 0 @@ -8974,12 +8458,10 @@ yyreduce: #endif (yyval.val) = params_new(Qnil, (yyvsp[(1) - (4)].val), Qnil, (yyvsp[(3) - (4)].val), escape_Qundef((yyvsp[(4) - (4)].val))); - } + ;} break; case 378: - -/* Line 1806 of yacc.c */ #line 3418 "ripper.y" { #if 0 @@ -8987,12 +8469,10 @@ yyreduce: #endif (yyval.val) = params_new(Qnil, Qnil, (yyvsp[(1) - (2)].val), Qnil, escape_Qundef((yyvsp[(2) - (2)].val))); - } + ;} break; case 379: - -/* Line 1806 of yacc.c */ #line 3426 "ripper.y" { #if 0 @@ -9000,12 +8480,10 @@ yyreduce: #endif (yyval.val) = params_new(Qnil, Qnil, (yyvsp[(1) - (4)].val), (yyvsp[(3) - (4)].val), escape_Qundef((yyvsp[(4) - (4)].val))); - } + ;} break; case 380: - -/* Line 1806 of yacc.c */ #line 3434 "ripper.y" { #if 0 @@ -9013,21 +8491,17 @@ yyreduce: #endif (yyval.val) = params_new(Qnil, Qnil, Qnil, Qnil, (yyvsp[(1) - (1)].val)); - } + ;} break; case 382: - -/* Line 1806 of yacc.c */ #line 3445 "ripper.y" { command_start = TRUE; - } + ;} break; case 383: - -/* Line 1806 of yacc.c */ #line 3451 "ripper.y" { #if 0 @@ -9036,12 +8510,10 @@ yyreduce: (yyval.val) = blockvar_new(params_new(Qnil,Qnil,Qnil,Qnil,Qnil), escape_Qundef((yyvsp[(2) - (3)].val))); - } + ;} break; case 384: - -/* Line 1806 of yacc.c */ #line 3460 "ripper.y" { #if 0 @@ -9050,12 +8522,10 @@ yyreduce: (yyval.val) = blockvar_new(params_new(Qnil,Qnil,Qnil,Qnil,Qnil), Qnil); - } + ;} break; case 385: - -/* Line 1806 of yacc.c */ #line 3469 "ripper.y" { #if 0 @@ -9063,12 +8533,10 @@ yyreduce: #endif (yyval.val) = blockvar_new(escape_Qundef((yyvsp[(2) - (4)].val)), escape_Qundef((yyvsp[(3) - (4)].val))); - } + ;} break; case 387: - -/* Line 1806 of yacc.c */ #line 3481 "ripper.y" { #if 0 @@ -9076,30 +8544,24 @@ yyreduce: #endif (yyval.val) = (yyvsp[(2) - (2)].val); - } + ;} break; case 388: - -/* Line 1806 of yacc.c */ #line 3493 "ripper.y" { (yyval.val) = rb_ary_new3(1, (yyvsp[(1) - (1)].val)); - } + ;} break; case 389: - -/* Line 1806 of yacc.c */ #line 3500 "ripper.y" { rb_ary_push((yyval.val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 390: - -/* Line 1806 of yacc.c */ #line 3507 "ripper.y" { new_bv(get_id((yyvsp[(1) - (1)].val))); @@ -9107,40 +8569,32 @@ yyreduce: #endif (yyval.val) = get_value((yyvsp[(1) - (1)].val)); - } + ;} break; case 391: - -/* Line 1806 of yacc.c */ #line 3515 "ripper.y" { (yyval.val) = 0; - } + ;} break; case 392: - -/* Line 1806 of yacc.c */ #line 3520 "ripper.y" { (yyval.vars) = dyna_push(); - } + ;} break; case 393: - -/* Line 1806 of yacc.c */ #line 3523 "ripper.y" { (yyval.num) = lpar_beg; lpar_beg = ++paren_nest; - } + ;} break; case 394: - -/* Line 1806 of yacc.c */ #line 3529 "ripper.y" { lpar_beg = (yyvsp[(2) - (4)].num); @@ -9151,12 +8605,10 @@ yyreduce: (yyval.val) = dispatch2(lambda, (yyvsp[(3) - (4)].val), (yyvsp[(4) - (4)].val)); dyna_pop((yyvsp[(1) - (4)].vars)); - } + ;} break; case 395: - -/* Line 1806 of yacc.c */ #line 3542 "ripper.y" { #if 0 @@ -9164,12 +8616,10 @@ yyreduce: #endif (yyval.val) = dispatch1(paren, (yyvsp[(2) - (4)].val)); - } + ;} break; case 396: - -/* Line 1806 of yacc.c */ #line 3550 "ripper.y" { #if 0 @@ -9177,42 +8627,34 @@ yyreduce: #endif (yyval.val) = (yyvsp[(1) - (1)].val); - } + ;} break; case 397: - -/* Line 1806 of yacc.c */ #line 3560 "ripper.y" { (yyval.val) = (yyvsp[(2) - (3)].val); - } + ;} break; case 398: - -/* Line 1806 of yacc.c */ #line 3564 "ripper.y" { (yyval.val) = (yyvsp[(2) - (3)].val); - } + ;} break; case 399: - -/* Line 1806 of yacc.c */ #line 3570 "ripper.y" { (yyvsp[(1) - (1)].vars) = dyna_push(); #if 0 (yyval.num) = ruby_sourceline; #endif - } + ;} break; case 400: - -/* Line 1806 of yacc.c */ #line 3579 "ripper.y" { #if 0 @@ -9222,12 +8664,10 @@ yyreduce: (yyval.val) = dispatch2(do_block, escape_Qundef((yyvsp[(3) - (5)].val)), (yyvsp[(4) - (5)].val)); dyna_pop((yyvsp[(1) - (5)].vars)); - } + ;} break; case 401: - -/* Line 1806 of yacc.c */ #line 3591 "ripper.y" { #if 0 @@ -9243,12 +8683,10 @@ yyreduce: #endif (yyval.val) = method_add_block((yyvsp[(1) - (2)].val), (yyvsp[(2) - (2)].val)); - } + ;} break; case 402: - -/* Line 1806 of yacc.c */ #line 3607 "ripper.y" { #if 0 @@ -9257,12 +8695,10 @@ yyreduce: (yyval.val) = dispatch3(call, (yyvsp[(1) - (4)].val), ripper_id2sym('.'), (yyvsp[(3) - (4)].val)); (yyval.val) = method_optarg((yyval.val), (yyvsp[(4) - (4)].val)); - } + ;} break; case 403: - -/* Line 1806 of yacc.c */ #line 3616 "ripper.y" { #if 0 @@ -9271,12 +8707,10 @@ yyreduce: (yyval.val) = dispatch3(call, (yyvsp[(1) - (4)].val), ripper_intern("::"), (yyvsp[(3) - (4)].val)); (yyval.val) = method_optarg((yyval.val), (yyvsp[(4) - (4)].val)); - } + ;} break; case 404: - -/* Line 1806 of yacc.c */ #line 3627 "ripper.y" { #if 0 @@ -9285,12 +8719,10 @@ yyreduce: #endif (yyval.val) = method_arg(dispatch1(fcall, (yyvsp[(1) - (2)].val)), (yyvsp[(2) - (2)].val)); - } + ;} break; case 405: - -/* Line 1806 of yacc.c */ #line 3636 "ripper.y" { #if 0 @@ -9300,12 +8732,10 @@ yyreduce: (yyval.val) = dispatch3(call, (yyvsp[(1) - (4)].val), ripper_id2sym('.'), (yyvsp[(3) - (4)].val)); (yyval.val) = method_optarg((yyval.val), (yyvsp[(4) - (4)].val)); - } + ;} break; case 406: - -/* Line 1806 of yacc.c */ #line 3646 "ripper.y" { #if 0 @@ -9315,12 +8745,10 @@ yyreduce: (yyval.val) = dispatch3(call, (yyvsp[(1) - (4)].val), ripper_id2sym('.'), (yyvsp[(3) - (4)].val)); (yyval.val) = method_optarg((yyval.val), (yyvsp[(4) - (4)].val)); - } + ;} break; case 407: - -/* Line 1806 of yacc.c */ #line 3656 "ripper.y" { #if 0 @@ -9328,12 +8756,10 @@ yyreduce: #endif (yyval.val) = dispatch3(call, (yyvsp[(1) - (3)].val), ripper_intern("::"), (yyvsp[(3) - (3)].val)); - } + ;} break; case 408: - -/* Line 1806 of yacc.c */ #line 3664 "ripper.y" { #if 0 @@ -9344,12 +8770,10 @@ yyreduce: ripper_intern("call")); (yyval.val) = method_optarg((yyval.val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 409: - -/* Line 1806 of yacc.c */ #line 3675 "ripper.y" { #if 0 @@ -9360,12 +8784,10 @@ yyreduce: ripper_intern("call")); (yyval.val) = method_optarg((yyval.val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 410: - -/* Line 1806 of yacc.c */ #line 3686 "ripper.y" { #if 0 @@ -9373,12 +8795,10 @@ yyreduce: #endif (yyval.val) = dispatch1(super, (yyvsp[(2) - (2)].val)); - } + ;} break; case 411: - -/* Line 1806 of yacc.c */ #line 3694 "ripper.y" { #if 0 @@ -9386,12 +8806,10 @@ yyreduce: #endif (yyval.val) = dispatch0(zsuper); - } + ;} break; case 412: - -/* Line 1806 of yacc.c */ #line 3702 "ripper.y" { #if 0 @@ -9403,12 +8821,10 @@ yyreduce: #endif (yyval.val) = dispatch2(aref, (yyvsp[(1) - (4)].val), escape_Qundef((yyvsp[(3) - (4)].val))); - } + ;} break; case 413: - -/* Line 1806 of yacc.c */ #line 3716 "ripper.y" { (yyvsp[(1) - (1)].vars) = dyna_push(); @@ -9416,12 +8832,10 @@ yyreduce: (yyval.num) = ruby_sourceline; #endif - } + ;} break; case 414: - -/* Line 1806 of yacc.c */ #line 3725 "ripper.y" { #if 0 @@ -9431,12 +8845,10 @@ yyreduce: (yyval.val) = dispatch2(brace_block, escape_Qundef((yyvsp[(3) - (5)].val)), (yyvsp[(4) - (5)].val)); dyna_pop((yyvsp[(1) - (5)].vars)); - } + ;} break; case 415: - -/* Line 1806 of yacc.c */ #line 3735 "ripper.y" { (yyvsp[(1) - (1)].vars) = dyna_push(); @@ -9444,12 +8856,10 @@ yyreduce: (yyval.num) = ruby_sourceline; #endif - } + ;} break; case 416: - -/* Line 1806 of yacc.c */ #line 3744 "ripper.y" { #if 0 @@ -9459,12 +8869,10 @@ yyreduce: (yyval.val) = dispatch2(do_block, escape_Qundef((yyvsp[(3) - (5)].val)), (yyvsp[(4) - (5)].val)); dyna_pop((yyvsp[(1) - (5)].vars)); - } + ;} break; case 417: - -/* Line 1806 of yacc.c */ #line 3758 "ripper.y" { #if 0 @@ -9472,12 +8880,10 @@ yyreduce: #endif (yyval.val) = dispatch3(when, (yyvsp[(2) - (5)].val), (yyvsp[(4) - (5)].val), escape_Qundef((yyvsp[(5) - (5)].val))); - } + ;} break; case 420: - -/* Line 1806 of yacc.c */ #line 3774 "ripper.y" { #if 0 @@ -9494,12 +8900,10 @@ yyreduce: escape_Qundef((yyvsp[(5) - (6)].val)), escape_Qundef((yyvsp[(6) - (6)].val))); - } + ;} break; case 422: - -/* Line 1806 of yacc.c */ #line 3794 "ripper.y" { #if 0 @@ -9507,12 +8911,10 @@ yyreduce: #endif (yyval.val) = rb_ary_new3(1, (yyvsp[(1) - (1)].val)); - } + ;} break; case 423: - -/* Line 1806 of yacc.c */ #line 3802 "ripper.y" { #if 0 @@ -9520,21 +8922,17 @@ yyreduce: #endif (yyval.val) = (yyvsp[(1) - (1)].val); - } + ;} break; case 425: - -/* Line 1806 of yacc.c */ #line 3813 "ripper.y" { (yyval.val) = (yyvsp[(2) - (2)].val); - } + ;} break; case 427: - -/* Line 1806 of yacc.c */ #line 3820 "ripper.y" { #if 0 @@ -9542,12 +8940,10 @@ yyreduce: #endif (yyval.val) = dispatch1(ensure, (yyvsp[(2) - (2)].val)); - } + ;} break; case 430: - -/* Line 1806 of yacc.c */ #line 3832 "ripper.y" { #if 0 @@ -9555,12 +8951,10 @@ yyreduce: #endif (yyval.val) = dispatch1(symbol_literal, (yyvsp[(1) - (1)].val)); - } + ;} break; case 432: - -/* Line 1806 of yacc.c */ #line 3843 "ripper.y" { #if 0 @@ -9575,12 +8969,10 @@ yyreduce: #endif (yyval.val) = (yyvsp[(1) - (1)].val); - } + ;} break; case 435: - -/* Line 1806 of yacc.c */ #line 3862 "ripper.y" { #if 0 @@ -9588,12 +8980,10 @@ yyreduce: #endif (yyval.val) = dispatch2(string_concat, (yyvsp[(1) - (2)].val), (yyvsp[(2) - (2)].val)); - } + ;} break; case 436: - -/* Line 1806 of yacc.c */ #line 3872 "ripper.y" { #if 0 @@ -9601,12 +8991,10 @@ yyreduce: #endif (yyval.val) = dispatch1(string_literal, (yyvsp[(2) - (3)].val)); - } + ;} break; case 437: - -/* Line 1806 of yacc.c */ #line 3882 "ripper.y" { #if 0 @@ -9631,12 +9019,10 @@ yyreduce: #endif (yyval.val) = dispatch1(xstring_literal, (yyvsp[(2) - (3)].val)); - } + ;} break; case 438: - -/* Line 1806 of yacc.c */ #line 3909 "ripper.y" { #if 0 @@ -9699,12 +9085,10 @@ yyreduce: #endif (yyval.val) = dispatch2(regexp_literal, (yyvsp[(2) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 439: - -/* Line 1806 of yacc.c */ #line 3974 "ripper.y" { #if 0 @@ -9713,12 +9097,10 @@ yyreduce: (yyval.val) = dispatch0(words_new); (yyval.val) = dispatch1(array, (yyval.val)); - } + ;} break; case 440: - -/* Line 1806 of yacc.c */ #line 3983 "ripper.y" { #if 0 @@ -9726,12 +9108,10 @@ yyreduce: #endif (yyval.val) = dispatch1(array, (yyvsp[(2) - (3)].val)); - } + ;} break; case 441: - -/* Line 1806 of yacc.c */ #line 3993 "ripper.y" { #if 0 @@ -9739,12 +9119,10 @@ yyreduce: #endif (yyval.val) = dispatch0(words_new); - } + ;} break; case 442: - -/* Line 1806 of yacc.c */ #line 4001 "ripper.y" { #if 0 @@ -9752,22 +9130,18 @@ yyreduce: #endif (yyval.val) = dispatch2(words_add, (yyvsp[(1) - (3)].val), (yyvsp[(2) - (3)].val)); - } + ;} break; case 443: - -/* Line 1806 of yacc.c */ #line 4013 "ripper.y" { (yyval.val) = dispatch0(word_new); (yyval.val) = dispatch2(word_add, (yyval.val), (yyvsp[(1) - (1)].val)); - } + ;} break; case 444: - -/* Line 1806 of yacc.c */ #line 4019 "ripper.y" { #if 0 @@ -9775,12 +9149,10 @@ yyreduce: #endif (yyval.val) = dispatch2(word_add, (yyvsp[(1) - (2)].val), (yyvsp[(2) - (2)].val)); - } + ;} break; case 445: - -/* Line 1806 of yacc.c */ #line 4029 "ripper.y" { #if 0 @@ -9789,12 +9161,10 @@ yyreduce: (yyval.val) = dispatch0(qwords_new); (yyval.val) = dispatch1(array, (yyval.val)); - } + ;} break; case 446: - -/* Line 1806 of yacc.c */ #line 4038 "ripper.y" { #if 0 @@ -9802,12 +9172,10 @@ yyreduce: #endif (yyval.val) = dispatch1(array, (yyvsp[(2) - (3)].val)); - } + ;} break; case 447: - -/* Line 1806 of yacc.c */ #line 4048 "ripper.y" { #if 0 @@ -9815,12 +9183,10 @@ yyreduce: #endif (yyval.val) = dispatch0(qwords_new); - } + ;} break; case 448: - -/* Line 1806 of yacc.c */ #line 4056 "ripper.y" { #if 0 @@ -9828,12 +9194,10 @@ yyreduce: #endif (yyval.val) = dispatch2(qwords_add, (yyvsp[(1) - (3)].val), (yyvsp[(2) - (3)].val)); - } + ;} break; case 449: - -/* Line 1806 of yacc.c */ #line 4066 "ripper.y" { #if 0 @@ -9841,12 +9205,10 @@ yyreduce: #endif (yyval.val) = dispatch0(string_content); - } + ;} break; case 450: - -/* Line 1806 of yacc.c */ #line 4074 "ripper.y" { #if 0 @@ -9854,12 +9216,10 @@ yyreduce: #endif (yyval.val) = dispatch2(string_add, (yyvsp[(1) - (2)].val), (yyvsp[(2) - (2)].val)); - } + ;} break; case 451: - -/* Line 1806 of yacc.c */ #line 4084 "ripper.y" { #if 0 @@ -9867,12 +9227,10 @@ yyreduce: #endif (yyval.val) = dispatch0(xstring_new); - } + ;} break; case 452: - -/* Line 1806 of yacc.c */ #line 4092 "ripper.y" { #if 0 @@ -9880,12 +9238,10 @@ yyreduce: #endif (yyval.val) = dispatch2(xstring_add, (yyvsp[(1) - (2)].val), (yyvsp[(2) - (2)].val)); - } + ;} break; case 453: - -/* Line 1806 of yacc.c */ #line 4102 "ripper.y" { #if 0 @@ -9893,12 +9249,10 @@ yyreduce: #endif (yyval.val) = dispatch0(regexp_new); - } + ;} break; case 454: - -/* Line 1806 of yacc.c */ #line 4110 "ripper.y" { #if 0 @@ -9925,23 +9279,19 @@ yyreduce: #endif (yyval.val) = dispatch2(regexp_add, (yyvsp[(1) - (2)].val), (yyvsp[(2) - (2)].val)); - } + ;} break; case 456: - -/* Line 1806 of yacc.c */ #line 4140 "ripper.y" { (yyval.node) = lex_strterm; lex_strterm = 0; lex_state = EXPR_BEG; - } + ;} break; case 457: - -/* Line 1806 of yacc.c */ #line 4146 "ripper.y" { #if 0 @@ -9951,35 +9301,29 @@ yyreduce: lex_strterm = (yyvsp[(2) - (3)].node); (yyval.val) = dispatch1(string_dvar, (yyvsp[(3) - (3)].val)); - } + ;} break; case 458: - -/* Line 1806 of yacc.c */ #line 4156 "ripper.y" { (yyvsp[(1) - (1)].val) = cond_stack; (yyval.val) = cmdarg_stack; cond_stack = 0; cmdarg_stack = 0; - } + ;} break; case 459: - -/* Line 1806 of yacc.c */ #line 4162 "ripper.y" { (yyval.node) = lex_strterm; lex_strterm = 0; lex_state = EXPR_BEG; - } + ;} break; case 460: - -/* Line 1806 of yacc.c */ #line 4168 "ripper.y" { cond_stack = (yyvsp[(1) - (5)].val); @@ -9991,12 +9335,10 @@ yyreduce: #endif (yyval.val) = dispatch1(string_embexpr, (yyvsp[(4) - (5)].val)); - } + ;} break; case 461: - -/* Line 1806 of yacc.c */ #line 4182 "ripper.y" { #if 0 @@ -10004,12 +9346,10 @@ yyreduce: #endif (yyval.val) = dispatch1(var_ref, (yyvsp[(1) - (1)].val)); - } + ;} break; case 462: - -/* Line 1806 of yacc.c */ #line 4190 "ripper.y" { #if 0 @@ -10017,12 +9357,10 @@ yyreduce: #endif (yyval.val) = dispatch1(var_ref, (yyvsp[(1) - (1)].val)); - } + ;} break; case 463: - -/* Line 1806 of yacc.c */ #line 4198 "ripper.y" { #if 0 @@ -10030,12 +9368,10 @@ yyreduce: #endif (yyval.val) = dispatch1(var_ref, (yyvsp[(1) - (1)].val)); - } + ;} break; case 465: - -/* Line 1806 of yacc.c */ #line 4209 "ripper.y" { lex_state = EXPR_END; @@ -10044,12 +9380,10 @@ yyreduce: #endif (yyval.val) = dispatch1(symbol, (yyvsp[(2) - (2)].val)); - } + ;} break; case 470: - -/* Line 1806 of yacc.c */ #line 4226 "ripper.y" { lex_state = EXPR_END; @@ -10077,12 +9411,10 @@ yyreduce: #endif (yyval.val) = dispatch1(dyna_symbol, (yyvsp[(2) - (3)].val)); - } + ;} break; case 473: - -/* Line 1806 of yacc.c */ #line 4258 "ripper.y" { #if 0 @@ -10090,12 +9422,10 @@ yyreduce: #endif (yyval.val) = dispatch2(unary, ripper_intern("-@"), (yyvsp[(2) - (2)].val)); - } + ;} break; case 474: - -/* Line 1806 of yacc.c */ #line 4266 "ripper.y" { #if 0 @@ -10103,61 +9433,45 @@ yyreduce: #endif (yyval.val) = dispatch2(unary, ripper_intern("-@"), (yyvsp[(2) - (2)].val)); - } + ;} break; case 480: - -/* Line 1806 of yacc.c */ #line 4282 "ripper.y" - {ifndef_ripper((yyval.val) = keyword_nil);} + {ifndef_ripper((yyval.val) = keyword_nil);;} break; case 481: - -/* Line 1806 of yacc.c */ #line 4283 "ripper.y" - {ifndef_ripper((yyval.val) = keyword_self);} + {ifndef_ripper((yyval.val) = keyword_self);;} break; case 482: - -/* Line 1806 of yacc.c */ #line 4284 "ripper.y" - {ifndef_ripper((yyval.val) = keyword_true);} + {ifndef_ripper((yyval.val) = keyword_true);;} break; case 483: - -/* Line 1806 of yacc.c */ #line 4285 "ripper.y" - {ifndef_ripper((yyval.val) = keyword_false);} + {ifndef_ripper((yyval.val) = keyword_false);;} break; case 484: - -/* Line 1806 of yacc.c */ #line 4286 "ripper.y" - {ifndef_ripper((yyval.val) = keyword__FILE__);} + {ifndef_ripper((yyval.val) = keyword__FILE__);;} break; case 485: - -/* Line 1806 of yacc.c */ #line 4287 "ripper.y" - {ifndef_ripper((yyval.val) = keyword__LINE__);} + {ifndef_ripper((yyval.val) = keyword__LINE__);;} break; case 486: - -/* Line 1806 of yacc.c */ #line 4288 "ripper.y" - {ifndef_ripper((yyval.val) = keyword__ENCODING__);} + {ifndef_ripper((yyval.val) = keyword__ENCODING__);;} break; case 487: - -/* Line 1806 of yacc.c */ #line 4292 "ripper.y" { #if 0 @@ -10170,12 +9484,10 @@ yyreduce: (yyval.val) = dispatch1(vcall, (yyvsp[(1) - (1)].val)); } - } + ;} break; case 488: - -/* Line 1806 of yacc.c */ #line 4305 "ripper.y" { #if 0 @@ -10183,12 +9495,10 @@ yyreduce: #endif (yyval.val) = dispatch1(var_ref, (yyvsp[(1) - (1)].val)); - } + ;} break; case 489: - -/* Line 1806 of yacc.c */ #line 4315 "ripper.y" { (yyval.val) = assignable((yyvsp[(1) - (1)].val), 0); @@ -10196,12 +9506,10 @@ yyreduce: #endif (yyval.val) = dispatch1(var_field, (yyval.val)); - } + ;} break; case 490: - -/* Line 1806 of yacc.c */ #line 4323 "ripper.y" { (yyval.val) = assignable((yyvsp[(1) - (1)].val), 0); @@ -10209,12 +9517,10 @@ yyreduce: #endif (yyval.val) = dispatch1(var_field, (yyval.val)); - } + ;} break; case 493: - -/* Line 1806 of yacc.c */ #line 4337 "ripper.y" { #if 0 @@ -10222,30 +9528,24 @@ yyreduce: #endif (yyval.val) = Qnil; - } + ;} break; case 494: - -/* Line 1806 of yacc.c */ #line 4345 "ripper.y" { lex_state = EXPR_BEG; - } + ;} break; case 495: - -/* Line 1806 of yacc.c */ #line 4349 "ripper.y" { (yyval.val) = (yyvsp[(3) - (4)].val); - } + ;} break; case 496: - -/* Line 1806 of yacc.c */ #line 4353 "ripper.y" { #if 0 @@ -10255,12 +9555,10 @@ yyreduce: yyerrok; (yyval.val) = Qnil; - } + ;} break; case 497: - -/* Line 1806 of yacc.c */ #line 4365 "ripper.y" { #if 0 @@ -10270,217 +9568,185 @@ yyreduce: lex_state = EXPR_BEG; command_start = TRUE; - } + ;} break; case 498: - -/* Line 1806 of yacc.c */ #line 4375 "ripper.y" { (yyval.val) = (yyvsp[(1) - (2)].val); - } + lex_state = EXPR_BEG; + command_start = TRUE; + ;} break; case 499: - -/* Line 1806 of yacc.c */ -#line 4381 "ripper.y" +#line 4383 "ripper.y" { #if 0 (yyval.val) = new_args((yyvsp[(1) - (6)].val), (yyvsp[(3) - (6)].val), (yyvsp[(5) - (6)].val), 0, (yyvsp[(6) - (6)].val)); #endif (yyval.val) = params_new((yyvsp[(1) - (6)].val), (yyvsp[(3) - (6)].val), (yyvsp[(5) - (6)].val), Qnil, escape_Qundef((yyvsp[(6) - (6)].val))); - } + ;} break; case 500: - -/* Line 1806 of yacc.c */ -#line 4389 "ripper.y" +#line 4391 "ripper.y" { #if 0 (yyval.val) = new_args((yyvsp[(1) - (8)].val), (yyvsp[(3) - (8)].val), (yyvsp[(5) - (8)].val), (yyvsp[(7) - (8)].val), (yyvsp[(8) - (8)].val)); #endif (yyval.val) = params_new((yyvsp[(1) - (8)].val), (yyvsp[(3) - (8)].val), (yyvsp[(5) - (8)].val), (yyvsp[(7) - (8)].val), escape_Qundef((yyvsp[(8) - (8)].val))); - } + ;} break; case 501: - -/* Line 1806 of yacc.c */ -#line 4397 "ripper.y" +#line 4399 "ripper.y" { #if 0 (yyval.val) = new_args((yyvsp[(1) - (4)].val), (yyvsp[(3) - (4)].val), 0, 0, (yyvsp[(4) - (4)].val)); #endif (yyval.val) = params_new((yyvsp[(1) - (4)].val), (yyvsp[(3) - (4)].val), Qnil, Qnil, escape_Qundef((yyvsp[(4) - (4)].val))); - } + ;} break; case 502: - -/* Line 1806 of yacc.c */ -#line 4405 "ripper.y" +#line 4407 "ripper.y" { #if 0 (yyval.val) = new_args((yyvsp[(1) - (6)].val), (yyvsp[(3) - (6)].val), 0, (yyvsp[(5) - (6)].val), (yyvsp[(6) - (6)].val)); #endif (yyval.val) = params_new((yyvsp[(1) - (6)].val), (yyvsp[(3) - (6)].val), Qnil, (yyvsp[(5) - (6)].val), escape_Qundef((yyvsp[(6) - (6)].val))); - } + ;} break; case 503: - -/* Line 1806 of yacc.c */ -#line 4413 "ripper.y" +#line 4415 "ripper.y" { #if 0 (yyval.val) = new_args((yyvsp[(1) - (4)].val), 0, (yyvsp[(3) - (4)].val), 0, (yyvsp[(4) - (4)].val)); #endif (yyval.val) = params_new((yyvsp[(1) - (4)].val), Qnil, (yyvsp[(3) - (4)].val), Qnil, escape_Qundef((yyvsp[(4) - (4)].val))); - } + ;} break; case 504: - -/* Line 1806 of yacc.c */ -#line 4421 "ripper.y" +#line 4423 "ripper.y" { #if 0 (yyval.val) = new_args((yyvsp[(1) - (6)].val), 0, (yyvsp[(3) - (6)].val), (yyvsp[(5) - (6)].val), (yyvsp[(6) - (6)].val)); #endif (yyval.val) = params_new((yyvsp[(1) - (6)].val), Qnil, (yyvsp[(3) - (6)].val), (yyvsp[(5) - (6)].val), escape_Qundef((yyvsp[(6) - (6)].val))); - } + ;} break; case 505: - -/* Line 1806 of yacc.c */ -#line 4429 "ripper.y" +#line 4431 "ripper.y" { #if 0 (yyval.val) = new_args((yyvsp[(1) - (2)].val), 0, 0, 0, (yyvsp[(2) - (2)].val)); #endif (yyval.val) = params_new((yyvsp[(1) - (2)].val), Qnil, Qnil, Qnil,escape_Qundef((yyvsp[(2) - (2)].val))); - } + ;} break; case 506: - -/* Line 1806 of yacc.c */ -#line 4437 "ripper.y" +#line 4439 "ripper.y" { #if 0 (yyval.val) = new_args(0, (yyvsp[(1) - (4)].val), (yyvsp[(3) - (4)].val), 0, (yyvsp[(4) - (4)].val)); #endif (yyval.val) = params_new(Qnil, (yyvsp[(1) - (4)].val), (yyvsp[(3) - (4)].val), Qnil, escape_Qundef((yyvsp[(4) - (4)].val))); - } + ;} break; case 507: - -/* Line 1806 of yacc.c */ -#line 4445 "ripper.y" +#line 4447 "ripper.y" { #if 0 (yyval.val) = new_args(0, (yyvsp[(1) - (6)].val), (yyvsp[(3) - (6)].val), (yyvsp[(5) - (6)].val), (yyvsp[(6) - (6)].val)); #endif (yyval.val) = params_new(Qnil, (yyvsp[(1) - (6)].val), (yyvsp[(3) - (6)].val), (yyvsp[(5) - (6)].val), escape_Qundef((yyvsp[(6) - (6)].val))); - } + ;} break; case 508: - -/* Line 1806 of yacc.c */ -#line 4453 "ripper.y" +#line 4455 "ripper.y" { #if 0 (yyval.val) = new_args(0, (yyvsp[(1) - (2)].val), 0, 0, (yyvsp[(2) - (2)].val)); #endif (yyval.val) = params_new(Qnil, (yyvsp[(1) - (2)].val), Qnil, Qnil,escape_Qundef((yyvsp[(2) - (2)].val))); - } + ;} break; case 509: - -/* Line 1806 of yacc.c */ -#line 4461 "ripper.y" +#line 4463 "ripper.y" { #if 0 (yyval.val) = new_args(0, (yyvsp[(1) - (4)].val), 0, (yyvsp[(3) - (4)].val), (yyvsp[(4) - (4)].val)); #endif (yyval.val) = params_new(Qnil, (yyvsp[(1) - (4)].val), Qnil, (yyvsp[(3) - (4)].val), escape_Qundef((yyvsp[(4) - (4)].val))); - } + ;} break; case 510: - -/* Line 1806 of yacc.c */ -#line 4469 "ripper.y" +#line 4471 "ripper.y" { #if 0 (yyval.val) = new_args(0, 0, (yyvsp[(1) - (2)].val), 0, (yyvsp[(2) - (2)].val)); #endif (yyval.val) = params_new(Qnil, Qnil, (yyvsp[(1) - (2)].val), Qnil,escape_Qundef((yyvsp[(2) - (2)].val))); - } + ;} break; case 511: - -/* Line 1806 of yacc.c */ -#line 4477 "ripper.y" +#line 4479 "ripper.y" { #if 0 (yyval.val) = new_args(0, 0, (yyvsp[(1) - (4)].val), (yyvsp[(3) - (4)].val), (yyvsp[(4) - (4)].val)); #endif (yyval.val) = params_new(Qnil, Qnil, (yyvsp[(1) - (4)].val), (yyvsp[(3) - (4)].val), escape_Qundef((yyvsp[(4) - (4)].val))); - } + ;} break; case 512: - -/* Line 1806 of yacc.c */ -#line 4485 "ripper.y" +#line 4487 "ripper.y" { #if 0 (yyval.val) = new_args(0, 0, 0, 0, (yyvsp[(1) - (1)].val)); #endif (yyval.val) = params_new(Qnil, Qnil, Qnil, Qnil, (yyvsp[(1) - (1)].val)); - } + ;} break; case 513: - -/* Line 1806 of yacc.c */ -#line 4493 "ripper.y" +#line 4495 "ripper.y" { #if 0 (yyval.val) = new_args(0, 0, 0, 0, 0); #endif (yyval.val) = params_new(Qnil, Qnil, Qnil, Qnil, Qnil); - } + ;} break; case 514: - -/* Line 1806 of yacc.c */ -#line 4503 "ripper.y" +#line 4505 "ripper.y" { #if 0 yyerror("formal argument cannot be a constant"); @@ -10488,13 +9754,11 @@ yyreduce: #endif (yyval.val) = dispatch1(param_error, (yyvsp[(1) - (1)].val)); - } + ;} break; case 515: - -/* Line 1806 of yacc.c */ -#line 4512 "ripper.y" +#line 4514 "ripper.y" { #if 0 yyerror("formal argument cannot be an instance variable"); @@ -10502,13 +9766,11 @@ yyreduce: #endif (yyval.val) = dispatch1(param_error, (yyvsp[(1) - (1)].val)); - } + ;} break; case 516: - -/* Line 1806 of yacc.c */ -#line 4521 "ripper.y" +#line 4523 "ripper.y" { #if 0 yyerror("formal argument cannot be a global variable"); @@ -10516,13 +9778,11 @@ yyreduce: #endif (yyval.val) = dispatch1(param_error, (yyvsp[(1) - (1)].val)); - } + ;} break; case 517: - -/* Line 1806 of yacc.c */ -#line 4530 "ripper.y" +#line 4532 "ripper.y" { #if 0 yyerror("formal argument cannot be a class variable"); @@ -10530,23 +9790,19 @@ yyreduce: #endif (yyval.val) = dispatch1(param_error, (yyvsp[(1) - (1)].val)); - } + ;} break; case 519: - -/* Line 1806 of yacc.c */ -#line 4542 "ripper.y" +#line 4544 "ripper.y" { formal_argument(get_id((yyvsp[(1) - (1)].val))); (yyval.val) = (yyvsp[(1) - (1)].val); - } + ;} break; case 520: - -/* Line 1806 of yacc.c */ -#line 4549 "ripper.y" +#line 4551 "ripper.y" { arg_var(get_id((yyvsp[(1) - (1)].val))); #if 0 @@ -10554,13 +9810,11 @@ yyreduce: #endif (yyval.val) = get_value((yyvsp[(1) - (1)].val)); - } + ;} break; case 521: - -/* Line 1806 of yacc.c */ -#line 4558 "ripper.y" +#line 4560 "ripper.y" { ID tid = internal_id(); arg_var(tid); @@ -10576,22 +9830,18 @@ yyreduce: #endif (yyval.val) = dispatch1(mlhs_paren, (yyvsp[(2) - (3)].val)); - } + ;} break; case 522: - -/* Line 1806 of yacc.c */ -#line 4579 "ripper.y" +#line 4581 "ripper.y" { (yyval.val) = rb_ary_new3(1, (yyvsp[(1) - (1)].val)); - } + ;} break; case 523: - -/* Line 1806 of yacc.c */ -#line 4584 "ripper.y" +#line 4586 "ripper.y" { #if 0 (yyval.val) = (yyvsp[(1) - (3)].val); @@ -10601,13 +9851,11 @@ yyreduce: #endif (yyval.val) = rb_ary_push((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 524: - -/* Line 1806 of yacc.c */ -#line 4597 "ripper.y" +#line 4599 "ripper.y" { arg_var(formal_argument(get_id((yyvsp[(1) - (3)].val)))); (yyval.val) = assignable((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); @@ -10616,13 +9864,11 @@ yyreduce: #endif (yyval.val) = rb_assoc_new((yyval.val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 525: - -/* Line 1806 of yacc.c */ -#line 4609 "ripper.y" +#line 4611 "ripper.y" { arg_var(formal_argument(get_id((yyvsp[(1) - (3)].val)))); (yyval.val) = assignable((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); @@ -10631,26 +9877,22 @@ yyreduce: #endif (yyval.val) = rb_assoc_new((yyval.val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 526: - -/* Line 1806 of yacc.c */ -#line 4621 "ripper.y" +#line 4623 "ripper.y" { #if 0 (yyval.val) = (yyvsp[(1) - (1)].val); #endif (yyval.val) = rb_ary_new3(1, (yyvsp[(1) - (1)].val)); - } + ;} break; case 527: - -/* Line 1806 of yacc.c */ -#line 4629 "ripper.y" +#line 4631 "ripper.y" { #if 0 NODE *opts = (yyvsp[(1) - (3)].val); @@ -10663,26 +9905,22 @@ yyreduce: #endif (yyval.val) = rb_ary_push((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 528: - -/* Line 1806 of yacc.c */ -#line 4645 "ripper.y" +#line 4647 "ripper.y" { #if 0 (yyval.val) = (yyvsp[(1) - (1)].val); #endif (yyval.val) = rb_ary_new3(1, (yyvsp[(1) - (1)].val)); - } + ;} break; case 529: - -/* Line 1806 of yacc.c */ -#line 4653 "ripper.y" +#line 4655 "ripper.y" { #if 0 NODE *opts = (yyvsp[(1) - (3)].val); @@ -10695,13 +9933,11 @@ yyreduce: #endif (yyval.val) = rb_ary_push((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 532: - -/* Line 1806 of yacc.c */ -#line 4673 "ripper.y" +#line 4675 "ripper.y" { #if 0 if (!is_local_id((yyvsp[(2) - (2)].val))) @@ -10713,13 +9949,11 @@ yyreduce: #endif (yyval.val) = dispatch1(rest_param, (yyvsp[(2) - (2)].val)); - } + ;} break; case 533: - -/* Line 1806 of yacc.c */ -#line 4686 "ripper.y" +#line 4688 "ripper.y" { #if 0 (yyval.val) = internal_id(); @@ -10727,13 +9961,11 @@ yyreduce: #endif (yyval.val) = dispatch1(rest_param, Qnil); - } + ;} break; case 536: - -/* Line 1806 of yacc.c */ -#line 4701 "ripper.y" +#line 4703 "ripper.y" { #if 0 if (!is_local_id((yyvsp[(2) - (2)].val))) @@ -10747,35 +9979,29 @@ yyreduce: #endif (yyval.val) = dispatch1(blockarg, (yyvsp[(2) - (2)].val)); - } + ;} break; case 537: - -/* Line 1806 of yacc.c */ -#line 4718 "ripper.y" +#line 4720 "ripper.y" { (yyval.val) = (yyvsp[(2) - (2)].val); - } + ;} break; case 538: - -/* Line 1806 of yacc.c */ -#line 4722 "ripper.y" +#line 4724 "ripper.y" { #if 0 (yyval.val) = 0; #endif (yyval.val) = Qundef; - } + ;} break; case 539: - -/* Line 1806 of yacc.c */ -#line 4732 "ripper.y" +#line 4734 "ripper.y" { #if 0 value_expr((yyvsp[(1) - (1)].val)); @@ -10784,20 +10010,16 @@ yyreduce: #endif (yyval.val) = (yyvsp[(1) - (1)].val); - } + ;} break; case 540: - -/* Line 1806 of yacc.c */ -#line 4741 "ripper.y" - {lex_state = EXPR_BEG;} +#line 4743 "ripper.y" + {lex_state = EXPR_BEG;;} break; case 541: - -/* Line 1806 of yacc.c */ -#line 4742 "ripper.y" +#line 4744 "ripper.y" { #if 0 if ((yyvsp[(3) - (4)].val) == 0) { @@ -10823,128 +10045,96 @@ yyreduce: #endif (yyval.val) = dispatch1(paren, (yyvsp[(3) - (4)].val)); - } + ;} break; case 543: - -/* Line 1806 of yacc.c */ -#line 4772 "ripper.y" +#line 4774 "ripper.y" { #if 0 (yyval.val) = (yyvsp[(1) - (2)].val); #endif (yyval.val) = dispatch1(assoclist_from_args, (yyvsp[(1) - (2)].val)); - } + ;} break; case 544: - -/* Line 1806 of yacc.c */ -#line 4784 "ripper.y" +#line 4786 "ripper.y" { (yyval.val) = rb_ary_new3(1, (yyvsp[(1) - (1)].val)); - } + ;} break; case 545: - -/* Line 1806 of yacc.c */ -#line 4789 "ripper.y" +#line 4791 "ripper.y" { #if 0 (yyval.val) = list_concat((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); #endif (yyval.val) = rb_ary_push((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 546: - -/* Line 1806 of yacc.c */ -#line 4799 "ripper.y" +#line 4801 "ripper.y" { #if 0 (yyval.val) = list_append(NEW_LIST((yyvsp[(1) - (3)].val)), (yyvsp[(3) - (3)].val)); #endif (yyval.val) = dispatch2(assoc_new, (yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); - } + ;} break; case 547: - -/* Line 1806 of yacc.c */ -#line 4807 "ripper.y" +#line 4809 "ripper.y" { #if 0 (yyval.val) = list_append(NEW_LIST(NEW_LIT(ID2SYM((yyvsp[(1) - (2)].val)))), (yyvsp[(2) - (2)].val)); #endif (yyval.val) = dispatch2(assoc_new, (yyvsp[(1) - (2)].val), (yyvsp[(2) - (2)].val)); - } + ;} break; case 558: - -/* Line 1806 of yacc.c */ -#line 4835 "ripper.y" - { (yyval.val) = (yyvsp[(1) - (1)].val); } +#line 4837 "ripper.y" + { (yyval.val) = (yyvsp[(1) - (1)].val); ;} break; case 559: - -/* Line 1806 of yacc.c */ -#line 4840 "ripper.y" - { (yyval.val) = (yyvsp[(1) - (1)].val); } +#line 4842 "ripper.y" + { (yyval.val) = (yyvsp[(1) - (1)].val); ;} break; case 569: - -/* Line 1806 of yacc.c */ -#line 4863 "ripper.y" - {yyerrok;} +#line 4865 "ripper.y" + {yyerrok;;} break; case 572: - -/* Line 1806 of yacc.c */ -#line 4868 "ripper.y" - {yyerrok;} +#line 4870 "ripper.y" + {yyerrok;;} break; case 573: - -/* Line 1806 of yacc.c */ -#line 4872 "ripper.y" +#line 4874 "ripper.y" { #if 0 (yyval.val) = 0; #endif (yyval.val) = Qundef; - } + ;} break; - -/* Line 1806 of yacc.c */ -#line 10933 "parse.c" +/* Line 1267 of yacc.c. */ +#line 10134 "parse.c" default: break; } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); @@ -10953,6 +10143,7 @@ yyreduce: *++yyvsp = yyval; + /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -10972,10 +10163,6 @@ yyreduce: | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { @@ -10983,36 +10170,37 @@ yyerrlab: #if ! YYERROR_VERBOSE parser_yyerror (parser, YY_("syntax error")); #else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - parser_yyerror (parser, yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + parser_yyerror (parser, yymsg); + } + else + { + parser_yyerror (parser, YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } } -# undef YYSYNTAX_ERROR #endif } @@ -11020,7 +10208,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -11037,7 +10225,7 @@ yyerrlab: } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; @@ -11071,7 +10259,7 @@ yyerrlab1: for (;;) { yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) + if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) @@ -11094,6 +10282,9 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } + if (yyn == YYFINAL) + YYACCEPT; + *++yyvsp = yylval; @@ -11118,7 +10309,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -11129,14 +10320,9 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval, parser); - } + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, parser); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); @@ -11160,9 +10346,7 @@ yyreturn: } - -/* Line 2067 of yacc.c */ -#line 4880 "ripper.y" +#line 4882 "ripper.y" # undef parser # undef yylex @@ -12212,7 +11396,7 @@ parser_tokadd_string(struct parser_params *parser, default: if (c == -1) return -1; if (!ISASCII(c)) { - tokadd('\\'); + if ((func & STR_FUNC_EXPAND) == 0) tokadd('\\'); goto non_ascii; } if (func & STR_FUNC_REGEXP) { @@ -12269,6 +11453,25 @@ parser_tokadd_string(struct parser_params *parser, #define NEW_STRTERM(func, term, paren) \ rb_node_newnode(NODE_STRTERM, (func), (term) | ((paren) << (CHAR_BIT * 2)), 0) +#ifdef RIPPER +static void +ripper_flush_string_content(struct parser_params *parser, rb_encoding *enc) +{ + if (!NIL_P(parser->delayed)) { + ptrdiff_t len = lex_p - parser->tokp; + if (len > 0) { + rb_enc_str_buf_cat(parser->delayed, parser->tokp, len, enc); + } + ripper_dispatch_delayed_token(parser, tSTRING_CONTENT); + parser->tokp = lex_p; + } +} + +#define flush_string_content(enc) ripper_flush_string_content(parser, (enc)) +#else +#define flush_string_content(enc) ((void)(enc)) +#endif + static int parser_parse_string(struct parser_params *parser, NODE *quote) { @@ -12327,17 +11530,7 @@ parser_parse_string(struct parser_params *parser, NODE *quote) tokfix(); set_yylval_str(STR_NEW3(tok(), toklen(), enc, func)); - -#ifdef RIPPER - if (!NIL_P(parser->delayed)) { - ptrdiff_t len = lex_p - parser->tokp; - if (len > 0) { - rb_enc_str_buf_cat(parser->delayed, parser->tokp, len, enc); - } - ripper_dispatch_delayed_token(parser, tSTRING_CONTENT); - parser->tokp = lex_p; - } -#endif + flush_string_content(enc); return tSTRING_CONTENT; } @@ -12542,6 +11735,7 @@ parser_here_document(struct parser_params *parser, NODE *here) } if (c != '\n') { set_yylval_str(STR_NEW3(tok(), toklen(), enc, func)); + flush_string_content(enc); return tSTRING_CONTENT; } tokadd(nextc()); @@ -12819,6 +12013,7 @@ parser_magic_comment(struct parser_params *parser, const char *str, long len) } } while (++p < magic_comments + numberof(magic_comments)); #else + str_copy(val, vbeg, vend - vbeg); dispatch2(magic_comment, name, val); #endif } @@ -13301,7 +12496,6 @@ parser_yylex(struct parser_params *parser) } else if (!lex_eol_p() && !(c = *lex_p, ISASCII(c))) { nextc(); - tokadd('\\'); if (tokadd_mbchar(c) == -1) return 0; } else { @@ -14198,7 +13392,8 @@ parser_yylex(struct parser_params *parser) ID ident = TOK_INTERN(!ENC_SINGLE(mb)); set_yylval_name(ident); - if (last_state != EXPR_DOT && is_local_id(ident) && lvar_defined(ident)) { + if (last_state != EXPR_DOT && last_state != EXPR_FNAME && + is_local_id(ident) && lvar_defined(ident)) { lex_state = EXPR_END; } } diff --git a/ext/ripper/ripper.y b/ext/ripper/ripper.y index dbaf40c..0ffe293 100644 --- a/ext/ripper/ripper.y +++ b/ext/ripper/ripper.y @@ -2,7 +2,7 @@ parse.y - - $Author: nobu $ + $Author: usa $ created at: Fri May 28 18:02:42 JST 1993 Copyright (C) 1993-2007 Yukihiro Matsumoto @@ -4374,6 +4374,8 @@ f_arglist : '(' f_args rparen | f_args term { $$ = $1; + lex_state = EXPR_BEG; + command_start = TRUE; } ; @@ -5926,7 +5928,7 @@ parser_tokadd_string(struct parser_params *parser, default: if (c == -1) return -1; if (!ISASCII(c)) { - tokadd('\\'); + if ((func & STR_FUNC_EXPAND) == 0) tokadd('\\'); goto non_ascii; } if (func & STR_FUNC_REGEXP) { @@ -5983,6 +5985,25 @@ parser_tokadd_string(struct parser_params *parser, #define NEW_STRTERM(func, term, paren) \ rb_node_newnode(NODE_STRTERM, (func), (term) | ((paren) << (CHAR_BIT * 2)), 0) +#ifdef RIPPER +static void +ripper_flush_string_content(struct parser_params *parser, rb_encoding *enc) +{ + if (!NIL_P(parser->delayed)) { + ptrdiff_t len = lex_p - parser->tokp; + if (len > 0) { + rb_enc_str_buf_cat(parser->delayed, parser->tokp, len, enc); + } + ripper_dispatch_delayed_token(parser, tSTRING_CONTENT); + parser->tokp = lex_p; + } +} + +#define flush_string_content(enc) ripper_flush_string_content(parser, (enc)) +#else +#define flush_string_content(enc) ((void)(enc)) +#endif + static int parser_parse_string(struct parser_params *parser, NODE *quote) { @@ -6041,17 +6062,7 @@ parser_parse_string(struct parser_params *parser, NODE *quote) tokfix(); set_yylval_str(STR_NEW3(tok(), toklen(), enc, func)); - -#ifdef RIPPER - if (!NIL_P(parser->delayed)) { - ptrdiff_t len = lex_p - parser->tokp; - if (len > 0) { - rb_enc_str_buf_cat(parser->delayed, parser->tokp, len, enc); - } - ripper_dispatch_delayed_token(parser, tSTRING_CONTENT); - parser->tokp = lex_p; - } -#endif + flush_string_content(enc); return tSTRING_CONTENT; } @@ -6256,6 +6267,7 @@ parser_here_document(struct parser_params *parser, NODE *here) } if (c != '\n') { set_yylval_str(STR_NEW3(tok(), toklen(), enc, func)); + flush_string_content(enc); return tSTRING_CONTENT; } tokadd(nextc()); @@ -6533,6 +6545,7 @@ parser_magic_comment(struct parser_params *parser, const char *str, long len) } } while (++p < magic_comments + numberof(magic_comments)); #else + str_copy(val, vbeg, vend - vbeg); dispatch2(magic_comment, name, val); #endif } @@ -7015,7 +7028,6 @@ parser_yylex(struct parser_params *parser) } else if (!lex_eol_p() && !(c = *lex_p, ISASCII(c))) { nextc(); - tokadd('\\'); if (tokadd_mbchar(c) == -1) return 0; } else { @@ -7912,7 +7924,8 @@ parser_yylex(struct parser_params *parser) ID ident = TOK_INTERN(!ENC_SINGLE(mb)); set_yylval_name(ident); - if (last_state != EXPR_DOT && is_local_id(ident) && lvar_defined(ident)) { + if (last_state != EXPR_DOT && last_state != EXPR_FNAME && + is_local_id(ident) && lvar_defined(ident)) { lex_state = EXPR_END; } } diff --git a/ext/ripper/y.output b/ext/ripper/y.output index 1024974..075ddb7 100644 --- a/ext/ripper/y.output +++ b/ext/ripper/y.output @@ -1,4 +1,4 @@ -Terminals unused in grammar +Terminals which are not used tRPAREN idNULL @@ -18,9 +18,9 @@ Grammar 0 $accept: program $end - 1 $@1: /* empty */ + 1 @1: /* empty */ - 2 program: $@1 top_compstmt + 2 program: @1 top_compstmt 3 top_compstmt: top_stmts opt_terms @@ -31,9 +31,9 @@ Grammar 8 top_stmt: stmt - 9 $@2: /* empty */ + 9 @2: /* empty */ - 10 top_stmt: keyword_BEGIN $@2 '{' top_compstmt '}' + 10 top_stmt: keyword_BEGIN @2 '{' top_compstmt '}' 11 bodystmt: compstmt opt_rescue opt_else opt_ensure @@ -44,9 +44,9 @@ Grammar 15 | stmts terms stmt 16 | error stmt - 17 $@3: /* empty */ + 17 @3: /* empty */ - 18 stmt: keyword_alias fitem $@3 fitem + 18 stmt: keyword_alias fitem @3 fitem 19 | keyword_alias tGVAR tGVAR 20 | keyword_alias tGVAR tBACK_REF 21 | keyword_alias tGVAR tNTH_REF @@ -173,9 +173,9 @@ Grammar 121 undef_list: fitem - 122 $@5: /* empty */ + 122 @5: /* empty */ - 123 undef_list: undef_list ',' $@5 fitem + 123 undef_list: undef_list ',' @5 fitem 124 op: '|' 125 | '^' @@ -292,9 +292,9 @@ Grammar 234 | arg tANDOP arg 235 | arg tOROP arg - 236 $@6: /* empty */ + 236 @6: /* empty */ - 237 arg: keyword_defined opt_nl $@6 arg + 237 arg: keyword_defined opt_nl @6 arg 238 | arg '?' arg opt_nl ':' arg 239 | primary @@ -354,9 +354,9 @@ Grammar 280 primary: k_begin @8 bodystmt k_end - 281 $@9: /* empty */ + 281 @9: /* empty */ - 282 primary: tLPAREN_ARG expr $@9 rparen + 282 primary: tLPAREN_ARG expr @9 rparen 283 | tLPAREN compstmt ')' 284 | primary_value tCOLON2 tCONSTANT 285 | tCOLON3 tCONSTANT @@ -367,9 +367,9 @@ Grammar 290 | keyword_yield '(' rparen 291 | keyword_yield - 292 $@10: /* empty */ + 292 @10: /* empty */ - 293 primary: keyword_defined opt_nl '(' $@10 expr rparen + 293 primary: keyword_defined opt_nl '(' @10 expr rparen 294 | keyword_not '(' expr rparen 295 | keyword_not '(' rparen 296 | operation brace_block @@ -379,25 +379,25 @@ Grammar 300 | k_if expr_value then compstmt if_tail k_end 301 | k_unless expr_value then compstmt opt_else k_end - 302 $@11: /* empty */ + 302 @11: /* empty */ - 303 $@12: /* empty */ + 303 @12: /* empty */ - 304 primary: k_while $@11 expr_value do $@12 compstmt k_end + 304 primary: k_while @11 expr_value do @12 compstmt k_end - 305 $@13: /* empty */ + 305 @13: /* empty */ - 306 $@14: /* empty */ + 306 @14: /* empty */ - 307 primary: k_until $@13 expr_value do $@14 compstmt k_end + 307 primary: k_until @13 expr_value do @14 compstmt k_end 308 | k_case expr_value opt_terms case_body k_end 309 | k_case opt_terms case_body k_end - 310 $@15: /* empty */ + 310 @15: /* empty */ - 311 $@16: /* empty */ + 311 @16: /* empty */ - 312 primary: k_for for_var keyword_in $@15 expr_value do $@16 compstmt k_end + 312 primary: k_for for_var keyword_in @15 expr_value do @16 compstmt k_end 313 @17: /* empty */ @@ -417,11 +417,11 @@ Grammar 321 primary: k_def fname @21 f_arglist bodystmt k_end - 322 $@22: /* empty */ + 322 @22: /* empty */ - 323 $@23: /* empty */ + 323 @23: /* empty */ - 324 primary: k_def singleton dot_or_colon $@22 fname $@23 f_arglist bodystmt k_end + 324 primary: k_def singleton dot_or_colon @22 fname @23 f_arglist bodystmt k_end 325 | keyword_break 326 | keyword_next 327 | keyword_redo @@ -667,9 +667,9 @@ Grammar 492 superclass: term - 493 $@32: /* empty */ + 493 @32: /* empty */ - 494 superclass: '<' $@32 expr_value term + 494 superclass: '<' @32 expr_value term 495 | error term 496 f_arglist: '(' f_args rparen @@ -731,9 +731,9 @@ Grammar 538 singleton: var_ref - 539 $@33: /* empty */ + 539 @33: /* empty */ - 540 singleton: '(' $@33 expr rparen + 540 singleton: '(' @33 expr rparen 541 assoc_list: none 542 | assocs trailer @@ -948,7 +948,7 @@ $accept (148) on left: 0 program (149) on left: 2, on right: 0 -$@1 (150) +@1 (150) on left: 1, on right: 2 top_compstmt (151) on left: 3, on right: 2 10 @@ -956,7 +956,7 @@ top_stmts (152) on left: 4 5 6 7, on right: 3 6 top_stmt (153) on left: 8 10, on right: 5 6 7 -$@2 (154) +@2 (154) on left: 9, on right: 10 bodystmt (155) on left: 11, on right: 280 314 317 319 321 324 @@ -968,7 +968,7 @@ stmts (157) stmt (158) on left: 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41, on right: 8 14 15 16 23 24 25 26 27 -$@3 (159) +@3 (159) on left: 17, on right: 18 command_asgn (160) on left: 42 43, on right: 29 43 @@ -1017,12 +1017,12 @@ fitem (180) on left: 119 120, on right: 18 121 123 undef_list (181) on left: 121 123, on right: 22 123 -$@5 (182) +@5 (182) on left: 122, on right: 123 op (183) on left: 124 125 126 127 128 129 130 131 132 133 134 135 136 137 - 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152, on right: - 115 553 556 + 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152, + on right: 115 553 556 reswords (184) on left: 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 @@ -1030,11 +1030,11 @@ reswords (184) arg (185) on left: 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 - 224 225 226 227 228 229 230 231 232 233 234 235 237 238 239, on right: - 49 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 - 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 - 225 226 227 228 229 230 231 232 233 234 235 237 238 240 -$@6 (186) + 224 225 226 227 228 229 230 231 232 233 234 235 237 238 239, + on right: 49 194 195 196 197 198 199 200 201 202 203 204 205 206 + 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 + 223 224 225 226 227 228 229 230 231 232 233 234 235 237 238 240 +@6 (186) on left: 236, on right: 237 arg_value (187) on left: 240, on right: 39 260 263 264 265 266 267 268 269 421 @@ -1065,25 +1065,25 @@ mrhs (198) primary (199) on left: 270 271 272 273 274 275 276 277 278 280 282 283 284 285 286 287 288 289 290 291 293 294 295 296 297 298 299 300 301 304 - 307 308 309 312 314 317 319 321 324 325 326 327 328, on right: - 239 329 + 307 308 309 312 314 317 319 321 324 325 326 327 328, + on right: 239 329 @8 (200) on left: 279, on right: 280 -$@9 (201) +@9 (201) on left: 281, on right: 282 -$@10 (202) +@10 (202) on left: 292, on right: 293 -$@11 (203) +@11 (203) on left: 302, on right: 304 -$@12 (204) +@12 (204) on left: 303, on right: 304 -$@13 (205) +@13 (205) on left: 305, on right: 307 -$@14 (206) +@14 (206) on left: 306, on right: 307 -$@15 (207) +@15 (207) on left: 310, on right: 312 -$@16 (208) +@16 (208) on left: 311, on right: 312 @17 (209) on left: 313, on right: 314 @@ -1095,9 +1095,9 @@ $@16 (208) on left: 318, on right: 319 @21 (213) on left: 320, on right: 321 -$@22 (214) +@22 (214) on left: 322, on right: 324 -$@23 (215) +@23 (215) on left: 323, on right: 324 primary_value (216) on left: 329, on right: 32 33 34 35 36 60 61 62 63 91 92 93 94 @@ -1249,7 +1249,7 @@ backref (287) on left: 490 491, on right: 37 97 106 204 277 463 superclass (288) on left: 492 494 495, on right: 314 -$@32 (289) +@32 (289) on left: 493, on right: 494 f_arglist (290) on left: 496 497, on right: 321 324 @@ -1288,7 +1288,7 @@ opt_f_block_arg (304) 510 singleton (305) on left: 538 540, on right: 324 -$@33 (306) +@33 (306) on left: 539, on right: 540 assoc_list (307) on left: 541 542, on right: 287 @@ -1329,10 +1329,10 @@ state 0 0 $accept: . program $end - $default reduce using rule 1 ($@1) + $default reduce using rule 1 (@1) program go to state 1 - $@1 go to state 2 + @1 go to state 2 state 1 @@ -1344,7 +1344,7 @@ state 1 state 2 - 2 program: $@1 . top_compstmt + 2 program: @1 . top_compstmt error shift, and go to state 4 keyword_class shift, and go to state 5 @@ -2254,7 +2254,7 @@ state 27 state 28 - 18 stmt: keyword_alias . fitem $@3 fitem + 18 stmt: keyword_alias . fitem @3 fitem 19 | keyword_alias . tGVAR tGVAR 20 | keyword_alias . tGVAR tBACK_REF 21 | keyword_alias . tGVAR tNTH_REF @@ -2346,8 +2346,8 @@ state 28 state 29 - 237 arg: keyword_defined . opt_nl $@6 arg - 293 primary: keyword_defined . opt_nl '(' $@10 expr rparen + 237 arg: keyword_defined . opt_nl @6 arg + 293 primary: keyword_defined . opt_nl '(' @10 expr rparen '\n' shift, and go to state 224 @@ -2358,11 +2358,11 @@ state 29 state 30 - 10 top_stmt: keyword_BEGIN . $@2 '{' top_compstmt '}' + 10 top_stmt: keyword_BEGIN . @2 '{' top_compstmt '}' - $default reduce using rule 9 ($@2) + $default reduce using rule 9 (@2) - $@2 go to state 229 + @2 go to state 229 state 31 @@ -2968,7 +2968,7 @@ state 49 state 50 - 282 primary: tLPAREN_ARG . expr $@9 rparen + 282 primary: tLPAREN_ARG . expr @9 rparen keyword_class shift, and go to state 5 keyword_module shift, and go to state 6 @@ -3717,7 +3717,7 @@ state 63 state 64 - 2 program: $@1 top_compstmt . + 2 program: @1 top_compstmt . $default reduce using rule 2 (program) @@ -4264,20 +4264,20 @@ state 84 state 85 - 304 primary: k_while . $@11 expr_value do $@12 compstmt k_end + 304 primary: k_while . @11 expr_value do @12 compstmt k_end - $default reduce using rule 302 ($@11) + $default reduce using rule 302 (@11) - $@11 go to state 341 + @11 go to state 341 state 86 - 307 primary: k_until . $@13 expr_value do $@14 compstmt k_end + 307 primary: k_until . @13 expr_value do @14 compstmt k_end - $default reduce using rule 305 ($@13) + $default reduce using rule 305 (@13) - $@13 go to state 342 + @13 go to state 342 state 87 @@ -4389,7 +4389,7 @@ state 87 state 88 - 312 primary: k_for . for_var keyword_in $@15 expr_value do $@16 compstmt k_end + 312 primary: k_for . for_var keyword_in @15 expr_value do @16 compstmt k_end keyword_class shift, and go to state 5 keyword_module shift, and go to state 6 @@ -4662,7 +4662,7 @@ state 90 state 91 321 primary: k_def . fname @21 f_arglist bodystmt k_end - 324 | k_def . singleton dot_or_colon $@22 fname $@23 f_arglist bodystmt k_end + 324 | k_def . singleton dot_or_colon @22 fname @23 f_arglist bodystmt k_end keyword_class shift, and go to state 113 keyword_module shift, and go to state 114 @@ -5485,7 +5485,7 @@ state 188 state 189 22 stmt: keyword_undef undef_list . - 123 undef_list: undef_list . ',' $@5 fitem + 123 undef_list: undef_list . ',' @5 fitem ',' shift, and go to state 389 @@ -6810,28 +6810,28 @@ state 226 state 227 - 18 stmt: keyword_alias fitem . $@3 fitem + 18 stmt: keyword_alias fitem . @3 fitem - $default reduce using rule 17 ($@3) + $default reduce using rule 17 (@3) - $@3 go to state 421 + @3 go to state 421 state 228 - 237 arg: keyword_defined opt_nl . $@6 arg - 293 primary: keyword_defined opt_nl . '(' $@10 expr rparen + 237 arg: keyword_defined opt_nl . @6 arg + 293 primary: keyword_defined opt_nl . '(' @10 expr rparen '(' shift, and go to state 422 - $default reduce using rule 236 ($@6) + $default reduce using rule 236 (@6) - $@6 go to state 423 + @6 go to state 423 state 229 - 10 top_stmt: keyword_BEGIN $@2 . '{' top_compstmt '}' + 10 top_stmt: keyword_BEGIN @2 . '{' top_compstmt '}' '{' shift, and go to state 424 @@ -7420,14 +7420,14 @@ state 249 45 expr: expr . keyword_and expr 46 | expr . keyword_or expr - 282 primary: tLPAREN_ARG expr . $@9 rparen + 282 primary: tLPAREN_ARG expr . @9 rparen keyword_and shift, and go to state 298 keyword_or shift, and go to state 299 - $default reduce using rule 281 ($@9) + $default reduce using rule 281 (@9) - $@9 go to state 435 + @9 go to state 435 state 250 @@ -7508,7 +7508,7 @@ state 257 state 258 - 293 primary: keyword_defined . opt_nl '(' $@10 expr rparen + 293 primary: keyword_defined . opt_nl '(' @10 expr rparen '\n' shift, and go to state 224 @@ -12024,7 +12024,7 @@ state 340 state 341 - 304 primary: k_while $@11 . expr_value do $@12 compstmt k_end + 304 primary: k_while @11 . expr_value do @12 compstmt k_end keyword_class shift, and go to state 5 keyword_module shift, and go to state 6 @@ -12123,7 +12123,7 @@ state 341 state 342 - 307 primary: k_until $@13 . expr_value do $@14 compstmt k_end + 307 primary: k_until @13 . expr_value do @14 compstmt k_end keyword_class shift, and go to state 5 keyword_module shift, and go to state 6 @@ -12303,7 +12303,7 @@ state 349 state 350 - 312 primary: k_for for_var . keyword_in $@15 expr_value do $@16 compstmt k_end + 312 primary: k_for for_var . keyword_in @15 expr_value do @16 compstmt k_end keyword_in shift, and go to state 554 @@ -12638,11 +12638,11 @@ state 373 state 374 - 540 singleton: '(' . $@33 expr rparen + 540 singleton: '(' . @33 expr rparen - $default reduce using rule 539 ($@33) + $default reduce using rule 539 (@33) - $@33 go to state 567 + @33 go to state 567 state 375 @@ -12663,7 +12663,7 @@ state 376 state 377 - 324 primary: k_def singleton . dot_or_colon $@22 fname $@23 f_arglist bodystmt k_end + 324 primary: k_def singleton . dot_or_colon @22 fname @23 f_arglist bodystmt k_end tCOLON2 shift, and go to state 569 '.' shift, and go to state 570 @@ -13012,11 +13012,11 @@ state 388 state 389 - 123 undef_list: undef_list ',' . $@5 fitem + 123 undef_list: undef_list ',' . @5 fitem - $default reduce using rule 122 ($@5) + $default reduce using rule 122 (@5) - $@5 go to state 584 + @5 go to state 584 state 390 @@ -14007,7 +14007,7 @@ state 420 state 421 - 18 stmt: keyword_alias fitem $@3 . fitem + 18 stmt: keyword_alias fitem @3 . fitem keyword_class shift, and go to state 113 keyword_module shift, and go to state 114 @@ -14095,16 +14095,16 @@ state 421 state 422 - 293 primary: keyword_defined opt_nl '(' . $@10 expr rparen + 293 primary: keyword_defined opt_nl '(' . @10 expr rparen - $default reduce using rule 292 ($@10) + $default reduce using rule 292 (@10) - $@10 go to state 604 + @10 go to state 604 state 423 - 237 arg: keyword_defined opt_nl $@6 . arg + 237 arg: keyword_defined opt_nl @6 . arg keyword_class shift, and go to state 5 keyword_module shift, and go to state 6 @@ -14197,7 +14197,7 @@ state 423 state 424 - 10 top_stmt: keyword_BEGIN $@2 '{' . top_compstmt '}' + 10 top_stmt: keyword_BEGIN @2 '{' . top_compstmt '}' error shift, and go to state 4 keyword_class shift, and go to state 5 @@ -14684,7 +14684,7 @@ state 434 state 435 - 282 primary: tLPAREN_ARG expr $@9 . rparen + 282 primary: tLPAREN_ARG expr @9 . rparen '\n' shift, and go to state 224 @@ -14940,7 +14940,7 @@ state 443 state 444 - 293 primary: keyword_defined opt_nl . '(' $@10 expr rparen + 293 primary: keyword_defined opt_nl . '(' @10 expr rparen '(' shift, and go to state 422 @@ -18000,7 +18000,7 @@ state 544 state 545 - 304 primary: k_while $@11 expr_value . do $@12 compstmt k_end + 304 primary: k_while @11 expr_value . do @12 compstmt k_end keyword_do_cond shift, and go to state 685 ';' shift, and go to state 288 @@ -18012,7 +18012,7 @@ state 545 state 546 - 307 primary: k_until $@13 expr_value . do $@14 compstmt k_end + 307 primary: k_until @13 expr_value . do @14 compstmt k_end keyword_do_cond shift, and go to state 685 ';' shift, and go to state 288 @@ -18357,11 +18357,11 @@ state 553 state 554 - 312 primary: k_for for_var keyword_in . $@15 expr_value do $@16 compstmt k_end + 312 primary: k_for for_var keyword_in . @15 expr_value do @16 compstmt k_end - $default reduce using rule 310 ($@15) + $default reduce using rule 310 (@15) - $@15 go to state 697 + @15 go to state 697 state 555 @@ -18415,11 +18415,11 @@ state 559 state 560 - 494 superclass: '<' . $@32 expr_value term + 494 superclass: '<' . @32 expr_value term - $default reduce using rule 493 ($@32) + $default reduce using rule 493 (@32) - $@32 go to state 700 + @32 go to state 700 state 561 @@ -18761,7 +18761,7 @@ state 566 state 567 - 540 singleton: '(' $@33 . expr rparen + 540 singleton: '(' @33 . expr rparen keyword_class shift, and go to state 5 keyword_module shift, and go to state 6 @@ -18905,11 +18905,11 @@ state 570 state 571 - 324 primary: k_def singleton dot_or_colon . $@22 fname $@23 f_arglist bodystmt k_end + 324 primary: k_def singleton dot_or_colon . @22 fname @23 f_arglist bodystmt k_end - $default reduce using rule 322 ($@22) + $default reduce using rule 322 (@22) - $@22 go to state 711 + @22 go to state 711 state 572 @@ -19184,7 +19184,7 @@ state 583 state 584 - 123 undef_list: undef_list ',' $@5 . fitem + 123 undef_list: undef_list ',' @5 . fitem keyword_class shift, and go to state 113 keyword_module shift, and go to state 114 @@ -19888,14 +19888,14 @@ state 602 state 603 - 18 stmt: keyword_alias fitem $@3 fitem . + 18 stmt: keyword_alias fitem @3 fitem . $default reduce using rule 18 (stmt) state 604 - 293 primary: keyword_defined opt_nl '(' $@10 . expr rparen + 293 primary: keyword_defined opt_nl '(' @10 . expr rparen keyword_class shift, and go to state 5 keyword_module shift, and go to state 6 @@ -20018,7 +20018,7 @@ state 605 233 | arg . tRSHFT arg 234 | arg . tANDOP arg 235 | arg . tOROP arg - 237 | keyword_defined opt_nl $@6 arg . + 237 | keyword_defined opt_nl @6 arg . 238 | arg . '?' arg opt_nl ':' arg tPOW shift, and go to state 308 @@ -20053,7 +20053,7 @@ state 605 state 606 - 10 top_stmt: keyword_BEGIN $@2 '{' top_compstmt . '}' + 10 top_stmt: keyword_BEGIN @2 '{' top_compstmt . '}' '}' shift, and go to state 730 @@ -20178,7 +20178,7 @@ state 612 state 613 - 282 primary: tLPAREN_ARG expr $@9 rparen . + 282 primary: tLPAREN_ARG expr @9 rparen . $default reduce using rule 282 (primary) @@ -21935,11 +21935,11 @@ state 685 state 686 - 304 primary: k_while $@11 expr_value do . $@12 compstmt k_end + 304 primary: k_while @11 expr_value do . @12 compstmt k_end - $default reduce using rule 303 ($@12) + $default reduce using rule 303 (@12) - $@12 go to state 800 + @12 go to state 800 state 687 @@ -21951,11 +21951,11 @@ state 687 state 688 - 307 primary: k_until $@13 expr_value do . $@14 compstmt k_end + 307 primary: k_until @13 expr_value do . @14 compstmt k_end - $default reduce using rule 306 ($@14) + $default reduce using rule 306 (@14) - $@14 go to state 801 + @14 go to state 801 state 689 @@ -22053,7 +22053,7 @@ state 696 state 697 - 312 primary: k_for for_var keyword_in $@15 . expr_value do $@16 compstmt k_end + 312 primary: k_for for_var keyword_in @15 . expr_value do @16 compstmt k_end keyword_class shift, and go to state 5 keyword_module shift, and go to state 6 @@ -22169,7 +22169,7 @@ state 699 state 700 - 494 superclass: '<' $@32 . expr_value term + 494 superclass: '<' @32 . expr_value term keyword_class shift, and go to state 5 keyword_module shift, and go to state 6 @@ -22447,7 +22447,7 @@ state 707 45 expr: expr . keyword_and expr 46 | expr . keyword_or expr - 540 singleton: '(' $@33 expr . rparen + 540 singleton: '(' @33 expr . rparen keyword_and shift, and go to state 298 keyword_or shift, and go to state 299 @@ -22622,7 +22622,7 @@ state 710 state 711 - 324 primary: k_def singleton dot_or_colon $@22 . fname $@23 f_arglist bodystmt k_end + 324 primary: k_def singleton dot_or_colon @22 . fname @23 f_arglist bodystmt k_end keyword_class shift, and go to state 113 keyword_module shift, and go to state 114 @@ -23074,7 +23074,7 @@ state 719 state 720 - 123 undef_list: undef_list ',' $@5 fitem . + 123 undef_list: undef_list ',' @5 fitem . $default reduce using rule 123 (undef_list) @@ -23495,7 +23495,7 @@ state 729 45 expr: expr . keyword_and expr 46 | expr . keyword_or expr - 293 primary: keyword_defined opt_nl '(' $@10 expr . rparen + 293 primary: keyword_defined opt_nl '(' @10 expr . rparen keyword_and shift, and go to state 298 keyword_or shift, and go to state 299 @@ -23509,7 +23509,7 @@ state 729 state 730 - 10 top_stmt: keyword_BEGIN $@2 '{' top_compstmt '}' . + 10 top_stmt: keyword_BEGIN @2 '{' top_compstmt '}' . $default reduce using rule 10 (top_stmt) @@ -25326,7 +25326,7 @@ state 799 state 800 - 304 primary: k_while $@11 expr_value do $@12 . compstmt k_end + 304 primary: k_while @11 expr_value do @12 . compstmt k_end error shift, and go to state 241 keyword_class shift, and go to state 5 @@ -25443,7 +25443,7 @@ state 800 state 801 - 307 primary: k_until $@13 expr_value do $@14 . compstmt k_end + 307 primary: k_until @13 expr_value do @14 . compstmt k_end error shift, and go to state 241 keyword_class shift, and go to state 5 @@ -25793,7 +25793,7 @@ state 805 state 806 - 312 primary: k_for for_var keyword_in $@15 expr_value . do $@16 compstmt k_end + 312 primary: k_for for_var keyword_in @15 expr_value . do @16 compstmt k_end keyword_do_cond shift, and go to state 685 ';' shift, and go to state 288 @@ -25814,7 +25814,7 @@ state 807 state 808 - 494 superclass: '<' $@32 expr_value . term + 494 superclass: '<' @32 expr_value . term ';' shift, and go to state 288 '\n' shift, and go to state 289 @@ -25847,7 +25847,7 @@ state 811 state 812 - 540 singleton: '(' $@33 expr rparen . + 540 singleton: '(' @33 expr rparen . $default reduce using rule 540 (singleton) @@ -25882,11 +25882,11 @@ state 815 state 816 - 324 primary: k_def singleton dot_or_colon $@22 fname . $@23 f_arglist bodystmt k_end + 324 primary: k_def singleton dot_or_colon @22 fname . @23 f_arglist bodystmt k_end - $default reduce using rule 323 ($@23) + $default reduce using rule 323 (@23) - $@23 go to state 880 + @23 go to state 880 state 817 @@ -26277,7 +26277,7 @@ state 822 state 823 - 293 primary: keyword_defined opt_nl '(' $@10 expr rparen . + 293 primary: keyword_defined opt_nl '(' @10 expr rparen . $default reduce using rule 293 (primary) @@ -27133,7 +27133,7 @@ state 869 state 870 - 304 primary: k_while $@11 expr_value do $@12 compstmt . k_end + 304 primary: k_while @11 expr_value do @12 compstmt . k_end keyword_end shift, and go to state 677 @@ -27142,7 +27142,7 @@ state 870 state 871 - 307 primary: k_until $@13 expr_value do $@14 compstmt . k_end + 307 primary: k_until @13 expr_value do @14 compstmt . k_end keyword_end shift, and go to state 677 @@ -27173,11 +27173,11 @@ state 873 state 874 - 312 primary: k_for for_var keyword_in $@15 expr_value do . $@16 compstmt k_end + 312 primary: k_for for_var keyword_in @15 expr_value do . @16 compstmt k_end - $default reduce using rule 311 ($@16) + $default reduce using rule 311 (@16) - $@16 go to state 926 + @16 go to state 926 state 875 @@ -27303,7 +27303,7 @@ state 875 state 876 - 494 superclass: '<' $@32 expr_value term . + 494 superclass: '<' @32 expr_value term . $default reduce using rule 494 (superclass) @@ -27331,7 +27331,7 @@ state 879 state 880 - 324 primary: k_def singleton dot_or_colon $@22 fname $@23 . f_arglist bodystmt k_end + 324 primary: k_def singleton dot_or_colon @22 fname @23 . f_arglist bodystmt k_end tIDENTIFIER shift, and go to state 622 tGVAR shift, and go to state 623 @@ -28038,14 +28038,14 @@ state 920 state 921 - 304 primary: k_while $@11 expr_value do $@12 compstmt k_end . + 304 primary: k_while @11 expr_value do @12 compstmt k_end . $default reduce using rule 304 (primary) state 922 - 307 primary: k_until $@13 expr_value do $@14 compstmt k_end . + 307 primary: k_until @13 expr_value do @14 compstmt k_end . $default reduce using rule 307 (primary) @@ -28073,7 +28073,7 @@ state 925 state 926 - 312 primary: k_for for_var keyword_in $@15 expr_value do $@16 . compstmt k_end + 312 primary: k_for for_var keyword_in @15 expr_value do @16 . compstmt k_end error shift, and go to state 241 keyword_class shift, and go to state 5 @@ -28199,7 +28199,7 @@ state 927 state 928 - 324 primary: k_def singleton dot_or_colon $@22 fname $@23 f_arglist . bodystmt k_end + 324 primary: k_def singleton dot_or_colon @22 fname @23 f_arglist . bodystmt k_end error shift, and go to state 241 keyword_class shift, and go to state 5 @@ -28842,7 +28842,7 @@ state 954 state 955 - 312 primary: k_for for_var keyword_in $@15 expr_value do $@16 compstmt . k_end + 312 primary: k_for for_var keyword_in @15 expr_value do @16 compstmt . k_end keyword_end shift, and go to state 677 @@ -28858,7 +28858,7 @@ state 956 state 957 - 324 primary: k_def singleton dot_or_colon $@22 fname $@23 f_arglist bodystmt . k_end + 324 primary: k_def singleton dot_or_colon @22 fname @23 f_arglist bodystmt . k_end keyword_end shift, and go to state 677 @@ -29089,14 +29089,14 @@ state 977 state 978 - 312 primary: k_for for_var keyword_in $@15 expr_value do $@16 compstmt k_end . + 312 primary: k_for for_var keyword_in @15 expr_value do @16 compstmt k_end . $default reduce using rule 312 (primary) state 979 - 324 primary: k_def singleton dot_or_colon $@22 fname $@23 f_arglist bodystmt k_end . + 324 primary: k_def singleton dot_or_colon @22 fname @23 f_arglist bodystmt k_end . $default reduce using rule 324 (primary) diff --git a/ext/socket/basicsocket.c b/ext/socket/basicsocket.c index b997043..6f942e3 100644 --- a/ext/socket/basicsocket.c +++ b/ext/socket/basicsocket.c @@ -358,11 +358,13 @@ bsock_getsockname(VALUE sock) { struct sockaddr_storage buf; socklen_t len = (socklen_t)sizeof buf; + socklen_t len0 = len; rb_io_t *fptr; GetOpenFile(sock, fptr); if (getsockname(fptr->fd, (struct sockaddr*)&buf, &len) < 0) rb_sys_fail("getsockname(2)"); + if (len0 < len) len = len0; return rb_str_new((char*)&buf, len); } @@ -387,11 +389,13 @@ bsock_getpeername(VALUE sock) { struct sockaddr_storage buf; socklen_t len = (socklen_t)sizeof buf; + socklen_t len0 = len; rb_io_t *fptr; GetOpenFile(sock, fptr); if (getpeername(fptr->fd, (struct sockaddr*)&buf, &len) < 0) rb_sys_fail("getpeername(2)"); + if (len0 < len) len = len0; return rb_str_new((char*)&buf, len); } @@ -475,11 +479,13 @@ bsock_local_address(VALUE sock) { struct sockaddr_storage buf; socklen_t len = (socklen_t)sizeof buf; + socklen_t len0 = len; rb_io_t *fptr; GetOpenFile(sock, fptr); if (getsockname(fptr->fd, (struct sockaddr*)&buf, &len) < 0) rb_sys_fail("getsockname(2)"); + if (len0 < len) len = len0; return rsock_fd_socket_addrinfo(fptr->fd, (struct sockaddr *)&buf, len); } @@ -507,11 +513,13 @@ bsock_remote_address(VALUE sock) { struct sockaddr_storage buf; socklen_t len = (socklen_t)sizeof buf; + socklen_t len0 = len; rb_io_t *fptr; GetOpenFile(sock, fptr); if (getpeername(fptr->fd, (struct sockaddr*)&buf, &len) < 0) rb_sys_fail("getpeername(2)"); + if (len0 < len) len = len0; return rsock_fd_socket_addrinfo(fptr->fd, (struct sockaddr *)&buf, len); } diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index 380b3ec..5c29876 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -24,6 +24,12 @@ else have_library("socket", "socket") end +if /darwin/ =~ RUBY_PLATFORM + # For IPv6 extension header access on OS X 10.7+ [Bug #8517] + $CFLAGS << " -D__APPLE_USE_RFC_3542" +end + +headers = [] unless $mswin or $bccwin or $mingw headers = %w<sys/types.h netdb.h string.h sys/socket.h netinet/in.h> end diff --git a/ext/socket/init.c b/ext/socket/init.c index 0a23658..54452e4 100644 --- a/ext/socket/init.c +++ b/ext/socket/init.c @@ -448,6 +448,7 @@ VALUE rsock_s_accept_nonblock(VALUE klass, rb_io_t *fptr, struct sockaddr *sockaddr, socklen_t *len) { int fd2; + socklen_t len0 = len ? *len : 0; rb_secure(3); rb_io_set_nonblock(fptr); @@ -466,6 +467,7 @@ rsock_s_accept_nonblock(VALUE klass, rb_io_t *fptr, struct sockaddr *sockaddr, s } rb_sys_fail("accept(2)"); } + if (len && len0 < *len) *len = len0; rb_update_max_fd(fd2); make_fd_nonblock(fd2); return rsock_init_sock(rb_obj_alloc(klass), fd2); @@ -481,7 +483,12 @@ static VALUE accept_blocking(void *data) { struct accept_arg *arg = data; - return (VALUE)accept(arg->fd, arg->sockaddr, arg->len); + int ret; + socklen_t len0 = 0; + if (arg->len) len0 = *arg->len; + ret = accept(arg->fd, arg->sockaddr, arg->len); + if (arg->len && len0 < *arg->len) *arg->len = len0; + return (VALUE)ret; } VALUE diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb index d311eed..66ff548 100644 --- a/ext/socket/lib/socket.rb +++ b/ext/socket/lib/socket.rb @@ -716,12 +716,14 @@ class Socket < BasicSocket # } # def self.unix_server_socket(path) - begin - st = File.lstat(path) - rescue Errno::ENOENT - end - if st && st.socket? && st.owned? - File.unlink path + if !unix_socket_abstract_name?(path) + begin + st = File.lstat(path) + rescue Errno::ENOENT + end + if st && st.socket? && st.owned? + File.unlink path + end end s = Addrinfo.unix(path).listen if block_given? @@ -729,13 +731,23 @@ class Socket < BasicSocket yield s ensure s.close if !s.closed? - File.unlink path + if !unix_socket_abstract_name?(path) + File.unlink path + end end else s end end + class << self + private + + def unix_socket_abstract_name?(path) + /linux/ =~ RUBY_PLATFORM && /\A(\0|\z)/ =~ path + end + end + # creates a UNIX socket server on _path_. # It calls the block for each socket accepted. # diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c index 2229269..80e59a0 100644 --- a/ext/socket/raddrinfo.c +++ b/ext/socket/raddrinfo.c @@ -421,20 +421,46 @@ rsock_ipaddr(struct sockaddr *sockaddr, int norevlookup) } #ifdef HAVE_SYS_UN_H -const char* -rsock_unixpath(struct sockaddr_un *sockaddr, socklen_t len) +VALUE +rsock_unixpath_str(struct sockaddr_un *sockaddr, socklen_t len) { - if (sockaddr->sun_path < (char*)sockaddr + len) - return sockaddr->sun_path; + char *s, *e; + s = sockaddr->sun_path; + e = (char *)sockaddr + len; + while (s < e && *(e-1) == '\0') + e--; + if (s <= e) + return rb_str_new(s, e-s); else - return ""; + return rb_str_new2(""); } VALUE rsock_unixaddr(struct sockaddr_un *sockaddr, socklen_t len) { return rb_assoc_new(rb_str_new2("AF_UNIX"), - rb_str_new2(rsock_unixpath(sockaddr, len))); + rsock_unixpath_str(sockaddr, len)); +} + +socklen_t +rsock_unix_sockaddr_len(VALUE path) +{ +#ifdef __linux__ + if (RSTRING_LEN(path) == 0) { + /* autobind; see unix(7) for details. */ + return (socklen_t) sizeof(sa_family_t); + } + else if (RSTRING_PTR(path)[0] == '\0') { + /* abstract namespace; see unix(7) for details. */ + return (socklen_t) offsetof(struct sockaddr_un, sun_path) + + RSTRING_LEN(path); + } + else { +#endif + return (socklen_t) sizeof(struct sockaddr_un); +#ifdef __linux__ + } +#endif } #endif @@ -763,19 +789,22 @@ static void init_unix_addrinfo(rb_addrinfo_t *rai, VALUE path, int socktype) { struct sockaddr_un un; + socklen_t len; StringValue(path); - if (sizeof(un.sun_path) <= (size_t)RSTRING_LEN(path)) - rb_raise(rb_eArgError, "too long unix socket path (max: %dbytes)", - (int)sizeof(un.sun_path)-1); + if (sizeof(un.sun_path) < (size_t)RSTRING_LEN(path)) + rb_raise(rb_eArgError, + "too long unix socket path (%"PRIuSIZE" bytes given but %"PRIuSIZE" bytes max)", + (size_t)RSTRING_LEN(path), sizeof(un.sun_path)); MEMZERO(&un, struct sockaddr_un, 1); un.sun_family = AF_UNIX; memcpy((void*)&un.sun_path, RSTRING_PTR(path), RSTRING_LEN(path)); - init_addrinfo(rai, (struct sockaddr *)&un, (socklen_t)sizeof(un), + len = rsock_unix_sockaddr_len(path); + init_addrinfo(rai, (struct sockaddr *)&un, len, PF_UNIX, socktype, 0, Qnil, Qnil); } #endif @@ -996,9 +1025,11 @@ inspect_sockaddr(VALUE addrinfo, VALUE ret) case AF_UNIX: { struct sockaddr_un *addr = (struct sockaddr_un *)&rai->addr; - char *p, *s, *t, *e; + char *p, *s, *e; s = addr->sun_path; e = (char*)addr + rai->sockaddr_len; + while (s < e && *(e-1) == '\0') + e--; if (e < s) rb_str_cat2(ret, "too-short-AF_UNIX-sockaddr"); else if (s == e) @@ -1006,28 +1037,17 @@ inspect_sockaddr(VALUE addrinfo, VALUE ret) else { int printable_only = 1; p = s; - while (p < e && *p != '\0') { + while (p < e) { printable_only = printable_only && ISPRINT(*p) && !ISSPACE(*p); p++; } - t = p; - while (p < e && *p == '\0') - p++; - if (printable_only && /* only printable, no space */ - t < e && /* NUL terminated */ - p == e) { /* no data after NUL */ - if (s == t) - rb_str_cat2(ret, "empty-path-AF_UNIX-sockaddr"); - else if (s[0] == '/') /* absolute path */ - rb_str_cat2(ret, s); - else - rb_str_catf(ret, "AF_UNIX %s", s); + if (printable_only) { /* only printable, no space */ + if (s[0] != '/') /* relative path */ + rb_str_cat2(ret, "AF_UNIX "); + rb_str_cat(ret, s, p - s); } else { rb_str_cat2(ret, "AF_UNIX"); - e = (char *)addr->sun_path + sizeof(addr->sun_path); - while (s < e && *(e-1) == '\0') - e--; while (s < e) rb_str_catf(ret, ":%02x", (unsigned char)*s++); } @@ -1201,7 +1221,7 @@ addrinfo_mdump(VALUE self) struct sockaddr_un *su = (struct sockaddr_un *)&rai->addr; char *s, *e; s = su->sun_path; - e = (char*)s + sizeof(su->sun_path); + e = (char*)su + rai->sockaddr_len; while (s < e && *(e-1) == '\0') e--; sockaddr = rb_str_new(s, e-s); @@ -1298,12 +1318,14 @@ addrinfo_mload(VALUE self, VALUE ary) case AF_UNIX: { struct sockaddr_un uaddr; - memset(&uaddr, 0, sizeof(uaddr)); + MEMZERO(&uaddr, struct sockaddr_un, 1); uaddr.sun_family = AF_UNIX; StringValue(v); - if (sizeof(uaddr.sun_path) <= (size_t)RSTRING_LEN(v)) - rb_raise(rb_eSocket, "too long AF_UNIX path"); + if (sizeof(uaddr.sun_path) < (size_t)RSTRING_LEN(v)) + rb_raise(rb_eSocket, + "too long AF_UNIX path (%"PRIuSIZE" bytes given but %"PRIuSIZE" bytes max)", + (size_t)RSTRING_LEN(v), sizeof(uaddr.sun_path)); memcpy(uaddr.sun_path, RSTRING_PTR(v), RSTRING_LEN(v)); len = (socklen_t)sizeof(uaddr); memcpy(&ss, &uaddr, len); diff --git a/ext/socket/rubysocket.h b/ext/socket/rubysocket.h index 4c0efdb..ab05270 100644 --- a/ext/socket/rubysocket.h +++ b/ext/socket/rubysocket.h @@ -233,8 +233,9 @@ VALUE rsock_make_hostent(VALUE host, struct addrinfo *addr, VALUE (*ipaddr)(stru int rsock_revlookup_flag(VALUE revlookup, int *norevlookup); #ifdef HAVE_SYS_UN_H -const char* rsock_unixpath(struct sockaddr_un *sockaddr, socklen_t len); +VALUE rsock_unixpath_str(struct sockaddr_un *sockaddr, socklen_t len); VALUE rsock_unixaddr(struct sockaddr_un *sockaddr, socklen_t len); +socklen_t rsock_unix_sockaddr_len(VALUE path); #endif int rsock_socket(int domain, int type, int proto); diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 4613892..bfe2edb 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -954,13 +954,12 @@ sock_s_gethostbyaddr(int argc, VALUE *argv) { VALUE addr, family; struct hostent *h; - struct sockaddr *sa; char **pch; VALUE ary, names; int t = AF_INET; rb_scan_args(argc, argv, "11", &addr, &family); - sa = (struct sockaddr*)StringValuePtr(addr); + StringValue(addr); if (!NIL_P(family)) { t = rsock_family_arg(family); } @@ -1371,18 +1370,17 @@ static VALUE sock_s_pack_sockaddr_un(VALUE self, VALUE path) { struct sockaddr_un sockaddr; - char *sun_path; VALUE addr; + StringValue(path); MEMZERO(&sockaddr, struct sockaddr_un, 1); sockaddr.sun_family = AF_UNIX; - sun_path = StringValueCStr(path); - if (sizeof(sockaddr.sun_path) <= strlen(sun_path)) { - rb_raise(rb_eArgError, "too long unix socket path (max: %dbytes)", - (int)sizeof(sockaddr.sun_path)-1); + if (sizeof(sockaddr.sun_path) < (size_t)RSTRING_LEN(path)) { + rb_raise(rb_eArgError, "too long unix socket path (%"PRIuSIZE" bytes given but %"PRIuSIZE" bytes max)", + (size_t)RSTRING_LEN(path), sizeof(sockaddr.sun_path)); } - strncpy(sockaddr.sun_path, sun_path, sizeof(sockaddr.sun_path)-1); - addr = rb_str_new((char*)&sockaddr, sizeof(sockaddr)); + memcpy(sockaddr.sun_path, RSTRING_PTR(path), RSTRING_LEN(path)); + addr = rb_str_new((char*)&sockaddr, rsock_unix_sockaddr_len(path)); OBJ_INFECT(addr, path); return addr; @@ -1404,7 +1402,6 @@ static VALUE sock_s_unpack_sockaddr_un(VALUE self, VALUE addr) { struct sockaddr_un * sockaddr; - const char *sun_path; VALUE path; sockaddr = (struct sockaddr_un*)SockAddrStringValuePtr(addr); @@ -1420,13 +1417,7 @@ sock_s_unpack_sockaddr_un(VALUE self, VALUE addr) rb_raise(rb_eTypeError, "too long sockaddr_un - %ld longer than %d", RSTRING_LEN(addr), (int)sizeof(struct sockaddr_un)); } - sun_path = rsock_unixpath(sockaddr, RSTRING_LENINT(addr)); - if (sizeof(struct sockaddr_un) == RSTRING_LEN(addr) && - sun_path == sockaddr->sun_path && - sun_path + strlen(sun_path) == RSTRING_PTR(addr) + RSTRING_LEN(addr)) { - rb_raise(rb_eArgError, "sockaddr_un.sun_path not NUL terminated"); - } - path = rb_str_new2(sun_path); + path = rsock_unixpath_str(sockaddr, RSTRING_LENINT(addr)); OBJ_INFECT(path, addr); return path; } diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c index 26822e5..3c30e92 100644 --- a/ext/socket/unixsocket.c +++ b/ext/socket/unixsocket.c @@ -13,6 +13,7 @@ #ifdef HAVE_SYS_UN_H struct unixsock_arg { struct sockaddr_un *sockaddr; + socklen_t sockaddrlen; int fd; }; @@ -21,13 +22,14 @@ unixsock_connect_internal(VALUE a) { struct unixsock_arg *arg = (struct unixsock_arg *)a; return (VALUE)rsock_connect(arg->fd, (struct sockaddr*)arg->sockaddr, - (socklen_t)sizeof(*arg->sockaddr), 0); + arg->sockaddrlen, 0); } VALUE rsock_init_unixsock(VALUE sock, VALUE path, int server) { struct sockaddr_un sockaddr; + socklen_t sockaddrlen; int fd, status; rb_io_t *fptr; @@ -39,19 +41,21 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server) MEMZERO(&sockaddr, struct sockaddr_un, 1); sockaddr.sun_family = AF_UNIX; - if (sizeof(sockaddr.sun_path) <= (size_t)RSTRING_LEN(path)) { - rb_raise(rb_eArgError, "too long unix socket path (max: %dbytes)", - (int)sizeof(sockaddr.sun_path)-1); + if (sizeof(sockaddr.sun_path) < (size_t)RSTRING_LEN(path)) { + rb_raise(rb_eArgError, "too long unix socket path (%ldbytes given but %dbytes max)", + RSTRING_LEN(path), (int)sizeof(sockaddr.sun_path)); } memcpy(sockaddr.sun_path, RSTRING_PTR(path), RSTRING_LEN(path)); + sockaddrlen = rsock_unix_sockaddr_len(path); if (server) { - status = bind(fd, (struct sockaddr*)&sockaddr, (socklen_t)sizeof(sockaddr)); + status = bind(fd, (struct sockaddr*)&sockaddr, sockaddrlen); } else { int prot; struct unixsock_arg arg; arg.sockaddr = &sockaddr; + arg.sockaddrlen = sockaddrlen; arg.fd = fd; status = (int)rb_protect(unixsock_connect_internal, (VALUE)&arg, &prot); if (prot) { @@ -62,7 +66,7 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server) if (status < 0) { close(fd); - rb_sys_fail(sockaddr.sun_path); + rb_sys_fail_str(rb_inspect(path)); } if (server) { @@ -116,9 +120,11 @@ unix_path(VALUE sock) if (NIL_P(fptr->pathv)) { struct sockaddr_un addr; socklen_t len = (socklen_t)sizeof(addr); + socklen_t len0 = len; if (getsockname(fptr->fd, (struct sockaddr*)&addr, &len) < 0) rb_sys_fail(0); - fptr->pathv = rb_obj_freeze(rb_str_new_cstr(rsock_unixpath(&addr, len))); + if (len0 < len) len = len0; + fptr->pathv = rb_obj_freeze(rsock_unixpath_str(&addr, len)); } return rb_str_dup(fptr->pathv); } @@ -445,11 +451,13 @@ unix_peeraddr(VALUE sock) rb_io_t *fptr; struct sockaddr_un addr; socklen_t len = (socklen_t)sizeof addr; + socklen_t len0 = len; GetOpenFile(sock, fptr); if (getpeername(fptr->fd, (struct sockaddr*)&addr, &len) < 0) rb_sys_fail("getpeername(2)"); + if (len0 < len) len = len0; return rsock_unixaddr(&addr, len); } diff --git a/ext/syslog/syslog.c b/ext/syslog/syslog.c index 76aef9c..3e704bd 100644 --- a/ext/syslog/syslog.c +++ b/ext/syslog/syslog.c @@ -5,7 +5,7 @@ * Documented by mathew <meta@pobox.com> * * $RoughId: syslog.c,v 1.21 2002/02/25 12:21:17 knu Exp $ - * $Id: syslog.c 31234 2011-04-03 13:58:32Z nagachika $ + * $Id: syslog.c 35740 2012-05-21 07:24:34Z knu $ */ #include "ruby/ruby.h" @@ -315,6 +315,8 @@ static VALUE mSyslog_inspect(VALUE self) { char buf[1024]; + Check_Type(self, T_MODULE); + if (syslog_opened) { snprintf(buf, sizeof(buf), "<#%s: opened=true, ident=\"%s\", options=%d, facility=%d, mask=%d>", diff --git a/ext/tk/extconf.rb b/ext/tk/extconf.rb index 2f68d01..2b5c8c4 100644 --- a/ext/tk/extconf.rb +++ b/ext/tk/extconf.rb @@ -114,7 +114,7 @@ def is_macosx? end def maybe_64bit? - /64|universal/ =~ RUBY_PLATFORM + /64|universal|s390x/ =~ RUBY_PLATFORM end def check_tcltk_version(version) @@ -313,7 +313,9 @@ def find_macosx_framework paths.reverse! unless TkLib_Config["ActiveTcl"] # system has higher priority paths.map{|dir| dir.strip.chomp('/')}.each{|dir| + next unless File.exist?(File.join(dir, "Tcl.framework", "Headers")) next unless File.directory?(tcldir = File.join(dir, "Tcl.framework")) + next unless File.exist?(File.join(dir, "Tk.framework"), "Headers") next unless File.directory?(tkdir = File.join(dir, "Tk.framework")) TkLib_Config["tcltk-framework"] = dir return [tcldir, tkdir] diff --git a/ext/tk/lib/tk/canvas.rb b/ext/tk/lib/tk/canvas.rb index 7d3d716..af40421 100644 --- a/ext/tk/lib/tk/canvas.rb +++ b/ext/tk/lib/tk/canvas.rb @@ -85,11 +85,16 @@ class Tk::Canvas<TkWindow # create a canvas item without creating a TkcItem object def create(type, *args) - type = TkcItem.type2class(type.to_s) unless type.kind_of?(TkcItem) + if type.kind_of?(Class) && type < TkcItem + # do nothing + elsif TkcItem.type2class(type.to_s) + type = TkcItem.type2class(type.to_s) + else + fail ArgumentError, "type must a subclass of TkcItem class, or a string in CItemTypeToClass" + end type.create(self, *args) end - def addtag(tag, mode, *args) mode = mode.to_s if args[0] && mode =~ /^(above|below|with(tag)?)$/ diff --git a/ext/tk/sample/demos-en/tree.rb b/ext/tk/sample/demos-en/tree.rb index cd62ba8..69154ee 100644 --- a/ext/tk/sample/demos-en/tree.rb +++ b/ext/tk/sample/demos-en/tree.rb @@ -67,7 +67,7 @@ def populate_tree(tree, node) path = tree.get(node, :fullpath) tree.delete(tree.children(node)) Dir.glob("#{path}/*").sort.each{|f| - type = File.ftype(f) + type = File.ftype(f) rescue nil id = tree.insert(node, :end, :text=>File.basename(f), :values=>[f, type]).id if type == 'directory' diff --git a/ext/tk/sample/demos-en/widget b/ext/tk/sample/demos-en/widget index e6510c7..3778929 100644 --- a/ext/tk/sample/demos-en/widget +++ b/ext/tk/sample/demos-en/widget @@ -683,7 +683,7 @@ def eval_samplecode(code, file=nil) end } } - Tk.update + Tk.update rescue nil end # invoke -- @@ -699,7 +699,7 @@ def invoke(txt, idx) cursor = txt.cget('cursor') txt.cursor('watch') - Tk.update + Tk.update rescue nil # eval(IO.readlines("#{[$demo_dir, tag[5..-1]].join(File::Separator)}.rb").join, _null_binding) # Tk.update eval_samplecode(IO.readlines("#{[$demo_dir, tag[5..-1]].join(File::Separator)}.rb").join, tag[5..-1] + '.rb') @@ -1058,7 +1058,7 @@ if ARGV[0] == '-n' no_launcher = true if ARGV.size > 0 else # show the root widget to make it lower then demo windows - Tk.update + Tk.update rescue nil end ARGV.each{|cmd| if cmd =~ /(.*).rb/ diff --git a/ext/tk/sample/demos-jp/tree.rb b/ext/tk/sample/demos-jp/tree.rb index 00d7152..f685544 100644 --- a/ext/tk/sample/demos-jp/tree.rb +++ b/ext/tk/sample/demos-jp/tree.rb @@ -68,7 +68,7 @@ def populate_tree(tree, node) path = tree.get(node, :fullpath) tree.delete(tree.children(node)) Dir.glob("#{path}/*").sort.each{|f| - type = File.ftype(f) + type = File.ftype(f) rescue nil id = tree.insert(node, :end, :text=>File.basename(f), :values=>[f, type]).id if type == 'directory' diff --git a/ext/tk/sample/demos-jp/widget b/ext/tk/sample/demos-jp/widget index fc3c084..ae91031 100644 --- a/ext/tk/sample/demos-jp/widget +++ b/ext/tk/sample/demos-jp/widget @@ -740,7 +740,7 @@ def eval_samplecode(code, file=nil) end } } - Tk.update + Tk.update rescue nil end # テキスト上での click に対する動作 @@ -750,7 +750,7 @@ def invoke(txt, idx) cursor = txt.cget('cursor') txt.cursor('watch') - Tk.update + Tk.update rescue nil # eval(IO.readlines("#{[$demo_dir, tag[5..-1]].join(File::Separator)}.rb").join, _null_binding) # Tk.update eval_samplecode(IO.readlines("#{[$demo_dir, tag[5..-1]].join(File::Separator)}.rb").join, tag[5..-1] + '.rb') @@ -1094,7 +1094,7 @@ if ARGV[0] == '-n' no_launcher = true if ARGV.size > 0 else # show the root widget to make it lower then demo windows - Tk.update + Tk.update rescue nil end ARGV.each{|cmd| if cmd =~ /(.*).rb/ diff --git a/ext/zlib/extconf.rb b/ext/zlib/extconf.rb index 0838cfc..3442a3f 100644 --- a/ext/zlib/extconf.rb +++ b/ext/zlib/extconf.rb @@ -1,7 +1,7 @@ # # extconf.rb # -# $Id: extconf.rb 26353 2010-01-19 05:14:29Z usa $ +# $Id: extconf.rb 37561 2012-11-08 08:34:18Z usa $ # require 'mkmf' @@ -10,7 +10,7 @@ require 'rbconfig' dir_config 'zlib' -if %w'z libz zlib1 zlib zdll'.find {|z| have_library(z, 'deflateReset')} and +if %w'z libz zlib1 zlib zdll zlibwapi'.find {|z| have_library(z, 'deflateReset')} and have_header('zlib.h') then defines = [] @@ -48,8 +48,7 @@ if %w'z libz zlib1 zlib zdll'.find {|z| have_library(z, 'deflateReset')} and 'OS_UNKNOWN' => 'Unknown', } unless OS_NAMES.key? os_code then - puts "invalid OS_CODE `#{os_code}'" - exit + raise "invalid OS_CODE `#{os_code}'" end message "#{OS_NAMES[os_code]}\n" defines << "OS_CODE=#{os_code}" @@ -58,6 +57,7 @@ if %w'z libz zlib1 zlib zdll'.find {|z| have_library(z, 'deflateReset')} and have_func('crc32_combine', 'zlib.h') have_func('adler32_combine', 'zlib.h') + have_type('z_crc_t', 'zlib.h') create_makefile('zlib') diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 5607162..b5495a2 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -3,7 +3,7 @@ * * Copyright (C) UENO Katsuhiro 2000-2003 * - * $Id: zlib.c 34544 2012-02-10 18:37:45Z naruse $ + * $Id: zlib.c 36939 2012-09-09 14:01:53Z naruse $ */ #include <ruby.h> @@ -464,7 +464,11 @@ rb_zlib_crc32_combine(VALUE klass, VALUE crc1, VALUE crc2, VALUE len2) static VALUE rb_zlib_crc_table(VALUE obj) { - const unsigned long *crctbl; +#if !defined(HAVE_TYPE_Z_CRC_T) + /* z_crc_t is defined since zlib-1.2.7. */ + typedef unsigned long z_crc_t; +#endif + const z_crc_t *crctbl; VALUE dst; int i; @@ -1732,7 +1736,7 @@ do_inflate(struct zstream *z, VALUE src) return; } StringValue(src); - if (RSTRING_LEN(src) > 0) { /* prevent Z_BUF_ERROR */ + if (RSTRING_LEN(src) > 0 || z->stream.avail_in > 0) { /* prevent Z_BUF_ERROR */ zstream_run(z, (Bytef*)RSTRING_PTR(src), RSTRING_LEN(src), Z_SYNC_FLUSH); } } @@ -1749,7 +1753,23 @@ do_inflate(struct zstream *z, VALUE src) * * Raises a Zlib::NeedDict exception if a preset dictionary is needed to * decompress. Set the dictionary by Zlib::Inflate#set_dictionary and then - * call this method again with an empty string. (<i>???</i>) + * call this method again with an empty string to flush the stream: + * + * inflater = Zlib::Inflate.new + * + * begin + * out = inflater.inflate compressed + * rescue Zlib::NeedDict + * # ensure the dictionary matches the stream's required dictionary + * raise unless inflater.adler == Zlib.adler32(dictionary) + * + * inflater.set_dictionary dictionary + * inflater.inflate '' + * end + * + * # ... + * + * inflater.close * * See also Zlib::Inflate.new */ |