mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* class.c (rb_scan_args): Allow specifying the number of trailing
mandatory arguments right after the number of optional arguments only if the number of leading mandatory arguments is not omitted. * ext/socket/tcpserver.c (tcp_svr_init): Make use of it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
02316f11d5
commit
400ded9338
5 changed files with 23 additions and 9 deletions
|
|
@ -1180,16 +1180,17 @@ rb_scan_args(int argc, VALUE *argv, const char *fmt, ...)
|
|||
--
|
||||
scan-arg-spec := param-arg-spec [block-arg-spec]
|
||||
|
||||
param-arg-spec := pre-arg-spec [post-arg-spec] / post-arg-spec
|
||||
param-arg-spec := pre-arg-spec [post-arg-spec] / post-arg-spec / pre-opt-post-arg-spec
|
||||
pre-arg-spec := num-of-leading-mandatory-args [num-of-optional-args]
|
||||
post-arg-spec := sym-for-variable-length-args [num-of-trailing-mandatory-args]
|
||||
pre-opt-post-arg-spec := num-of-leading-mandatory-args num-of-optional-args num-of-trailing-mandatory-args
|
||||
block-arg-spec := sym-for-block-arg
|
||||
|
||||
num-of-leading-mandatory-args := DIGIT ; 先頭に置かれる省略不可能な引数の数
|
||||
num-of-leading-mandatory-args := DIGIT ; 先頭に置かれる省略不能な引数の数
|
||||
num-of-optional-args := DIGIT ; 続いて置かれる省略可能な引数の数
|
||||
sym-for-variable-length-args := "*" ; 続いて置かれる可変長引数を
|
||||
; Rubyの配列で取得するための指定
|
||||
num-of-trailing-mandatory-args := DIGIT ; 終端に置かれる省略不可能な引数の数
|
||||
num-of-trailing-mandatory-args := DIGIT ; 終端に置かれる省略不能な引数の数
|
||||
sym-for-block-arg := "&" ; イテレータブロックを取得するための
|
||||
; 指定
|
||||
--
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue