Sha256: a8074e55702e2d50478da1c745732d26cbd155c9e61dca6fd3b9c32d27ad705e

Contents?: true

Size: 1.83 KB

Versions: 7

Compression:

Stored size: 1.83 KB

Contents

module Byebug

  # Mix-in module to assist in command parsing.
  module SteppingFunctions
    def parse_stepping_args(command_name, match)
      if match[1].nil?
        force = Command.settings[:force_stepping]
      elsif match[1] == '+'
        force = true
      elsif match[1] == '-'
        force = false
      end
      steps = get_int(match[2], command_name, 1)
      return [steps, force]
    end
  end

  # Implements byebug "next" command.
  class NextCommand < Command
    self.allow_in_post_mortem = false
    self.need_context         = true

    def regexp
      /^\s* n(?:ext)?
        ([+-])?(?:\s+(\S+))?
        \s*$/x
    end

    def execute
      steps, force = parse_stepping_args("Next", @match)
      return unless steps
      @state.context.step_over steps, @state.frame_pos, force
      @state.proceed
    end

    class << self
      def names
        %w(next)
      end

      def description
        %{n[ext][+-]?[ nnn]\tstep over once or nnn times,
          \t\t'+' forces to move to another line.
          \t\t'-' is the opposite of '+' and disables the force_stepping setting.}
      end
    end
  end

  # Implements byebug "step" command.
  class StepCommand < Command
    self.allow_in_post_mortem = false
    self.need_context         = true

    def regexp
      /^\s* s(?:tep)?
        ([+-])?(?:\s+(\S+))?
        \s*$/x
    end

    def execute
      steps, force = parse_stepping_args("Step", @match)
      return unless steps
      @state.context.step_into steps, force
      @state.proceed
    end

    class << self
      def names
        %w(step)
      end

      def description
        %{
          s[tep][+-]?[ nnn]\tstep (into methods) once or nnn times
          \t\t'+' forces to move to another line.
          \t\t'-' is the opposite of '+' and disables the force_stepping setting.
        }
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
byebug-1.8.1 lib/byebug/commands/stepping.rb
byebug-1.8.0 lib/byebug/commands/stepping.rb
byebug-1.7.0 lib/byebug/commands/stepping.rb
byebug-1.6.1 lib/byebug/commands/stepping.rb
byebug-1.6.0 lib/byebug/commands/stepping.rb
byebug-1.5.0 lib/byebug/commands/stepping.rb
byebug-1.4.2 lib/byebug/commands/stepping.rb