[Roxygen-commits] r43 - in pkg: R sandbox
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jun 19 05:31:18 CEST 2008
Author: pcd
Date: 2008-06-19 05:31:18 +0200 (Thu, 19 Jun 2008)
New Revision: 43
Modified:
pkg/R/parse.R
pkg/sandbox/example-S4-person.R
pkg/sandbox/main.R
Log:
warn on unknown key; allow key substrings; singular exportMethod and exportClass
Modified: pkg/R/parse.R
===================================================================
--- pkg/R/parse.R 2008-06-19 01:31:24 UTC (rev 42)
+++ pkg/R/parse.R 2008-06-19 03:31:18 UTC (rev 43)
@@ -57,6 +57,11 @@
parse.default <- function(key, ...)
as.list(structure(args.to.string(...), names=key))
+parse.preref <- function(key, ...) {
+ parse.warning(key, 'is an unknown key')
+ parse.default(key, ...)
+}
+
## Possibly NA; in which case, the Roclets can do something more
## sophisticated with the srcref.
parse.export <- Curry(parse.default, key='export')
@@ -70,9 +75,9 @@
parse.prototype <- Curry(parse.value, key='prototype')
-parse.exportClasses <- Curry(parse.value, key='exportClasses')
+parse.exportClass <- Curry(parse.value, key='exportClass')
-parse.exportMethods <- Curry(parse.value, key='exportMethods')
+parse.exportMethod <- Curry(parse.value, key='exportMethod')
parse.exportPattern <- Curry(parse.value, key='exportPattern')
@@ -144,11 +149,11 @@
## Parser lookup
parser.default <- function(key, default) {
- f <- sprintf('parse.%s', key)
- if (length(ls(1, pattern=f)) > 0) f else Curry(default, key=key)
+ f <- ls(1, pattern=sprintf('parse.%s', key))[1]
+ if (is.na(f)) Curry(default, key=key) else f
}
-parser.preref <- Curry(parser.default, default=parse.default)
+parser.preref <- Curry(parser.default, default=parse.preref)
parser.srcref <- Curry(parser.default, default=parse.srcref)
Modified: pkg/sandbox/example-S4-person.R
===================================================================
--- pkg/sandbox/example-S4-person.R 2008-06-19 01:31:24 UTC (rev 42)
+++ pkg/sandbox/example-S4-person.R 2008-06-19 03:31:18 UTC (rev 43)
@@ -8,6 +8,7 @@
#' @slot birthyear The year of birth
#' @prototype Prototype person is named John Doe
#' and born in the year 1971
+#' @exportClass Person
setClass('Person',
representation=
representation(fullname='character',
@@ -19,8 +20,9 @@
#' Constructor function for Person object.
#' @param fullname The name of the person.
#' @param birthyear The year of birth.
-#' @return Person The Person object
-#' @export
+#' @returnType Person
+#' @return The Person object
+#' @exportMethod Person
Person <- function(fullname, birthyear) {
return(new('Person', fullname=fullname, birthyear=birthyear))
}
@@ -33,7 +35,7 @@
#' Name a person, the baptism.
#'
#' @param object A Person object
-#' @export
+#' @exportMethod name
setMethod('name', 'Person',
function(object) {
return(object at fullname)
Modified: pkg/sandbox/main.R
===================================================================
--- pkg/sandbox/main.R 2008-06-19 01:31:24 UTC (rev 42)
+++ pkg/sandbox/main.R 2008-06-19 03:31:18 UTC (rev 43)
@@ -2,7 +2,7 @@
source('../R/list.R')
source('../R/parse.R')
-FILE <- 'example-S3-mcpi.R'
+FILE <- 'example-S4-person.R'
argv <- commandArgs(trailingOnly=T)
argc <- length(argv)
More information about the Roxygen-commits
mailing list