[Sciviews-commits] r139 - in pkg/svTools: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jun 6 10:47:23 CEST 2009


Author: romain
Date: 2009-06-06 10:47:22 +0200 (Sat, 06 Jun 2009)
New Revision: 139

Modified:
   pkg/svTools/DESCRIPTION
   pkg/svTools/R/parseError.R
   pkg/svTools/R/roxygen.R
   pkg/svTools/R/sidekick.R
Log:
minor fixes in svTools (sidekick)

Modified: pkg/svTools/DESCRIPTION
===================================================================
--- pkg/svTools/DESCRIPTION	2009-06-05 09:25:43 UTC (rev 138)
+++ pkg/svTools/DESCRIPTION	2009-06-06 08:47:22 UTC (rev 139)
@@ -1,8 +1,8 @@
 Package: svTools
 Type: Package
 Title: Set of tools (wrapper for packages tools and codetools)
-Version: 0.0-5
-Date: 2008-12-11
+Version: 0.0-6
+Date: 2009-06-06
 Author: Romain Francois <francoisromain at free.fr>
 Maintainer: Romain Francois <francoisromain at free.fr>
 Description: Set of tools aimed at wrapping some of the functionalities

Modified: pkg/svTools/R/parseError.R
===================================================================
--- pkg/svTools/R/parseError.R	2009-06-05 09:25:43 UTC (rev 138)
+++ pkg/svTools/R/parseError.R	2009-06-06 08:47:22 UTC (rev 139)
@@ -3,22 +3,18 @@
 #' Makes sense of a \code{parse} error and structure the information
 #' @export
 #' @param err An error as generated by \code{parse} 
-#' @param only.last Should only the last line of the error be outputed into the structure
 #' @return A data.frame with the following columns : file, line, message and type
 #' @author Romain Francois \email{francoisromain@@free.fr}
-parseError <- function( err, only.last = TRUE ){
-  msg <- strsplit( err, "\\\n" )[[1]]
-  line.nb <- as.integer(msg %~|% "^[[:digit:]]" %!~|% "^[[:digit:]]+:[[:space:]]*$" %-~|% ":.*"  )
-  if( only.last ){
-		line.nb <- tail( line.nb, 1 )
-	}
-	msg.line <- paste(msg %!~|% "^[[:digit:]]+", collapse=" " ) %/~% " *: *"
-  file <- msg.line[2]
-  err.msg <- msg.line[3]
-  data.frame( file = rep(file, length(line.nb)), 
-    line = line.nb, 
-    message = rep(err.msg, length(line.nb) ), 
-    type = rep( "error", length(line.nb) ), 
-		stringsAsFactors = FALSE )
+parseError <- function( err ){
+  msg <- err %/~% "\\\n"
+  rx   <- "^.*?: (.*?):(.*?):(.*?):(.*)$"
+  file <- sub( rx, "\\1", msg[1], perl = TRUE )
+  line <- sub( rx, "\\2", msg[1], perl = TRUE )
+  col  <- sub( rx, "\\3", msg[1], perl = TRUE )
+  message <- sub( rx, "\\4", msg[1], perl = TRUE )
+  
+  data.frame( file = file, 
+    line = line, message = message, 
+    type = "error", stringsAsFactors = FALSE )
 }
 

Modified: pkg/svTools/R/roxygen.R
===================================================================
--- pkg/svTools/R/roxygen.R	2009-06-05 09:25:43 UTC (rev 138)
+++ pkg/svTools/R/roxygen.R	2009-06-06 08:47:22 UTC (rev 139)
@@ -180,7 +180,7 @@
 		template <- paste( template, paste( "#' @author ${",index,":", author, "}", sep = "" ), sep = "\n" ) 
 	}
 	index <- index + 1
-	template <- paste( template, paste( "#' @callGraph\n#' @examples\n#' ${",index,":# executable code for `",funname,"`}", sep = "" ), sep = "\n" ) 
+	template <- paste( template, paste( "#' @callGraph\n#' @examples\n#' ${",index,":# executable code for `",funname,"`}\n", sep = "" ), sep = "\n" ) 
 	
 	type <- match.arg( type )
 	

Modified: pkg/svTools/R/sidekick.R
===================================================================
--- pkg/svTools/R/sidekick.R	2009-06-05 09:25:43 UTC (rev 138)
+++ pkg/svTools/R/sidekick.R	2009-06-06 08:47:22 UTC (rev 139)
@@ -38,7 +38,7 @@
 	}
 	
 	### try to parse and return an error if failed
-	p <- try( parse( file, srcfile=filename ), silent = TRUE )
+	p <- try( parse( file ), silent = TRUE )
 	if( p %of% "try-error" ){
 		return( list( type = "error", data = parseError( p ) ) )
 	}



More information about the Sciviews-commits mailing list