[Roxygen-commits] r241 - in pkg: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Nov 12 09:22:06 CET 2009


Author: manuel
Date: 2009-11-12 09:22:05 +0100 (Thu, 12 Nov 2009)
New Revision: 241

Modified:
   pkg/R/parse.R
   pkg/man/parse.file.Rd
Log:
Caching on file content not file names (by Hadley).

Modified: pkg/R/parse.R
===================================================================
--- pkg/R/parse.R	2009-11-11 17:05:27 UTC (rev 240)
+++ pkg/R/parse.R	2009-11-12 08:22:05 UTC (rev 241)
@@ -428,21 +428,32 @@
 
 #' Parse a source file containing roxygen directives;
 #' with the help of memoization (by Hadley Wickham).
-#' param file string naming file to be parsed
-#' @param ... string naming file to be parsed
+#' @param file string naming file to be parsed
 #' @return List containing parsed directives
 #' @export
 #' @callGraph
 #' @callGraphDepth 3
-parse.file <- memoize(function(file) {
+parse.file <- function(file) {
   srcfile <- srcfile(file)
+  cached.parse.srcfile(srcfile)
+}
+
+#' Memoized parse.srcfile (by Hadley Wickham).
+#' @param ... the srcfile object
+#' @return List containing parsed directives
+cached.parse.srcfile <- memoize(parse.srcfile)
+
+#' Parse a srcfile object.
+#' @param srcfile the srcfile object
+#' @return List containing parsed directives
+parse.srcfile <- function(srcfile) {
   srcrefs <- attributes(parse(srcfile$filename,
                               srcfile=srcfile))$srcref
   if (length(srcrefs) > 0)
     parse.refs(zip.list(prerefs(srcfile, srcrefs), srcrefs))
   else
     nil
-})
+}
 
 #' Parse many files at one.
 #' @param \dots files to be parsed

Modified: pkg/man/parse.file.Rd
===================================================================
--- pkg/man/parse.file.Rd	2009-11-11 17:05:27 UTC (rev 240)
+++ pkg/man/parse.file.Rd	2009-11-12 08:22:05 UTC (rev 241)
@@ -1,9 +1,7 @@
 \name{parse.file}
 \alias{parse.file}
 \title{Parse a source file containing roxygen directives.}
-\usage{### parse.file(file)
-parse.file(...)
-}
+\usage{parse.file(file)}
 \description{Parse a source file containing roxygen directives.}
 \value{List containing parsed directives}
-\arguments{\item{...}{string naming file to be parsed}}
+\arguments{\item{file}{string naming file to be parsed}}



More information about the Roxygen-commits mailing list