The slice of the source that this token represents.
The state of the lexer when this token was produced.
Attach the comments to their respective locations in the tree by mutating the parse result.
alias $foo $bar ^^^^^^^^^^^^^^^
foo.bar += baz ^^^^^^^^^^^^^^^
foo.bar &&= baz ^^^^^^^^^^^^^^^
foo.bar ||= baz ^^^^^^^^^^^^^^^
Foo::Bar, = baz ^^^^^^^^
$foo, = bar ^^^^
@foo, = bar ^^^^
foo, = bar ^^^
Visit the targets of a multi-target node.
Returns a new lazy enumerator with the concatenated results of running block
once for every element in the lazy enumerator.
["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force #=> ["f", "o", "o", "b", "a", "r"]
A value x
returned by block
is decomposed if either of the following conditions is true:
x
responds to both each and force, which means that x
is a lazy enumerator.
x
is an array or responds to to_ary.
Otherwise, x
is contained as-is in the return value.
[{a:1}, {b:2}].lazy.flat_map {|i| i}.force #=> [{:a=>1}, {:b=>2}]
Like Enumerable#take_while
, but chains operation to be lazy-evaluated.
Like Enumerable#map
, but chains operation to be lazy-evaluated.
(1..Float::INFINITY).lazy.map {|i| i**2 } #=> #<Enumerator::Lazy: #<Enumerator::Lazy: 1..Infinity>:map> (1..Float::INFINITY).lazy.map {|i| i**2 }.first(3) #=> [1, 4, 9]
Like Enumerable#take
, but chains operation to be lazy-evaluated.
Cast this pointer to a ruby object.