class RubyParserStuff::StackState
Attributes
debug[RW]
name[R]
stack[R]
Public Class Methods
new(name)
click to toggle source
# File lib/ruby_parser_extras.rb, line 1273 def initialize(name) @name = name @stack = [false] @debug = false end
Public Instance Methods
inspect()
click to toggle source
# File lib/ruby_parser_extras.rb, line 1279 def inspect "StackState(#{@name}, #{@stack.inspect})" end
is_in_state()
click to toggle source
# File lib/ruby_parser_extras.rb, line 1283 def is_in_state p :stack_is_in_state => [name, @stack.last, caller.first] if debug @stack.last end
lexpop()
click to toggle source
# File lib/ruby_parser_extras.rb, line 1288 def lexpop p :stack_lexpop => caller.first if debug raise if @stack.size == 0 a = @stack.pop b = @stack.pop @stack.push(a || b) end
pop()
click to toggle source
# File lib/ruby_parser_extras.rb, line 1296 def pop r = @stack.pop p :stack_pop => [name, r, @stack, caller.first] if debug @stack.push false if @stack.size == 0 r end
push(val)
click to toggle source
# File lib/ruby_parser_extras.rb, line 1303 def push val @stack.push val p :stack_push => [name, @stack, caller.first] if debug nil end
restore(oldstate)
click to toggle source
# File lib/ruby_parser_extras.rb, line 1315 def restore oldstate @stack.replace oldstate end
store()
click to toggle source
# File lib/ruby_parser_extras.rb, line 1309 def store result = @stack.dup @stack.replace [false] result end