Sha256: c360d6fc9d8a1b68f7af0b9c84a471e39f2a659bb785462cbc54a1976be644f1

Contents?: true

Size: 1.67 KB

Versions: 6825

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,825 entries across 6,822 versions & 32 rubygems

Version Path
cybrid_api_organization_ruby-0.123.186 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.186 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_organization_ruby-0.123.185 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.185 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_organization_ruby-0.123.184 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.184 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.183 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_organization_ruby-0.123.183 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
ory-client-1.16.5 vendor/bundle/ruby/3.1.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
ory-client-1.16.4 vendor/bundle/ruby/3.1.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.179 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_organization_ruby-0.123.179 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_organization_ruby-0.123.177 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.177 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_organization_ruby-0.123.176 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.176 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_organization_ruby-0.123.175 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.175 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_id_ruby-0.123.174 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb
cybrid_api_organization_ruby-0.123.174 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/commands/continue.rb