summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYukihiro Matsumoto <matz@ruby-lang.org>1995-02-09 07:18:37 (GMT)
committerTakashi Kokubun <takashikkbn@gmail.com>2019-08-17 13:09:31 (GMT)
commitc080fb6d10bbcb697b6ba16e640de8db3f1973d0 (patch)
tree2df6299a382a47f1bed94ea2c8dedc64113d79c9
parent897cf066952978ccbae1d57bbc14a03c7b98a1e1 (diff)
version 0.66v0_66
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は例外処理だけでなく, 文括弧としても働くことになった.
-rw-r--r--ChangeLog5
-rw-r--r--eval.c4
-rw-r--r--node.h4
-rw-r--r--parse.y15
-rw-r--r--sample/occur2.rb2
-rw-r--r--sample/ruby-mode.el2
-rw-r--r--sample/sieve.rb2
-rw-r--r--spec140
-rw-r--r--version.h4
9 files changed, 91 insertions, 87 deletions
diff --git a/ChangeLog b/ChangeLog
index 35d02ea..838091a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Feb 9 16:18:37 1995 Yukihiro Matsumoto (matz@ix-02)
+
+ * parse.y: protectbeginѹbegin..end㳰Ǥʤ
+ ʸ̤ȤƤƯȤˤʤä
+
Wed Feb 1 19:48:24 1995 Yukihiro Matsumoto (matz@ix-02)
* string.c(str_replace): ֤ʸĹꥳ
diff --git a/eval.c b/eval.c
index 1e00de9..fa61e47 100644
--- a/eval.c
+++ b/eval.c
@@ -788,7 +788,7 @@ rb_eval(node)
}
return result;
- case NODE_PROT:
+ case NODE_BEGIN:
PUSH_TAG();
switch (state = EXEC_TAG()) {
case 0:
@@ -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;
diff --git a/node.h b/node.h
index 8137995..f98be64 100644
--- a/node.h
+++ b/node.h
@@ -26,7 +26,7 @@ enum node_type {
NODE_WHILE2,
NODE_ITER,
NODE_FOR,
- NODE_PROT,
+ NODE_BEGIN,
NODE_AND,
NODE_OR,
NODE_NOT,
@@ -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)
diff --git a/parse.y b/parse.y
index 7c84221..7dabc5d 100644
--- a/parse.y
+++ b/parse.y
@@ -90,6 +90,10 @@ static void setup_top_local();
DEF
UNDEF
INCLUDE
+ BEGIN
+ RESQUE
+ ENSURE
+ END
IF
THEN
ELSIF
@@ -99,10 +103,6 @@ static void setup_top_local();
WHILE
FOR
IN
- PROTECT
- RESQUE
- ENSURE
- END
REDO
BREAK
CONTINUE
@@ -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
@@ -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,
@@ -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,
diff --git a/sample/occur2.rb b/sample/occur2.rb
index 899294e..8cd5acb 100644
--- a/sample/occur2.rb
+++ b/sample/occur2.rb
@@ -3,7 +3,7 @@
freq = {}
while gets()
for word in $_.split(/\W+/)
- protect
+ begin
freq[word] = freq[word] + 1
resque
freq[word] = 1
diff --git a/sample/ruby-mode.el b/sample/ruby-mode.el
index 7f97e71..4396b10 100644
--- a/sample/ruby-mode.el
+++ b/sample/ruby-mode.el
@@ -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
diff --git a/sample/sieve.rb b/sample/sieve.rb
index eaf4e33..640cc32 100644
--- a/sample/sieve.rb
+++ b/sample/sieve.rb
@@ -5,7 +5,7 @@ max = max.to_i
print "1"
for i in 2 .. max
- protect
+ begin
for d in sieve
fail if i % d == 0
end
diff --git a/spec b/spec
index b7c374d..fb5d046 100644
--- a/spec
+++ b/spec
@@ -67,13 +67,13 @@ tab) CR(carriage return)(form feed)Ǥ롥(newline)
ͽϰʲ̤Ǥ
- alias else in resque when
- and elsif include retry while
- break end module return yield
- case ensure nil self __END__
- class fail or super __FILE__
- continue for protect then __LINE__
- def if redo undef
+ alias def if resque when
+ and else in retry while
+ begin elsif include return yield
+ break end module self __END__
+ case ensure nil super __FILE__
+ class fail or then __LINE__
+ continue for redo undef
ͽϥ饹̾᥽å̾ѿ̾ʤɤѤ뤳ȤϤǤʤ
@@ -303,7 +303,7 @@ Rubyѿϥ(ͭϰ)ȼ̿(ͭ)ˤä4ʬव졤
̤ˤñʤ뼰ǤϤʤ¤(ץ)֤Ȥ
- `(' `;' ... `)'
+ `(' `;' .. `)'
¤ӤͤϺǸɾͤǤ롥ĤޤͤϺǸɾ
ͤˤʤ롥
@@ -317,7 +317,7 @@ Rubyѿϥ(ͭϰ)ȼ̿(ͭ)ˤä4ʬव졤
Array饹Υ󥹥󥹤Ǥ롥뼰ϰʲη
- `[' , ... `]'
+ `[' , .. `]'
줾μɾ̤ޤ֤ǿ0ζ
뤿ˤ϶
@@ -336,7 +336,7 @@ Rubyѿϥ(ͭϰ)ȼ̿(ͭ)ˤä4ʬव졤
ϢDict()饹Υ󥹥󥹤Ǥ롥ܺ٤ϥ饹Dictι
򻲾Ȥ줿ϢϢ󼰤ϰʲηǤ롥
- `{' `=>' ... `}'
+ `{' `=>' .. `}'
줾μɾ̤򥭡ͤȤϢ󥪥֥Ȥ֤
ǿ0Ϣ뤿ˤ϶Ϣ
@@ -356,7 +356,7 @@ Rubyѿϥ(ͭϰ)ȼ̿(ͭ)ˤä4ʬव졤
֥Ȥ˥åŪʹʸåǤꡤδ
ܷϰʲ̤Ǥ롥
- 1 `.' ᥽å̾ `(' 1... [`,' `*' n ]`)'
+ 1 `.' ᥽å̾ `(' 1.. [`,' `*' n ]`)'
1ɾ륪֥ȤΡ̻Ҥǻꤵ᥽åɤƤ
ФֺǸΰ`*'³(ñ)Ǥ硤μɾ
@@ -403,7 +403,7 @@ Rubyѿϥ(ͭϰ)ȼ̿(ͭ)ˤä4ʬव졤
ФȤͿ줿ѿͤѹƤ⡤ϤΤϸΰ
ͤǤ롥
- super`(' ... `)'
+ super`(' .. `)'
ȤȤ˥ѡ饹Ʊ̾Υ᥽åɤƤӽФֺǸΰ
`*'³̾Υ᥽åɸƤӽФƱͤŸϤ롥
@@ -430,7 +430,7 @@ moduleѤ롥ϱ黻ҷȤäƤ뤬᥽åɤǤϤʤ
Ǥؤ
- 1`[' 2... `]' `=' n
+ 1`[' 2.. `]' `=' n
1ɾ륪֥Ȥˡ2鼰nޤǤȤơ"[]="
Ȥ᥽åɤƤӽФ
@@ -470,7 +470,7 @@ moduleѤ롥ϱ黻ҷȤäƤ뤬᥽åɤǤϤʤ
ƱʣѿԤʤȤǤ롥ηϰʲ̤Ǥ롥
- `,' [ `,' ...] [`*' ]= [, ...]
+ `,' [ `,'..] [`*' ]= [, ..]
դμĤʤϡͤȤ(ɬפʤto_a᥽
ɤѴ)Ǥ򤽤줾캸դ롥ʳξˤϡ
@@ -510,9 +510,9 @@ moduleѤ롥ϱ黻ҷȤäƤ뤬᥽åɤǤϤʤ
<=> == != =~ !~
&&
||
- .. ..
+ .. ...
::
- =() (+=, -=, ..)
+ =() (+=, -=,..)
and
or
if while
@@ -534,13 +534,13 @@ moduleѤ롥ϱ黻ҷȤäƤ뤬᥽åɤǤϤʤ
1. 黻 ()
-(Ϣޤ)Ǥλ(1 `[' 2... `]')
+(Ϣޤ)Ǥλ(1 `[' 2.. `]')
- 1. `[]' (2...)
+ 1. `[]' (2..)
-Ǥ( 1 `[' 2... `]' `=' n)
+Ǥ( 1 `[' 2.. `]' `=' n)
- 1. `[]=' (2...)
+ 1. `[]=' (2..)
ʳ2黻( 黻 )
@@ -552,11 +552,11 @@ moduleѤ롥ϱ黻ҷȤäƤ뤬᥽åɤǤϤʤ
** IF
if 1 [then]
- 1
+ ..
[elsif 2 [then]
- 2 ]...
+ .. ]..
[else
- n ]
+ .. ]
end
ȽǼ1ξ˼1ɾ롥ʳξϼ2ɾ
@@ -577,10 +577,10 @@ ifξȽμǤʸɽƥϼ$_=~ ƥפ
** CASE
case 0
- [when 1 [, 2]... [then]
- 1 ]..
+ [when 1 [, 2].. [then]
+ .. ]..
[else
- n ]
+ .. ]
end
ʬCswitchPascalcase˻Ƥ롥breakæФ뤳Ȥ
@@ -662,7 +662,7 @@ orξդμǤʸɽƥϼ$_=~ ƥפξά
** WHILE
while
-
+ ..
end
ɾͤδ֡򷫤֤¹Ԥ롥whileͤnilǤ롥
@@ -690,7 +690,7 @@ whileξȽμǤʸɽƥϼ$_=~ ƥ
ƥ졼Ȥ湽¤(ä˥롼)ݲΤѤ᥽åɤ
Ǥ롥ƥ졼θƤӽФϰʲιʸǹԤʤ롥
- `{' ѿ... `|' ... `}'
+ `{' ѿ.. `|' .. `}'
ּפ֥åȤꤷּפΥ᥽åɤ򥤥ƥ졼Ȥɾ
롥ּפΥȥåץ٥Υ᥽åɤƥ졼ȤƸƤӽФ졤
@@ -722,7 +722,7 @@ Enumerable⥸塼grep᥽åɤΤ褦˥ƥ졼ȤƸƤФ줿
** YIELD
- yield `(' [ [`,' ...]])
+ yield `(' [ [`,' ..]])
yield
ƥ졼ǥ֥åθƤӽФԤʤyield¹Ԥ᥽åɤ
@@ -740,27 +740,27 @@ yieldΰγ̤ۣǤʤ¤άǤ롥
failΰγ̤ۣǤʤ¤άǤ롥
-** PROTECT
+** BEGIN
-ͽʤ֤ȯˤ㳰ȯ롥RubyǤ㳰
-ªơƻԤꡤԤʤäꤹ뤳ȤǤ롥
+ʣμޤȤ뤿begin롥beginηϰʲ̤Ǥ롥
- protect
- 1
+ begin
+ ..
[resque
- 2 ]
+ .. ]
[ensure
- 3]
+ ..]
end
-1¹Ԥμ¹㳰ȯresqueǻꤵ줿2¹
-롥ensure᤬¸ߤprotectλɬ(ェλ
-Ǥʤ㳰, return, break, continue, redoʤɤˤæФǤ)3
-¹Ԥ롥
+beginͤϰֺǸɾ줿ͤǤ롥beginνȯ
+㳰resqueͤ뤳Ȥ롥ξͤresqueǺ
+ɾͤǤ롥ensure᤬¸ߤbeginλ
+ɬ(ェλǤʤ㳰, return, break, continue, redoʤ
+ˤæФǤ)ensureμɾ롥
** RETURN
- return [[`,' ...]]
+ return [[`,' ..]]
ͤͤȤƥ᥽åɤμ¹Ԥλ롥2İʾͿ줿
ˤϡǤȤ᥽åɤͤȤ롥Ĥʤ
@@ -788,9 +788,9 @@ redoϥ롼׾ΥåԤʤ鷺ߤη֤ľ
retry
-protectresqueǻȤprotectϤᤫ¹Ԥ롥㳰Ԥʤ
-ƤƻԤΤ˻ȤresqueʳretryѤ줿㳰ȯ
-롥
+beginresqueǻȤbeginϤᤫ¹Ԥ롥㳰Ԥʤä
+ƻԤΤ˻ȤresqueʳretryѤ줿㳰ȯ
+롥
** 饹
@@ -820,7 +820,7 @@ protectresqueǻȤprotectϤᤫ¹Ԥ롥㳰Ԥʤ
ϥͥȤǤʤΤǡ᥽åǤϥ᥽åƤӸ
ӽФʤ
- def ᥽å̾ [`(' [`,' ...][`,' `*' ] `)']
+ def ᥽å̾ [`(' [`,' ..][`,' `*' ] `)']
end
@@ -845,7 +845,7 @@ protectresqueǻȤprotectϤᤫ¹Ԥ롥㳰Ԥʤ
᥽åˤϤ⤦ðۥ᥽åɤ롥ðۥ᥽åɤȤϤ
Υ֥Ȥ˸ͭΥ᥽åɤǤ롥ϰʲ̤Ǥ롥
- def `.' ᥽å̾ [`(' [`,' ...][`,' `*' ] `)']
+ def `.' ᥽å̾ [`(' [`,' ..][`,' `*' ] `)']
end
@@ -867,7 +867,7 @@ protectresqueǻȤprotectϤᤫ¹Ԥ롥㳰Ԥʤ
¾Υ⥸塼򥤥󥯥롼ɤ빽ϰʲ̤Ǥ롥
- include ⥸塼̾ [`,' ⥸塼̾...]
+ include ⥸塼̾ [`,' ⥸塼̾..]
ߤΥ饹ޤϥ⥸塼(ȥåץ٥ǤObject饹)˻
ꤷ⥸塼򥤥󥯥롼ɤ롥
@@ -977,7 +977,7 @@ Rubyˤϸ̩ʰ̣ǤϴؿϤʤKernel饹δؿ᥽åɤ(Ƥ
᥽åɤƥ졼ȤƸƤӽФ줿˿Ǥʤ˵
֤Ҹ졥
- kill(signal, pid...)
+ kill(signal, pid..)
pidǻꤵ줿ץ˥ʥ롥ʥϥʥ
椫̾ǻꤹ롥ͤĥʥ(뤤ϥʥ̾
@@ -1094,7 +1094,7 @@ Rubyˤϸ̩ʰ̣ǤϴؿϤʤKernel饹δؿ᥽åɤ(Ƥ
`$_'ͤ򹹿롥¾ξܺ٤˴ؤƤString饹sub
᥽åɤβ򻲾ȤΤȡ
- syscall(num, arg...)
+ syscall(num, arg..)
numǻꤵ줿ֹΥƥॳ¹Ԥ롥2ʹߤ
ƥॳΰȤϤʸޤǤʤ
@@ -1104,7 +1104,7 @@ Rubyˤϸ̩ʰ̣ǤϴؿϤʤKernel饹δؿ᥽åɤ(Ƥ
ޥɤ¹Ԥνλơ֤
- trap(command, signal...)
+ trap(command, signal..)
signalγߤäcommand¹Ԥ롥signalϥ
ʥ̾ʥֹ桥commandȤ"SIG_IGN"ޤ"IGNORE"
@@ -1234,11 +1234,11 @@ Rubyˤϸ̩ʰ̣ǤϴؿϤʤKernel饹δؿ᥽åɤ(Ƥ
᥽åɤ񿿤ͤȤ%TRUE֤褦ˤϤʤäƤ
)Ĥޤ
- if some.method() then .. else .. end
+ if some.method() then ... else ... end
- if some.method() == %TRUE then .. else .. end
+ if some.method() == %TRUE then ... else ... end
ϴˤƱǤϤʤ%FALSE˴ؤƤϡΤ褦
ʤ
@@ -1247,7 +1247,7 @@ Rubyˤϸ̩ʰ̣ǤϴؿϤʤKernel饹δؿ᥽åɤ(Ƥ
** Array(饹)
-źȤΥ饹Ǥ롥ϰŪˤ``[...]''
+źȤΥ饹Ǥ롥ϰŪˤ``[..]''
Ԥʤ롥
SuperClass: Object
@@ -1429,7 +1429,7 @@ Methods:
Single Methods:
- Array[item...]
+ Array[item..]
ǤȤ롥
@@ -1482,7 +1482,7 @@ SuperClass: Object
Methods:
- call(arg[, ...])
+ call(arg[,..])
֥å¹Ԥ롥
@@ -1514,7 +1514,7 @@ Private Methods:
Methods:
- new(...)
+ new(..)
饹Υ󥹥󥹤롥¿ξ礳Υ᥽åɤϥ֥
饹ðۥ᥽åɤˤäƥС饤ɤ졤饹ˤäư
@@ -1788,7 +1788,7 @@ Methods:
Single Methods:
- Dict[key, value...]
+ Dict[key, value..]
ܤΰkeyܤΰvalueȤ뼭롥
@@ -2088,12 +2088,12 @@ Single Methods:
filenameκǽơѹ֤
- chmod(mode, path, file...)
+ chmod(mode, path, file..)
եΥѡߥåѹ(cf chmod(2))ѹե
֤fileˤϥ磻ɥɤ
- chown(owner, group, file...)
+ chown(owner, group, file..)
եνͭԤȥ롼פѹ(cf chown(2))nil-1
ꤹ뤳ȤˤäƽͭԤ䥰롼פ򸽺ߤΤޤѤʤǤ
@@ -2135,12 +2135,12 @@ Single Methods:
"directory""characterSpecial""blockSpecial""fifo"
"link""socket"ΤΤ줫ĤǤ롥
- unlink(file...)
+ unlink(file..)
ե롥ǥ쥯ȥκˤDir.rmdirȤȡ
fileˤϥ磻ɥɤ
- utime(atime, mtime, file...)
+ utime(atime, mtime, file..)
եΥatimeˡmtimeꤹ롥
atimemtimeϿޤTime饹Υ󥹥󥹤ǤʤФʤ
@@ -2389,7 +2389,7 @@ Single Methods:
** Glob(饹)
-磻ɥɤΥ饹磻ɥɤΥƥ<...>ȤǤ
+磻ɥɤΥ饹磻ɥɤΥƥ<..>ȤǤ
롥ɽȤۤƱ褦˻Ȥ뤬ϵǽʤ
ɥɤŸǽ롥
@@ -3363,7 +3363,7 @@ Methods:
print(i, "\n");
end
- a, b, c, .. aa, .. az, baޤǤƹԤ˽Ϥ롥
+ a, b, c, ... aa, ... az, baޤǤƹԤ˽Ϥ롥
դʤФʤΤϡνλȽ羮طǤϤʤ
@@ -3412,7 +3412,7 @@ Single Methods:
ܥɥǡ¤Τɽ뤿ˤϰʲηȤ
struct ¤̾
- ..
+ ...
end
ץǤηǹ¤Τ櫓ǤϤʤ
@@ -3440,7 +3440,7 @@ Methods:
Single Methods:
- new(name, member::value...)
+ new(name, member::value..)
nameȤ̾ŤΤ롥memberϹ¤ΤΥФ
ɽʸǤꡤvalueϤͤǤ롥줿¤Τϥ
@@ -3596,10 +3596,10 @@ Methods:
formatʸ˽äʸѴ̤֤format
ʸȤƻǤΤ ʲ̤Ǥ롥
- %A ̾(Sunday, Monday,...)
- %a ξά̾(Sun, Mon,...)
- %B ̾(January, February,...)
- %b ξά̾(Jan, Feb,...)
+ %A ̾(Sunday, Monday,..)
+ %a ξά̾(Sun, Mon,..)
+ %B ̾(January, February,..)
+ %b ξά̾(Jan, Feb,..)
%c ɽ(cf ctime(3))
%d ʿǤ(01-31)
%H 24λ(00-23)
@@ -3802,7 +3802,7 @@ PRIMARY : LITERAL
| for ITER_VAR in EXPR TERM
COMPEXPR
end
- | protect
+ | begin
COMPEXPR
[resque COMPEXPR]
[ensure COMPEXPR]
diff --git a/version.h b/version.h
index d24ad99..d8dfe80 100644
--- a/version.h
+++ b/version.h
@@ -1,2 +1,2 @@
-#define RUBY_VERSION "0.65"
-#define VERSION_DATE "95/02/08"
+#define RUBY_VERSION "0.66"
+#define VERSION_DATE "95/02/09"