class Parser::CurrentArgStack
Stack that holds names of current arguments, i.e. while parsing
def m1(a = (def m2(b = def m3(c = 1); end); end)); end ^
stack is [:a, :b, :c]
Emulates `p->cur_arg` in MRI's parse.y
@api private
Attributes
stack[R]
Public Class Methods
new()
click to toggle source
# File lib/parser/current_arg_stack.rb, line 17 def initialize @stack = [] freeze end
Public Instance Methods
empty?()
click to toggle source
# File lib/parser/current_arg_stack.rb, line 22 def empty? @stack.size == 0 end
pop()
click to toggle source
# File lib/parser/current_arg_stack.rb, line 34 def pop @stack.pop end
push(value)
click to toggle source
# File lib/parser/current_arg_stack.rb, line 26 def push(value) @stack << value end
reset()
click to toggle source
# File lib/parser/current_arg_stack.rb, line 38 def reset @stack.clear end
set(value)
click to toggle source
# File lib/parser/current_arg_stack.rb, line 30 def set(value) @stack[@stack.length - 1] = value end
top()
click to toggle source
# File lib/parser/current_arg_stack.rb, line 42 def top @stack.last end