Sha256: fbb9ad85a7d1528d94ec66cc7f273e51bba7a4edf013dfd0ac05a5b26e33e9f1
Contents?: true
Size: 573 Bytes
Versions: 25
Compression:
Stored size: 573 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 > 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
25 entries across 22 versions & 5 rubygems