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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jun 29 22:34:15 CEST 2009


Author: romain
Date: 2009-06-29 22:34:15 +0200 (Mon, 29 Jun 2009)
New Revision: 147

Modified:
   pkg/svTools/DESCRIPTION
   pkg/svTools/R/checkUsage.R
   pkg/svTools/R/parseError.R
   pkg/svTools/R/sidekick.R
Log:
update checkUsageFile to cope with empty files

Modified: pkg/svTools/DESCRIPTION
===================================================================
--- pkg/svTools/DESCRIPTION	2009-06-27 23:27:32 UTC (rev 146)
+++ pkg/svTools/DESCRIPTION	2009-06-29 20:34:15 UTC (rev 147)
@@ -1,8 +1,8 @@
 Package: svTools
 Type: Package
 Title: SciViews GUI API - Tools (wrapper for packages tools and codetools)
-Version: 0.0-6
-Date: 2009-06-06
+Version: 0.0-7
+Date: 2009-06-29
 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/checkUsage.R
===================================================================
--- pkg/svTools/R/checkUsage.R	2009-06-27 23:27:32 UTC (rev 146)
+++ pkg/svTools/R/checkUsage.R	2009-06-29 20:34:15 UTC (rev 147)
@@ -24,6 +24,9 @@
 	if( p.out %of% "data.frame" ){
 		return( getErrors( file = file ) ) 
 	}
+	if( length( p.out ) == 0){
+		return( emptyError() )
+	}
 	resetErrors( file = file )
 	
 	# silly hack to retrieve information from codetools
@@ -121,7 +124,6 @@
 		}
 	}
 	getErrors( file = file )
-	
 }
 
 as_character_srcref <- function (x, useSource = TRUE, encoding = "unknown"){

Modified: pkg/svTools/R/parseError.R
===================================================================
--- pkg/svTools/R/parseError.R	2009-06-27 23:27:32 UTC (rev 146)
+++ pkg/svTools/R/parseError.R	2009-06-29 20:34:15 UTC (rev 147)
@@ -8,13 +8,17 @@
 parseError <- function( err ){
   msg     <- err %/~% "\\\n"
   line.nb <- msg %~% "^\\d+"
-  msg     <- msg[ 1:( min( which( line.nb) ) - 1) ]
-  msg     <- paste( msg, collapse = "" )
+  if( any( line.nb ) ){
+  	msg     <- msg[ 1:( min( which( line.nb) ) - 1) ]
+  	msg     <- paste( msg, collapse = "" )
+  } else{
+	msg <- ""
+  }
   
-  rx      <- "^.*?: (.*?):(.*?):(.*?):(.*)$"
+  rx      <- "^.*?:\\s*(.*?):(.*?):(.*?):(.*)$"
   file    <- sub( rx, "\\1", msg, perl = TRUE )
-  line    <- sub( rx, "\\2", msg, perl = TRUE )
-  col     <- sub( rx, "\\3", msg, perl = TRUE )
+  line    <- as.integer( sub( rx, "\\2", msg, perl = TRUE )  )
+  col     <- as.integer( sub( rx, "\\3", msg, perl = TRUE )  )
   message <- sub( rx, "\\4", msg, perl = TRUE )
   
   data.frame( file = file, 

Modified: pkg/svTools/R/sidekick.R
===================================================================
--- pkg/svTools/R/sidekick.R	2009-06-27 23:27:32 UTC (rev 146)
+++ pkg/svTools/R/sidekick.R	2009-06-29 20:34:15 UTC (rev 147)
@@ -77,8 +77,8 @@
 	ids <- maxId + 1:length(p)
 	if( hasAttrs ){
 	  srcrefs <- t( sapply( attr(p, "srcref"), function( y ) {
-			positions <- as.integer(y)
-			if( length(positions) == 4 ) positions else positions[ c(1,5,3,6) ]
+			as.integer(y)[1:4]
+			# if( length(positions) == 4 ) positions else positions[ c(1,5,3,6) ]
 	  } ) )  
 		colnames( srcrefs ) <- paste("srcref", 1:4 , sep = "")
 		srcrefs <- as.data.frame( srcrefs ) 



More information about the Sciviews-commits mailing list