Sha256: c360d6fc9d8a1b68f7af0b9c84a471e39f2a659bb785462cbc54a1976be644f1

Contents?: true

Size: 1.67 KB

Versions: 6934

Compression:

Stored size: 1.67 KB

Contents

# frozen_string_literal: true

require_relative "../command"
require_relative "../helpers/parse"

module Byebug
  #
  # Implements the continue command.
  #
  # Allows the user to continue execution until the next stopping point, a
  # specific line number or until program termination.
  #
  class ContinueCommand < Command
    include Helpers::ParseHelper

    def self.regexp
      /^\s* c(?:ont(?:inue)?)? (?:(!|\s+unconditionally|\s+\S+))? \s*$/x
    end

    def self.description
      <<-DESCRIPTION
        c[ont[inue]][ <line_number>]

        #{short_description}

        Normally the program stops at the next breakpoint. However, if the
        parameter "unconditionally" is given or the command is suffixed with
        "!", the program will run until the end regardless of any enabled
        breakpoints.
      DESCRIPTION
    end

    def self.short_description
      "Runs until program ends, hits a breakpoint or reaches a line"
    end

    def execute
      if until_line?
        num, err = get_int(modifier, "Continue", 0, nil)
        return errmsg(err) unless num

        filename = File.expand_path(frame.file)
        return errmsg(pr("continue.errors.unstopped_line", line: num)) unless Breakpoint.potential_line?(filename, num)

        Breakpoint.add(filename, num)
      end

      processor.proceed!

      Byebug.mode = :off if unconditionally?
      Byebug.stop if unconditionally? || Byebug.stoppable?
    end

    private

    def until_line?
      @match[1] && !["!", "unconditionally"].include?(modifier)
    end

    def unconditionally?
      @match[1] && ["!", "unconditionally"].include?(modifier)
    end

    def modifier
      @match[1].lstrip
    end
  end
end

Version data entries

6,934 entries across 6,931 versions & 33 rubygems

Version Path
cybrid_api_bank_ruby-0.123.204 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_organization_ruby-0.123.204 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.204 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_organization_ruby-0.123.203 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_bank_ruby-0.123.203 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.203 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_organization_ruby-0.123.200 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.200 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.198 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_organization_ruby-0.123.198 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.197 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_organization_ruby-0.123.197 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
runger_byebug-11.2.0 lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.196 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_organization_ruby-0.123.196 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.195 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_organization_ruby-0.123.195 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_organization_ruby-0.123.194 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.194 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.193 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb