global

def new_breakpoint

def new_breakpoint
  place = args.shift
  condition = args.join(' ') if 'if' == args.shift
  bp =
    case place
    when /^(\d+)$/       # Line number only
      line = $1
      unless PryByebug.check_file_context(target)
        raise ArgumentError, 'Line number declaration valid only in a file context.'
      end
      Breakpoints.add_file(target.eval('__FILE__'), line.to_i, condition)
    when /^(.+):(\d+)$/  # File and line number
      Breakpoints.add_file($1, $2.to_i, condition)
    when /^(.*)[.#].+$/  # Method or class name
      if $1.strip.empty?
        unless PryByebug.check_file_context(target)
          raise ArgumentError, 'Method name declaration valid only in a file context.'
        end
        place = target.eval('self.class.to_s') + place
      end
      Breakpoints.add_method(place,condition)
    else
      raise ArgumentError, 'Cannot identify arguments as breakpoint'
    end
  print_full_breakpoint bp
end