mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
1.1b8_00?
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@94 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d516dedc98
commit
48943ec3ae
6 changed files with 420 additions and 59 deletions
13
ChangeLog
13
ChangeLog
|
@ -3,6 +3,9 @@ Wed Feb 25 15:50:07 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
|||
* eval.c (mod_module_eval): clear the_scope's PRIVATE flag before
|
||||
calling eval().
|
||||
|
||||
* gc.c (gc_call_finalizer_at_exit): run finalizers before any data
|
||||
object being freed.
|
||||
|
||||
* eval.c (rb_eval): needed to keep prot_tag->retval before
|
||||
evaluating the ensure clause.
|
||||
|
||||
|
@ -11,8 +14,8 @@ Tue Feb 24 11:16:32 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
|||
* parse.y (yylex): reserved words can be appear as method names at
|
||||
right after 'def' and `.'(dot), like foo.next.
|
||||
|
||||
* eval.c (return_check): checks for return out of thread (formaly
|
||||
done in return_value).
|
||||
* eval.c (return_check): checks for return out of thread (formerly
|
||||
done in return_value).
|
||||
|
||||
* eval.c (POP_TAG): copy retval to outer level.
|
||||
|
||||
|
@ -26,6 +29,12 @@ Tue Feb 24 11:16:32 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
|||
* parse.y (assignable): should not assign dyna_var to true, if it
|
||||
is already defined.
|
||||
|
||||
Mon Feb 23 14:35:03 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* object.c (obj_is_kind_of): no longer accepts true/false/nil.
|
||||
|
||||
* object.c ({true,false,nil}_to_i): can be converted into integers.
|
||||
|
||||
Mon Feb 23 12:11:51 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* re.c (reg_s_quote): needed to be mbchar aware.
|
||||
|
|
52
eval.c
52
eval.c
|
@ -2919,14 +2919,17 @@ rb_ensure(b_proc, data1, e_proc, data2)
|
|||
{
|
||||
int state;
|
||||
volatile VALUE result = Qnil;
|
||||
VALUE retval;
|
||||
|
||||
PUSH_TAG(PROT_NONE);
|
||||
if ((state = EXEC_TAG()) == 0) {
|
||||
result = (*b_proc)(data1);
|
||||
}
|
||||
POP_TAG();
|
||||
|
||||
retval = prot_tag->retval; /* save retval */
|
||||
(*e_proc)(data2);
|
||||
return_value(retval);
|
||||
|
||||
if (state) {
|
||||
JUMP_TAG(state);
|
||||
}
|
||||
|
@ -3710,39 +3713,32 @@ obj_instance_eval(self, src)
|
|||
return eval_under(CLASS_OF(self), self, src);
|
||||
}
|
||||
|
||||
mod_eval(arg)
|
||||
VALUE *arg;
|
||||
{
|
||||
return eval_under(arg[0], arg[0], arg[1]);
|
||||
}
|
||||
|
||||
static void
|
||||
mod_eval_ensure(a)
|
||||
int *a;
|
||||
{
|
||||
if (a[0]) {
|
||||
FL_TEST(the_scope, SCOPE_PRIVATE);
|
||||
}
|
||||
if (a[1]) {
|
||||
FL_TEST(the_scope, SCOPE_MODFUNC);
|
||||
}
|
||||
}
|
||||
|
||||
static VALUE
|
||||
mod_module_eval(mod, src)
|
||||
VALUE mod, src;
|
||||
{
|
||||
int f[2];
|
||||
VALUE arg[2];
|
||||
|
||||
f[0] = FL_TEST(the_scope, SCOPE_PRIVATE);
|
||||
f[1] = FL_TEST(the_scope, SCOPE_MODFUNC);
|
||||
int state;
|
||||
int private, modfunc;
|
||||
VALUE result = Qnil;
|
||||
|
||||
private = FL_TEST(the_scope, SCOPE_PRIVATE);
|
||||
modfunc = FL_TEST(the_scope, SCOPE_MODFUNC);
|
||||
FL_UNSET(the_scope, SCOPE_PRIVATE);
|
||||
FL_UNSET(the_scope, SCOPE_MODFUNC);
|
||||
PUSH_TAG(PROT_NONE)
|
||||
if ((state = EXEC_TAG()) == 0) {
|
||||
result = eval_under(mod, mod, src);
|
||||
}
|
||||
POP_TAG();
|
||||
if (private) {
|
||||
FL_TEST(the_scope, SCOPE_PRIVATE);
|
||||
}
|
||||
if (modfunc) {
|
||||
FL_TEST(the_scope, SCOPE_MODFUNC);
|
||||
}
|
||||
if (state) JUMP_TAG(state);
|
||||
|
||||
arg[0] = mod; arg[1] = src;
|
||||
return rb_ensure(mod_eval, arg, mod_eval_ensure, f);
|
||||
return result;
|
||||
}
|
||||
|
||||
VALUE rb_load_path;
|
||||
|
@ -5968,18 +5964,18 @@ f_throw(argc, argv)
|
|||
static void
|
||||
return_check()
|
||||
{
|
||||
#ifdef THREAD
|
||||
struct tag *tt = prot_tag;
|
||||
|
||||
while (tt) {
|
||||
if (tt->tag == PROT_FUNC) {
|
||||
break;
|
||||
}
|
||||
#ifdef THREAD
|
||||
if (tt->tag == PROT_THREAD) {
|
||||
Raise(eThreadError, "return from within thread 0x%x",
|
||||
curr_thread);
|
||||
}
|
||||
#endif
|
||||
tt = tt->prev;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
333
ext/gtk/gtk.c
333
ext/gtk/gtk.c
|
@ -5400,6 +5400,303 @@ idiag_initialize(self)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_s_new(klass)
|
||||
VALUE klass;
|
||||
{
|
||||
return make_gstyle(gtk_style_new());
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_attach(self, win)
|
||||
VALUE self, win;
|
||||
{
|
||||
return make_gstyle(gtk_style_attach(get_gstyle(self), get_gdkwindow(win)));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_detach(self)
|
||||
{
|
||||
gtk_style_detach(get_gstyle(self));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_set_bg(self, win, state_type)
|
||||
VALUE self, win, state_type;
|
||||
{
|
||||
gtk_style_set_background(get_gstyle(self), get_gdkwindow(win),
|
||||
(GtkStateType)NUM2INT(state_type));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_fg(self, idx)
|
||||
VALUE self, idx;
|
||||
{
|
||||
int i = NUM2INT(idx);
|
||||
|
||||
if (i < 0 || 5 < i) ArgError("state out of range");
|
||||
return make_gdkcolor(get_gstyle(self)->fg[i]);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_bg(self, idx)
|
||||
VALUE self, idx;
|
||||
{
|
||||
int i = NUM2INT(idx);
|
||||
|
||||
if (i < 0 || 5 < i) ArgError("state out of range");
|
||||
return make_gdkcolor(get_gstyle(self)->bg[i]);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_light(self, idx)
|
||||
VALUE self, idx;
|
||||
{
|
||||
int i = NUM2INT(idx);
|
||||
|
||||
if (i < 0 || 5 < i) ArgError("state out of range");
|
||||
return make_gdkcolor(get_gstyle(self)->light[i]);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_dark(self, idx)
|
||||
VALUE self, idx;
|
||||
{
|
||||
int i = NUM2INT(idx);
|
||||
|
||||
if (i < 0 || 5 < i) ArgError("state out of range");
|
||||
return make_gdkcolor(get_gstyle(self)->dark[i]);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_mid(self, idx)
|
||||
VALUE self, idx;
|
||||
{
|
||||
int i = NUM2INT(idx);
|
||||
|
||||
if (i < 0 || 5 < i) ArgError("state out of range");
|
||||
return make_gdkcolor(get_gstyle(self)->mid[i]);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_text(self, idx)
|
||||
VALUE self, idx;
|
||||
{
|
||||
int i = NUM2INT(idx);
|
||||
|
||||
if (i < 0 || 5 < i) ArgError("state out of range");
|
||||
return make_gdkcolor(get_gstyle(self)->text[i]);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_base(self, idx)
|
||||
VALUE self, idx;
|
||||
{
|
||||
int i = NUM2INT(idx);
|
||||
|
||||
if (i < 0 || 5 < i) ArgError("state out of range");
|
||||
return make_gdkcolor(get_gstyle(self)->base[i]);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_black(self)
|
||||
{
|
||||
return make_gdkcolor(get_gstyle(self)->black);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_white(self)
|
||||
{
|
||||
return make_gdkcolor(get_gstyle(self)->white);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_font(self)
|
||||
{
|
||||
return make_gdkfont(get_gstyle(self)->font);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_fg_gc(self, idx)
|
||||
VALUE self, idx;
|
||||
{
|
||||
int i = NUM2INT(idx);
|
||||
|
||||
if (i < 0 || 5 < i) ArgError("state out of range");
|
||||
return make_gdkgc(get_gstyle(self)->fg_gc[i]);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_bg_gc(self, idx)
|
||||
VALUE self, idx;
|
||||
{
|
||||
int i = NUM2INT(idx);
|
||||
|
||||
if (i < 0 || 5 < i) ArgError("state out of range");
|
||||
return make_gdkgc(get_gstyle(self)->bg_gc[i]);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_light_gc(self, idx)
|
||||
VALUE self, idx;
|
||||
{
|
||||
int i = NUM2INT(idx);
|
||||
|
||||
if (i < 0 || 5 < i) ArgError("state out of range");
|
||||
return make_gdkgc(get_gstyle(self)->light_gc[i]);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_dark_gc(self, idx)
|
||||
VALUE self, idx;
|
||||
{
|
||||
int i = NUM2INT(idx);
|
||||
|
||||
if (i < 0 || 5 < i) ArgError("state out of range");
|
||||
return make_gdkgc(get_gstyle(self)->dark_gc[i]);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_mid_gc(self, idx)
|
||||
VALUE self, idx;
|
||||
{
|
||||
int i = NUM2INT(idx);
|
||||
|
||||
if (i < 0 || 5 < i) ArgError("state out of range");
|
||||
return make_gdkgc(get_gstyle(self)->mid_gc[i]);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_text_gc(self, idx)
|
||||
VALUE self, idx;
|
||||
{
|
||||
int i = NUM2INT(idx);
|
||||
|
||||
if (i < 0 || 5 < i) ArgError("state out of range");
|
||||
return make_gdkgc(get_gstyle(self)->text_gc[i]);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_base_gc(self, idx)
|
||||
VALUE self, idx;
|
||||
{
|
||||
int i = NUM2INT(idx);
|
||||
|
||||
if (i < 0 || 5 < i) ArgError("state out of range");
|
||||
return make_gdkgc(get_gstyle(self)->base_gc[i]);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_black_gc(self)
|
||||
{
|
||||
return make_gdkgc(get_gstyle(self)->black_gc);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_white_gc(self)
|
||||
{
|
||||
return make_gdkgc(get_gstyle(self)->white_gc);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_bg_pixmap(self, idx)
|
||||
VALUE self, idx;
|
||||
{
|
||||
int i = NUM2INT(idx);
|
||||
|
||||
if (i < 0 || 5 < i) ArgError("state out of range");
|
||||
return make_gdkpixmap(get_gstyle(self)->bg_pixmap[i]);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static VALUE
|
||||
style_draw_hline(self, win, state_type, x1, x2, y)
|
||||
VALUE self, win, type, x1, x2, y;
|
||||
{
|
||||
gtk_draw_hline(get_gstyle(self), get_gdkwindow(win),
|
||||
(GtkStateType)NUM2INT(state_type),
|
||||
NUM2INT(x1), NUM2INT(x2), NUM2INT(y));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_draw_vline(self, win, state_type, y1, y2, x)
|
||||
VALUE self,win,type,y1,y2,x;
|
||||
{
|
||||
gtk_draw_vline(get_gstyle(self), get_gdkwindow(win),
|
||||
(GtkStateType)NUM2INT(state_type),
|
||||
NUM2INT(y1), NUM2INT(y2), NUM2INT(x));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_draw_shadow(self,win,state_type,shadow_type,x,y,w,h)
|
||||
VALUE self,win,state_type,shadow_type,x,y,w,h;
|
||||
{
|
||||
gtk_draw_shadow(get_gstyle(self), get_gdkwindow(win),
|
||||
(GtkStateType)NUM2INT(state_type),
|
||||
(GtkShadowType)NUM2INT(shadow_type),
|
||||
NUM2INT(x), NUM2INT(y),
|
||||
NUM2INT(w), NUM2INT(h));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_draw_polygon(self,win,state_type,shadow_type,pnts,fill)
|
||||
VALUE self,win,state_type,shadow_type,pnts,fill;
|
||||
{
|
||||
GdkPoint *points;
|
||||
int i;
|
||||
|
||||
Check_Type(pnts, T_ARRAY);
|
||||
points = ALLOCA_N(GdkPoint,RARRAY(pnts)->len);
|
||||
for (i=0; i<RARRAY(pnts)->len; i++) {
|
||||
Check_Type(RARRAY(pnts)->ptr[i], T_ARRAY);
|
||||
if (RARRAY(RARRAY(pnts)->ptr[i])->len < 2) {
|
||||
ArgError("point %d should be array of size 2", i);
|
||||
}
|
||||
points[i].x = NUM2INT(RARRAY(RARRAY(pnts)->ptr[i])->ptr[0]);
|
||||
points[i].y = NUM2INT(RARRAY(RARRAY(pnts)->ptr[i])->ptr[1]);
|
||||
}
|
||||
|
||||
gtk_draw_polygon(get_gstyle(self), get_gdkwindow(win),
|
||||
(GtkStateType)NUM2INT(state_type),
|
||||
(GtkShadowType)NUM2INT(shadow_type),
|
||||
points, RARRAY(pnts)->len,
|
||||
RTEST(fill));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_draw_arrow(self,) /* 9 */
|
||||
{
|
||||
gtk_draw_polygon(get_gstyle(self), get_gdkwindow(win),
|
||||
(GtkStateType)NUM2INT(state_type),
|
||||
(GtkShadowType)NUM2INT(shadow_type),
|
||||
points, RARRAY(pnts)->len,
|
||||
RTEST(fill));
|
||||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_draw_diamond(self,) /* 7 */
|
||||
{
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_draw_oval(self,) /* 7 */
|
||||
{
|
||||
}
|
||||
|
||||
static VALUE
|
||||
style_draw_string(self,) /* 5 */
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
gtk_m_main(self)
|
||||
VALUE self;
|
||||
|
@ -5726,7 +6023,7 @@ Init_gtk()
|
|||
|
||||
mGtk = rb_define_module("Gtk");
|
||||
|
||||
gObject = rb_define_class_under(mGtk, "GtkObject", cObject);
|
||||
gObject = rb_define_class_under(mGtk, "Object", cObject);
|
||||
gWidget = rb_define_class_under(mGtk, "Widget", gObject);
|
||||
gContainer = rb_define_class_under(mGtk, "Container", gWidget);
|
||||
gBin = rb_define_class_under(mGtk, "Bin", gContainer);
|
||||
|
@ -6397,6 +6694,40 @@ Init_gtk()
|
|||
|
||||
/* AcceleratorTable */
|
||||
/* Style */
|
||||
rb_define_singleton_method(gStyle, "new", style_s_new, 0);
|
||||
rb_define_method(gStyle, "attach", style_attach, 1);
|
||||
rb_define_method(gStyle, "detach", style_detach, 0);
|
||||
rb_define_method(gStyle, "set_background", style_set_bg, 0);
|
||||
rb_define_method(gStyle, "fg", style_fg, 1);
|
||||
rb_define_method(gStyle, "bg", style_bg, 1);
|
||||
rb_define_method(gStyle, "light", style_light, 1);
|
||||
rb_define_method(gStyle, "dark", style_dark, 1);
|
||||
rb_define_method(gStyle, "mid", style_mid, 1);
|
||||
rb_define_method(gStyle, "text", style_text, 1);
|
||||
rb_define_method(gStyle, "base", style_base, 1);
|
||||
rb_define_method(gStyle, "black", style_black, 0);
|
||||
rb_define_method(gStyle, "white", style_white, 0);
|
||||
rb_define_method(gStyle, "font", style_font, 0);
|
||||
rb_define_method(gStyle, "fg_gc", style_fg_gc, 1);
|
||||
rb_define_method(gStyle, "bg_gc", style_bg_gc, 1);
|
||||
rb_define_method(gStyle, "light_gc", style_light_gc, 1);
|
||||
rb_define_method(gStyle, "dark_gc", style_dark_gc, 1);
|
||||
rb_define_method(gStyle, "mid_gc", style_mid_gc, 1);
|
||||
rb_define_method(gStyle, "text_gc", style_text_gc, 1);
|
||||
rb_define_method(gStyle, "base_gc", style_base_gc, 1);
|
||||
rb_define_method(gStyle, "black_gc", style_black_gc, 0);
|
||||
rb_define_method(gStyle, "white_gc", style_white_gc, 0);
|
||||
rb_define_method(gStyle, "bg_pixmap", style_bg_pixmap, 1);
|
||||
#if 0
|
||||
rb_define_method(gStyle, "draw_hline", style_draw_hline, 5);
|
||||
rb_define_method(gStyle, "draw_vline", style_draw_vline, 5);
|
||||
rb_define_method(gStyle, "draw_shadow", style_draw_shadow, 7);
|
||||
rb_define_method(gStyle, "draw_polygon", style_draw_polygon, 6);
|
||||
rb_define_method(gStyle, "draw_arrow", style_draw_arrow, 9);
|
||||
rb_define_method(gStyle, "draw_diamond", style_draw_diamond, 7);
|
||||
rb_define_method(gStyle, "draw_oval", style_draw_oval, 7);
|
||||
rb_define_method(gStyle, "draw_string", style_draw_string, 5);
|
||||
#endif
|
||||
|
||||
/* Gtk module */
|
||||
rb_define_module_function(mGtk, "main", gtk_m_main, 0);
|
||||
|
|
36
object.c
36
object.c
|
@ -230,18 +230,6 @@ obj_is_kind_of(obj, c)
|
|||
case T_CLASS:
|
||||
break;
|
||||
|
||||
case T_NIL:
|
||||
if (NIL_P(obj)) return TRUE;
|
||||
return FALSE;
|
||||
|
||||
case T_FALSE:
|
||||
if (obj) return FALSE;
|
||||
return TRUE;
|
||||
|
||||
case T_TRUE:
|
||||
if (obj) return TRUE;
|
||||
return FALSE;
|
||||
|
||||
default:
|
||||
TypeError("class or module required");
|
||||
}
|
||||
|
@ -261,6 +249,13 @@ obj_dummy(obj)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
nil_to_i(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
return INT2FIX(0);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
nil_to_s(obj)
|
||||
VALUE obj;
|
||||
|
@ -321,6 +316,13 @@ true_to_s(obj)
|
|||
return str_new2("true");
|
||||
}
|
||||
|
||||
static VALUE
|
||||
true_to_i(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
return INT2FIX(1);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
true_type(obj)
|
||||
VALUE obj;
|
||||
|
@ -335,6 +337,13 @@ false_to_s(obj)
|
|||
return str_new2("false");
|
||||
}
|
||||
|
||||
static VALUE
|
||||
false_to_i(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
return INT2FIX(0);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
false_type(obj)
|
||||
VALUE obj;
|
||||
|
@ -874,6 +883,7 @@ Init_Object()
|
|||
|
||||
cNilClass = rb_define_class("NilClass", cObject);
|
||||
rb_define_method(cNilClass, "type", nil_type, 0);
|
||||
rb_define_method(cNilClass, "to_i", nil_to_i, 0);
|
||||
rb_define_method(cNilClass, "to_s", nil_to_s, 0);
|
||||
rb_define_method(cNilClass, "to_a", nil_to_a, 0);
|
||||
rb_define_method(cNilClass, "inspect", nil_inspect, 0);
|
||||
|
@ -931,12 +941,14 @@ Init_Object()
|
|||
|
||||
cTrueClass = rb_define_class("TrueClass", cObject);
|
||||
rb_define_method(cTrueClass, "to_s", true_to_s, 0);
|
||||
rb_define_method(cTrueClass, "to_i", true_to_i, 0);
|
||||
rb_define_method(cTrueClass, "type", true_type, 0);
|
||||
rb_undef_method(CLASS_OF(cTrueClass), "new");
|
||||
rb_define_global_const("TRUE", TRUE);
|
||||
|
||||
cFalseClass = rb_define_class("FalseClass", cObject);
|
||||
rb_define_method(cFalseClass, "to_s", false_to_s, 0);
|
||||
rb_define_method(cFalseClass, "to_i", false_to_i, 0);
|
||||
rb_define_method(cFalseClass, "type", false_type, 0);
|
||||
rb_undef_method(CLASS_OF(cFalseClass), "new");
|
||||
rb_define_global_const("FALSE", FALSE);
|
||||
|
|
3
ruby.h
3
ruby.h
|
@ -275,10 +275,11 @@ struct RBignum {
|
|||
USHORT *digits;
|
||||
};
|
||||
|
||||
#define R_CAST(st) (struct st*)
|
||||
#define R_CAST(st) (struct st*)
|
||||
#define RBASIC(obj) (R_CAST(RBasic)(obj))
|
||||
#define ROBJECT(obj) (R_CAST(RObject)(obj))
|
||||
#define RCLASS(obj) (R_CAST(RClass)(obj))
|
||||
#define RMODULE(obj) RCLASS(obj)
|
||||
#define RFLOAT(obj) (R_CAST(RFloat)(obj))
|
||||
#define RSTRING(obj) (R_CAST(RString)(obj))
|
||||
#define RREGEXP(obj) (R_CAST(RRegexp)(obj))
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
(defconst ruby-block-end-re "end")
|
||||
|
||||
(defconst ruby-delimiter
|
||||
(concat "[?$/%(){}#\"'`]\\|\\[\\|\\]\\|\\<\\("
|
||||
(concat "[?$/%(){}#\"'`.:]\\|\\[\\|\\]\\|\\<\\("
|
||||
ruby-block-beg-re
|
||||
"\\|" ruby-block-end-re
|
||||
"\\)\\>\\|^=begin")
|
||||
|
@ -85,7 +85,7 @@
|
|||
(modify-syntax-entry ?# "<" ruby-mode-syntax-table)
|
||||
(modify-syntax-entry ?\n ">" ruby-mode-syntax-table)
|
||||
(modify-syntax-entry ?\\ "\\" ruby-mode-syntax-table)
|
||||
(modify-syntax-entry ?$ "/" ruby-mode-syntax-table)
|
||||
(modify-syntax-entry ?$ "." ruby-mode-syntax-table)
|
||||
(modify-syntax-entry ?? "_" ruby-mode-syntax-table)
|
||||
(modify-syntax-entry ?_ "_" ruby-mode-syntax-table)
|
||||
(modify-syntax-entry ?< "." ruby-mode-syntax-table)
|
||||
|
@ -276,7 +276,7 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||
((looking-at "\\$") ;skip $char
|
||||
(goto-char pnt)
|
||||
(forward-char 1))
|
||||
((looking-at "#") ;skip comment
|
||||
((looking-at "#") ;skip comment
|
||||
(forward-line 1)
|
||||
(goto-char (point))
|
||||
)
|
||||
|
@ -315,29 +315,41 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||
(setq nest (cdr nest))
|
||||
(setq depth (1- depth)))
|
||||
(goto-char pnt))
|
||||
((looking-at "def\\s *[^\n;]*\\(\\|$\\)")
|
||||
(if (or (bolp)
|
||||
(progn
|
||||
(forward-char -1)
|
||||
(not (eq ?_ (char-after (point))))))
|
||||
(progn
|
||||
(setq nest (cons (cons nil pnt) nest))
|
||||
(setq depth (1+ depth))))
|
||||
(goto-char (match-end 0)))
|
||||
((looking-at ruby-block-beg-re)
|
||||
(and
|
||||
(or (bolp)
|
||||
(progn
|
||||
(forward-char -1)
|
||||
(not (eq ?_ (char-after (point))))))
|
||||
(progn
|
||||
(goto-char pnt)
|
||||
(setq w (char-after (point)))
|
||||
(and (not (eq ?_ w))
|
||||
(not (eq ?! w))
|
||||
(not (eq ?? w))))
|
||||
(goto-char pnt)
|
||||
(setq w (char-after (point)))
|
||||
(not (eq ?_ w))
|
||||
(not (eq ?! w))
|
||||
(not (eq ?? w))
|
||||
(progn
|
||||
(goto-char (match-beginning 0))
|
||||
(if (looking-at ruby-modifier-re)
|
||||
(ruby-expr-beg)
|
||||
t))
|
||||
(progn
|
||||
(setq nest (cons (cons nil pnt) nest))
|
||||
(setq depth (1+ depth))))
|
||||
(if (looking-at "def\\s *[/`]")
|
||||
(goto-char (match-end 0))
|
||||
(goto-char pnt)))
|
||||
(goto-char pnt)
|
||||
(setq nest (cons (cons nil pnt) nest))
|
||||
(setq depth (1+ depth)))
|
||||
(goto-char pnt))
|
||||
((looking-at ":\\([a-zA-Z_][a-zA-Z_0-9]*\\)?")
|
||||
(goto-char (match-end 0)))
|
||||
((or (looking-at "\\.\\.\\.?")
|
||||
(looking-at "\\.[0-9]+")
|
||||
(looking-at "\\.[a-zA-Z_0-9]+"))
|
||||
(goto-char (match-end 0)))
|
||||
((looking-at "^=begin")
|
||||
(if (re-search-forward "^=end" indent-point t)
|
||||
(forward-line 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue