summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-19 15:18:50 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-19 15:18:50 +0000
commit7f95eed19e22cb9a4867819355fe4ab99f85fd16 (patch)
tree988295914fd4e93cf415ec614a9f0a9923e71299 /parse.y
parent3a5d1e4b775deee8c8731a97048b752a33b35922 (diff)
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.y16
1 files changed, 16 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index 655cd85031..5820e7f73d 100644
--- a/parse.y
+++ b/parse.y
@@ -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, &@$);