Sha256: 1cb7034a1895e53d5175db2979adcf214adc8831f6de83b7530940202579e4a1
Contents?: true
Size: 580 Bytes
Versions: 8
Compression:
Stored size: 580 Bytes
Contents
# frozen_string_literal: true module Parser class MaxNumparamStack attr_reader :stack def initialize @stack = [] end def has_ordinary_params! set(-1) end def has_ordinary_params? top < 0 end def has_numparams? top && top > 0 end def register(numparam) set( [top, numparam].max ) end def top @stack.last end def push @stack.push(0) end def pop @stack.pop end private def set(value) @stack.pop @stack.push(value) end end end
Version data entries
8 entries across 8 versions & 2 rubygems