[Sciviews-commits] r59 - pkg/svMisc/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Oct 13 10:29:20 CEST 2008


Author: romain
Date: 2008-10-13 10:29:20 +0200 (Mon, 13 Oct 2008)
New Revision: 59

Modified:
   pkg/svMisc/R/CompletePlus.R
   pkg/svMisc/R/descFun.R
Log:
added (skeleton) function to dealwith completions containing "$" and "@"

Modified: pkg/svMisc/R/CompletePlus.R
===================================================================
--- pkg/svMisc/R/CompletePlus.R	2008-10-13 07:16:22 UTC (rev 58)
+++ pkg/svMisc/R/CompletePlus.R	2008-10-13 08:29:20 UTC (rev 59)
@@ -49,23 +49,43 @@
 			}
     }     
 
+		### deal with completions with "$"
+		if (length(test.dollar <- grep("\\$", comps))) {
+			elements <- comps[ test.dollar ]
+			object   <- gsub( "\\$.*$" , "" , comps )[1]
+			after    <- gsub( "^.*\\$" , "" , comps )
+			pack     <- find.multiple( object )
+			out[ test.dollar, 2 ] <- pack
+			out[ test.dollar, 3 ] <- descData( object, after, package = pack )
+		}
+		
+		### deal with completions with "@"
+		if( length(test.slot <- grep("@", comps)) ){
+			elements <- comps[ test.dollar ]
+			object   <- gsub( "@.*$" , "" , comps )[1]
+			slots    <- gsub( "^.*@" , "" , comps )
+			pack     <- find.multiple( object )
+			out[ test.dollar, 2 ] <- pack
+			out[ test.dollar, 3 ] <- descSlots( object, slots, package = pack )
+		}
+		
     ### TODO: do not know what to do with these
     test.others <- grep(" ", comps)
     # TODO: are there other kind of completions I miss here
 
     ### deal with function completions
-    test.fun <- setdiff(1:length(comps), c(test.arg, test.pack, test.others))
+    test.fun <- setdiff(1:length(comps), c(test.arg, test.pack, test.others, test.dollar, test.slot))
     if (length(test.fun)) {
-		funs <- comps[test.fun]
-		packs <- find.multiple( funs )
-    desc.fun <- rep("", length(packs))
-		for (pack in unique(packs)) {
-			if (pack != ".GlobalEnv") {
-				desc.fun[packs == pack] <- descFun(funs[packs == pack], pack)
+			funs <- comps[test.fun]
+			packs <- find.multiple( funs )
+    	desc.fun <- rep("", length(packs))
+			for (pack in unique(packs)) {
+				if (pack != ".GlobalEnv") {
+					desc.fun[packs == pack] <- descFun(funs[packs == pack], pack)
+				}
 			}
-		}
-		out[test.fun, 2] <- packs
-		out[test.fun, 3] <- desc.fun
+			out[test.fun, 2] <- packs
+			out[test.fun, 3] <- desc.fun
     }
 
     out[, 3] <- gsub("\t", "    ", out[, 3])

Modified: pkg/svMisc/R/descFun.R
===================================================================
--- pkg/svMisc/R/descFun.R	2008-10-13 07:16:22 UTC (rev 58)
+++ pkg/svMisc/R/descFun.R	2008-10-13 08:29:20 UTC (rev 59)
@@ -38,6 +38,15 @@
 	return(res)
 }
 
+descData <- function( data, columns, package = NULL, lib.loc = NULL ){
+	character( length( columns ) )
+}
+
+descSlots <- function( object, slots, package = NULL, lib.loc = NULL ){
+	character( length( slots ) )
+}
+
+
 descArgs <-
 function (fun, args = NULL, package = NULL, lib.loc = NULL) {
 	# Start from the text version of the online help instead of the .Rd file



More information about the Sciviews-commits mailing list