* parse.y (arg): parse 'lhs = a rescue b' as 'lhs=(a rescue b)'.
* io.c (rb_io_fread): should not clearerr() if there's no filled buffer (i.e. rb_io_fread() returning zero). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0cd0eab641
commit
6a6d0ad220
@ -1,3 +1,12 @@
|
|||||||
|
Mon Mar 3 11:29:04 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* parse.y (arg): parse 'lhs = a rescue b' as 'lhs=(a rescue b)'.
|
||||||
|
|
||||||
|
Mon Mar 3 02:53:52 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* io.c (rb_io_fread): should not clearerr() if there's no filled
|
||||||
|
buffer (i.e. rb_io_fread() returning zero).
|
||||||
|
|
||||||
Mon Mar 03 01:42:35 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
Mon Mar 03 01:42:35 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||||
|
|
||||||
* misc/ruby-mode.el (ruby-expr-beg): escaped char syntax.
|
* misc/ruby-mode.el (ruby-expr-beg): escaped char syntax.
|
||||||
|
2
io.c
2
io.c
@ -710,9 +710,11 @@ rb_io_fread(ptr, len, f)
|
|||||||
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
|
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
|
||||||
case EWOULDBLOCK:
|
case EWOULDBLOCK:
|
||||||
#endif
|
#endif
|
||||||
|
if (len - n > 0) {
|
||||||
clearerr(f);
|
clearerr(f);
|
||||||
return len - n;
|
return len - n;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
|
@ -365,7 +365,7 @@ class Date
|
|||||||
when Numeric; return @ajd <=> other
|
when Numeric; return @ajd <=> other
|
||||||
when Date; return @ajd <=> other.ajd
|
when Date; return @ajd <=> other.ajd
|
||||||
end
|
end
|
||||||
raise TypeError, 'expected numeric or date'
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def === (other)
|
def === (other)
|
||||||
@ -373,7 +373,7 @@ class Date
|
|||||||
when Numeric; return jd == other
|
when Numeric; return jd == other
|
||||||
when Date; return jd == other.jd
|
when Date; return jd == other.jd
|
||||||
end
|
end
|
||||||
raise TypeError, 'expected numeric or date'
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def >> (n)
|
def >> (n)
|
||||||
|
18
lib/debug.rb
18
lib/debug.rb
@ -158,10 +158,9 @@ class Context
|
|||||||
def debug_eval(str, binding)
|
def debug_eval(str, binding)
|
||||||
begin
|
begin
|
||||||
val = eval(str, binding)
|
val = eval(str, binding)
|
||||||
val
|
rescue StandardError, ScriptError => e
|
||||||
rescue StandardError, ScriptError
|
at = eval("caller(1)", binding)
|
||||||
at = eval("caller(0)", binding)
|
stdout.printf "%s:%s\n", at.shift, e.to_s.sub(/\(eval\):1:(in `.*?':)?/, '')
|
||||||
stdout.printf "%s:%s\n", at.shift, $!.to_s.sub(/\(eval\):1:(in `.*?':)?/, '') #`
|
|
||||||
for i in at
|
for i in at
|
||||||
stdout.printf "\tfrom %s\n", i
|
stdout.printf "\tfrom %s\n", i
|
||||||
end
|
end
|
||||||
@ -297,6 +296,12 @@ class Context
|
|||||||
stdout.print "Trace off.\n"
|
stdout.print "Trace off.\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
when /^\s*b(?:reak)?\s+(.+)[#.](.+)$/
|
||||||
|
pos = $2.intern.id2name
|
||||||
|
file = debug_eval($1, binding)
|
||||||
|
break_points.push [true, 0, file, pos]
|
||||||
|
stdout.printf "Set breakpoint %d at %s.%s\n", break_points.size, file, pos
|
||||||
|
|
||||||
when /^\s*b(?:reak)?\s+(?:(.+):)?(.+)$/
|
when /^\s*b(?:reak)?\s+(?:(.+):)?(.+)$/
|
||||||
pos = $2
|
pos = $2
|
||||||
file = File.basename($1 || file)
|
file = File.basename($1 || file)
|
||||||
@ -646,7 +651,7 @@ EOHELP
|
|||||||
|
|
||||||
def check_break_points(file, pos, binding, id)
|
def check_break_points(file, pos, binding, id)
|
||||||
return false if break_points.empty?
|
return false if break_points.empty?
|
||||||
file = File.basename(file)
|
# file = File.basename(file)
|
||||||
n = 1
|
n = 1
|
||||||
for b in break_points
|
for b in break_points
|
||||||
if b[0]
|
if b[0]
|
||||||
@ -709,7 +714,8 @@ EOHELP
|
|||||||
when 'call'
|
when 'call'
|
||||||
@frames.unshift [binding, file, line, id]
|
@frames.unshift [binding, file, line, id]
|
||||||
if check_break_points(file, id.id2name, binding, id) or
|
if check_break_points(file, id.id2name, binding, id) or
|
||||||
check_break_points(klass.to_s, id.id2name, binding, id)
|
check_break_points(klass.to_s, id.id2name, binding, id) or
|
||||||
|
check_break_points(klass, id.id2name, binding, id)
|
||||||
suspend_all
|
suspend_all
|
||||||
debug_command(file, line, id, binding)
|
debug_command(file, line, id, binding)
|
||||||
end
|
end
|
||||||
|
62
parse.y
62
parse.y
@ -240,7 +240,7 @@ static void top_local_setup();
|
|||||||
%type <node> singleton strings string string1 xstring regexp
|
%type <node> singleton strings string string1 xstring regexp
|
||||||
%type <node> string_contents xstring_contents string_content
|
%type <node> string_contents xstring_contents string_content
|
||||||
%type <node> words qwords word_list qword_list word
|
%type <node> words qwords word_list qword_list word
|
||||||
%type <node> literal numeric dsym cpath clhs
|
%type <node> literal numeric dsym cpath
|
||||||
%type <node> bodystmt compstmt stmts stmt expr arg primary command command_call method_call
|
%type <node> bodystmt compstmt stmts stmt expr arg primary command command_call method_call
|
||||||
%type <node> expr_value arg_value primary_value
|
%type <node> expr_value arg_value primary_value
|
||||||
%type <node> if_tail opt_else case_body cases opt_rescue exc_list exc_var opt_ensure
|
%type <node> if_tail opt_else case_body cases opt_rescue exc_list exc_var opt_ensure
|
||||||
@ -290,7 +290,7 @@ static void top_local_setup();
|
|||||||
%nonassoc tLOWEST
|
%nonassoc tLOWEST
|
||||||
%nonassoc tLBRACE_ARG
|
%nonassoc tLBRACE_ARG
|
||||||
|
|
||||||
%left kIF_MOD kUNLESS_MOD kWHILE_MOD kUNTIL_MOD
|
%nonassoc kIF_MOD kUNLESS_MOD kWHILE_MOD kUNTIL_MOD
|
||||||
%left kOR kAND
|
%left kOR kAND
|
||||||
%right kNOT
|
%right kNOT
|
||||||
%nonassoc kDEFINED
|
%nonassoc kDEFINED
|
||||||
@ -451,6 +451,10 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
|||||||
nd_set_type($$, NODE_WHILE);
|
nd_set_type($$, NODE_WHILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
| stmt kRESCUE_MOD stmt
|
||||||
|
{
|
||||||
|
$$ = NEW_RESCUE($1, NEW_RESBODY(0,$3,0), 0);
|
||||||
|
}
|
||||||
| klBEGIN
|
| klBEGIN
|
||||||
{
|
{
|
||||||
if (in_def || in_single) {
|
if (in_def || in_single) {
|
||||||
@ -475,6 +479,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
|||||||
}
|
}
|
||||||
| lhs '=' command_call
|
| lhs '=' command_call
|
||||||
{
|
{
|
||||||
|
value_expr($3);
|
||||||
$$ = node_assign($1, $3);
|
$$ = node_assign($1, $3);
|
||||||
}
|
}
|
||||||
| mlhs '=' command_call
|
| mlhs '=' command_call
|
||||||
@ -483,10 +488,6 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
|||||||
$1->nd_value = NEW_RESTARY($3);
|
$1->nd_value = NEW_RESTARY($3);
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
}
|
}
|
||||||
| clhs '=' command_call
|
|
||||||
{
|
|
||||||
$$ = node_assign($1, $3);
|
|
||||||
}
|
|
||||||
| var_lhs tOP_ASGN command_call
|
| var_lhs tOP_ASGN command_call
|
||||||
{
|
{
|
||||||
value_expr($3);
|
value_expr($3);
|
||||||
@ -574,10 +575,6 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
|||||||
{
|
{
|
||||||
$$ = node_assign($1, NEW_SVALUE($3));
|
$$ = node_assign($1, NEW_SVALUE($3));
|
||||||
}
|
}
|
||||||
| clhs '=' mrhs
|
|
||||||
{
|
|
||||||
$$ = node_assign($1, NEW_SVALUE($3));
|
|
||||||
}
|
|
||||||
| mlhs '=' arg_value
|
| mlhs '=' arg_value
|
||||||
{
|
{
|
||||||
$1->nd_value = $3;
|
$1->nd_value = $3;
|
||||||
@ -588,10 +585,6 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
|||||||
$1->nd_value = $3;
|
$1->nd_value = $3;
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
}
|
}
|
||||||
| clhs '=' arg
|
|
||||||
{
|
|
||||||
$$ = node_assign($1, $3);
|
|
||||||
}
|
|
||||||
| expr
|
| expr
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -612,10 +605,6 @@ expr : command_call
|
|||||||
{
|
{
|
||||||
$$ = NEW_NOT(cond($2));
|
$$ = NEW_NOT(cond($2));
|
||||||
}
|
}
|
||||||
| arg kRESCUE_MOD command_call
|
|
||||||
{
|
|
||||||
$$ = NEW_RESCUE($1, NEW_RESBODY(0,$3,0), 0);
|
|
||||||
}
|
|
||||||
| arg
|
| arg
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -808,6 +797,12 @@ mlhs_node : variable
|
|||||||
{
|
{
|
||||||
$$ = attrset($1, $3);
|
$$ = attrset($1, $3);
|
||||||
}
|
}
|
||||||
|
| primary_value tCOLON2 tCONSTANT
|
||||||
|
{
|
||||||
|
if (in_def || in_single)
|
||||||
|
yyerror("dynamic constant assignment");
|
||||||
|
$$ = NEW_CDECL(0, 0, NEW_COLON2($1, $3));
|
||||||
|
}
|
||||||
| backref
|
| backref
|
||||||
{
|
{
|
||||||
rb_backref_error($1);
|
rb_backref_error($1);
|
||||||
@ -835,19 +830,17 @@ lhs : variable
|
|||||||
{
|
{
|
||||||
$$ = attrset($1, $3);
|
$$ = attrset($1, $3);
|
||||||
}
|
}
|
||||||
| backref
|
| primary_value tCOLON2 tCONSTANT
|
||||||
{
|
|
||||||
rb_backref_error($1);
|
|
||||||
$$ = 0;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
clhs : primary_value tCOLON2 tCONSTANT
|
|
||||||
{
|
{
|
||||||
if (in_def || in_single)
|
if (in_def || in_single)
|
||||||
yyerror("dynamic constant assignment");
|
yyerror("dynamic constant assignment");
|
||||||
$$ = NEW_CDECL(0, 0, NEW_COLON2($1, $3));
|
$$ = NEW_CDECL(0, 0, NEW_COLON2($1, $3));
|
||||||
}
|
}
|
||||||
|
| backref
|
||||||
|
{
|
||||||
|
rb_backref_error($1);
|
||||||
|
$$ = 0;
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
cname : tIDENTIFIER
|
cname : tIDENTIFIER
|
||||||
@ -933,14 +926,17 @@ reswords : k__LINE__ | k__FILE__ | klBEGIN | klEND
|
|||||||
| kDEFINED | kDO | kELSE | kELSIF | kEND | kENSURE | kFALSE
|
| kDEFINED | kDO | kELSE | kELSIF | kEND | kENSURE | kFALSE
|
||||||
| kFOR | kIF_MOD | kIN | kMODULE | kNEXT | kNIL | kNOT
|
| kFOR | kIF_MOD | kIN | kMODULE | kNEXT | kNIL | kNOT
|
||||||
| kOR | kREDO | kRESCUE | kRETRY | kRETURN | kSELF | kSUPER
|
| kOR | kREDO | kRESCUE | kRETRY | kRETURN | kSELF | kSUPER
|
||||||
| kTHEN | kTRUE | kUNDEF | kUNLESS_MOD | kUNTIL_MOD | kWHEN
|
| kTHEN | kTRUE | kUNDEF | kWHEN | kYIELD
|
||||||
| kWHILE_MOD | kYIELD | kRESCUE_MOD
|
|
||||||
;
|
;
|
||||||
|
|
||||||
arg : lhs '=' arg
|
arg : lhs '=' arg
|
||||||
{
|
{
|
||||||
$$ = node_assign($1, $3);
|
$$ = node_assign($1, $3);
|
||||||
}
|
}
|
||||||
|
| lhs '=' arg kRESCUE_MOD arg
|
||||||
|
{
|
||||||
|
$$ = node_assign($1, NEW_RESCUE($3, NEW_RESBODY(0,$5,0), 0));
|
||||||
|
}
|
||||||
| var_lhs tOP_ASGN arg
|
| var_lhs tOP_ASGN arg
|
||||||
{
|
{
|
||||||
value_expr($3);
|
value_expr($3);
|
||||||
@ -1019,6 +1015,10 @@ arg : lhs '=' arg
|
|||||||
$$ = NEW_OP_ASGN2($1, $3, $4, $5);
|
$$ = NEW_OP_ASGN2($1, $3, $4, $5);
|
||||||
fixpos($$, $1);
|
fixpos($$, $1);
|
||||||
}
|
}
|
||||||
|
| primary_value tCOLON2 tCONSTANT tOP_ASGN arg
|
||||||
|
{
|
||||||
|
yyerror("constant re-assignment");
|
||||||
|
}
|
||||||
| backref tOP_ASGN arg
|
| backref tOP_ASGN arg
|
||||||
{
|
{
|
||||||
rb_backref_error($1);
|
rb_backref_error($1);
|
||||||
@ -1157,10 +1157,6 @@ arg : lhs '=' arg
|
|||||||
{
|
{
|
||||||
$$ = logop(NODE_OR, $1, $3);
|
$$ = logop(NODE_OR, $1, $3);
|
||||||
}
|
}
|
||||||
| arg kRESCUE_MOD arg
|
|
||||||
{
|
|
||||||
$$ = NEW_RESCUE($1, NEW_RESBODY(0,$3,0), 0);
|
|
||||||
}
|
|
||||||
| kDEFINED opt_nl {in_defined = 1;} arg
|
| kDEFINED opt_nl {in_defined = 1;} arg
|
||||||
{
|
{
|
||||||
in_defined = 0;
|
in_defined = 0;
|
||||||
@ -1674,11 +1670,13 @@ primary_value : primary
|
|||||||
;
|
;
|
||||||
|
|
||||||
then : term
|
then : term
|
||||||
|
| ':'
|
||||||
| kTHEN
|
| kTHEN
|
||||||
| term kTHEN
|
| term kTHEN
|
||||||
;
|
;
|
||||||
|
|
||||||
do : term
|
do : term
|
||||||
|
| ':'
|
||||||
| kDO_COND
|
| kDO_COND
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#! /usr/bin/env ruby
|
#! /usr/bin/env ruby
|
||||||
|
|
||||||
|
$KCODE = "none"
|
||||||
$testnum=0
|
$testnum=0
|
||||||
$ntest=0
|
$ntest=0
|
||||||
$failed = 0
|
$failed = 0
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#define RUBY_VERSION "1.8.0"
|
#define RUBY_VERSION "1.8.0"
|
||||||
#define RUBY_RELEASE_DATE "2003-02-28"
|
#define RUBY_RELEASE_DATE "2003-03-03"
|
||||||
#define RUBY_VERSION_CODE 180
|
#define RUBY_VERSION_CODE 180
|
||||||
#define RUBY_RELEASE_CODE 20030228
|
#define RUBY_RELEASE_CODE 20030303
|
||||||
|
|
||||||
#define RUBY_VERSION_MAJOR 1
|
#define RUBY_VERSION_MAJOR 1
|
||||||
#define RUBY_VERSION_MINOR 8
|
#define RUBY_VERSION_MINOR 8
|
||||||
#define RUBY_VERSION_TEENY 0
|
#define RUBY_VERSION_TEENY 0
|
||||||
#define RUBY_RELEASE_YEAR 2003
|
#define RUBY_RELEASE_YEAR 2003
|
||||||
#define RUBY_RELEASE_MONTH 02
|
#define RUBY_RELEASE_MONTH 03
|
||||||
#define RUBY_RELEASE_DAY 28
|
#define RUBY_RELEASE_DAY 03
|
||||||
|
Loading…
x
Reference in New Issue
Block a user