def consume!(token)
      return self if @error

      action = @state.action[token] || @state.defact
      case action
      when Shift
        @sstack.push(@state)
        @state = action.goto_state
        shifted(token)
      when Reduce
        reduce_by!(action.rule)
        consume!(token)
      when Accept
        done
      when Error
        @error = true
        error
      else
        raise "Illegal action type: #{action.class}"
      end

      self
    end
def consume!(token)
      return self if @error

      action = @state.action[token] || @state.defact
      case action
      when Shift
        @sstack.push(@state)
        @state = action.goto_state
        shifted(token)
      when Reduce
        reduce_by!(action.rule)
        consume!(token)
      when Accept
        done
      when Error
        @error = true
        error
      else
        raise "Illegal action type: #{action.class}"
      end

      self
    end
consuming a terminal may set off a series of reduces before the terminal
 is shifted