Skip to content

Commit

Permalink
version 0.66
Browse files Browse the repository at this point in the history
https://cache.ruby-lang.org/pub/ruby/1.0/ruby-0.65-0.66.diff.gz

Thu Feb  9 16:18:37 1995  Yukihiro Matsumoto  (matz@ix-02)

	* version 0.66

	* parse.y: protectをbeginに変更.begin..endは例外処理だけでなく,
	  文括弧としても働くことになった.
  • Loading branch information
matz authored and k0kubun committed Aug 17, 2019
1 parent 897cf06 commit c080fb6
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 87 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
Thu Feb 9 16:18:37 1995 Yukihiro Matsumoto (matz@ix-02)

* parse.y: protect��begin���ѹ���begin..end���㳰���������Ǥʤ���
ʸ��̤Ȥ��Ƥ�Ư�����Ȥˤʤä���

Wed Feb 1 19:48:24 1995 Yukihiro Matsumoto (matz@ix-02)

* string.c(str_replace): �֤�������ʸ�����Ĺ���������������ꥳ
Expand Down
4 changes: 2 additions & 2 deletions eval.c
Expand Up @@ -788,7 +788,7 @@ rb_eval(node)
}
return result;

case NODE_PROT:
case NODE_BEGIN:
PUSH_TAG();
switch (state = EXEC_TAG()) {
case 0:
Expand Down Expand Up @@ -1933,7 +1933,7 @@ rb_call(class, recv, mid, argc, argv, func)
Fatal("unexpected redo");
break;
case TAG_RETRY:
Fatal("retry outside of protect clause");
Fatal("retry outside of resque clause");
break;
case TAG_RETURN:
result = last_val;
Expand Down
4 changes: 2 additions & 2 deletions node.h
Expand Up @@ -26,7 +26,7 @@ enum node_type {
NODE_WHILE2,
NODE_ITER,
NODE_FOR,
NODE_PROT,
NODE_BEGIN,
NODE_AND,
NODE_OR,
NODE_NOT,
Expand Down Expand Up @@ -187,7 +187,7 @@ typedef struct RNode {
#define NEW_WHILE2(c,b) newnode(NODE_WHILE2,c,b,Qnil)
#define NEW_FOR(v,i,b) newnode(NODE_FOR,v,b,i)
#define NEW_ITER(v,i,b) newnode(NODE_ITER,v,b,i)
#define NEW_PROT(b,ex,en) newnode(NODE_PROT,b,ex,en)
#define NEW_BEGIN(b,ex,en) newnode(NODE_BEGIN,b,ex,en)
#define NEW_REDO() newnode(NODE_REDO,Qnil,Qnil,Qnil)
#define NEW_BREAK() newnode(NODE_BREAK,Qnil,Qnil,Qnil)
#define NEW_CONT() newnode(NODE_CONTINUE,Qnil,Qnil,Qnil)
Expand Down
15 changes: 7 additions & 8 deletions parse.y
Expand Up @@ -90,6 +90,10 @@ static void setup_top_local();
DEF
UNDEF
INCLUDE
BEGIN
RESQUE
ENSURE
END
IF
THEN
ELSIF
Expand All @@ -99,10 +103,6 @@ static void setup_top_local();
WHILE
FOR
IN
PROTECT
RESQUE
ENSURE
END
REDO
BREAK
CONTINUE
Expand Down Expand Up @@ -762,18 +762,17 @@ primary : literal
value_expr($4);
$$ = NEW_FOR($2, $4, $6);
}
| PROTECT
| BEGIN
compexpr
resque
ensure
END
{
if ($3 == Qnil && $4 == Qnil) {
Warning("useless protect clause");
$$ = $2;
}
else {
$$ = NEW_PROT($2, $3, $4);
$$ = NEW_BEGIN($2, $3, $4);
}
}
| LPAREN compexpr rparen
Expand Down Expand Up @@ -1312,6 +1311,7 @@ static struct kwtable {
"__LINE__", _LINE_, EXPR_END,
"alias", ALIAS, EXPR_FNAME,
"and", AND, EXPR_BEG,
"begin", BEGIN, EXPR_BEG,
"break", BREAK, EXPR_END,
"case", CASE, EXPR_BEG,
"class", CLASS, EXPR_BEG,
Expand All @@ -1329,7 +1329,6 @@ static struct kwtable {
"module", MODULE, EXPR_BEG,
"nil", NIL, EXPR_END,
"or", OR, EXPR_BEG,
"protect", PROTECT, EXPR_BEG,
"redo", REDO, EXPR_END,
"resque", RESQUE, EXPR_BEG,
"retry", RETRY, EXPR_END,
Expand Down
2 changes: 1 addition & 1 deletion sample/occur2.rb
Expand Up @@ -3,7 +3,7 @@
freq = {}
while gets()
for word in $_.split(/\W+/)
protect
begin
freq[word] = freq[word] + 1
resque
freq[word] = 1
Expand Down
2 changes: 1 addition & 1 deletion sample/ruby-mode.el
Expand Up @@ -8,7 +8,7 @@
;;;

(defconst ruby-block-beg-re
"class\\|module\\|def\\|if\\|unless\\|case\\|while\\|until\\|for\\|protect"
"class\\|module\\|def\\|if\\|unless\\|case\\|while\\|until\\|for\\|begin"
)

(defconst ruby-block-mid-re
Expand Down
2 changes: 1 addition & 1 deletion sample/sieve.rb
Expand Up @@ -5,7 +5,7 @@

print "1"
for i in 2 .. max
protect
begin
for d in sieve
fail if i % d == 0
end
Expand Down

0 comments on commit c080fb6

Please sign in to comment.