diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-19 15:18:50 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-19 15:18:50 +0000 |
commit | 7f95eed19e22cb9a4867819355fe4ab99f85fd16 (patch) | |
tree | 988295914fd4e93cf415ec614a9f0a9923e71299 /parse.y | |
parent | 3a5d1e4b775deee8c8731a97048b752a33b35922 (diff) | |
download | ruby-7f95eed19e22cb9a4867819355fe4ab99f85fd16.tar.gz |
Introduce endless range [Feature#12912]
Typical usages:
```
p ary[1..] # drop the first element; identical to ary[1..-1]
(1..).each {|n|...} # iterate forever from 1; identical to 1.step{...}
```
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -1903,6 +1903,22 @@ arg : lhs '=' arg_rhs /*% %*/ /*% ripper: dot3!($1, $3) %*/ } + | arg tDOT2 + { + /*%%%*/ + value_expr($1); + $$ = NEW_DOT2($1, new_nil(&@$), &@$); + /*% %*/ + /*% ripper: dot2!($1, Qnil) %*/ + } + | arg tDOT3 + { + /*%%%*/ + value_expr($1); + $$ = NEW_DOT3($1, new_nil(&@$), &@$); + /*% %*/ + /*% ripper: dot3!($1, Qnil) %*/ + } | arg '+' arg { $$ = call_bin_op(p, $1, '+', $3, &@2, &@$); |