[Roxygen-commits] r156 - in pkg: R sandbox
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Aug 5 10:30:52 CEST 2008
Author: pcd
Date: 2008-08-05 10:30:52 +0200 (Tue, 05 Aug 2008)
New Revision: 156
Modified:
pkg/R/Rd.R
pkg/R/callgraph.R
pkg/R/collate.R
pkg/R/namespace.R
pkg/R/parse.R
pkg/sandbox/Rd.R
pkg/sandbox/namespace.R
Log:
bring parser-registration into roclets themselves; which requires all to be loaded before parsing
Modified: pkg/R/Rd.R
===================================================================
--- pkg/R/Rd.R 2008-08-04 02:41:34 UTC (rev 155)
+++ pkg/R/Rd.R 2008-08-05 08:30:52 UTC (rev 156)
@@ -2,8 +2,45 @@
#' @include list.R
#' @include string.R
#' @include roclet.R
+#' @include parse.R
roxygen()
+register.preref.parsers(parse.value,
+ 'name',
+ 'aliases',
+ 'title',
+ 'usage',
+ 'references',
+ 'concept',
+ 'note',
+ 'seealso',
+ 'example',
+ 'examples',
+ 'keywords',
+ 'return',
+ 'author',
+ 'TODO')
+
+register.preref.parsers(parse.name.description,
+ 'param',
+ 'method')
+
+register.preref.parsers(parse.name,
+ 'docType')
+
+register.srcref.parser('setClass',
+ function(pivot, expression)
+ list(S4class=car(expression)))
+
+register.srcref.parser('setGeneric',
+ function(pivot, expression)
+ list(S4generic=car(expression)))
+
+register.srcref.parser('setMethod',
+ function(pivot, expression)
+ list(S4method=car(expression),
+ signature=cadr(expression)))
+
#' Make an Rd roclet which parses the given files and, if specified, populates
#' the given subdirectory with Rd files; or writes to standard out. See
#' \cite{Writing R Extensions}
Modified: pkg/R/callgraph.R
===================================================================
--- pkg/R/callgraph.R 2008-08-04 02:41:34 UTC (rev 155)
+++ pkg/R/callgraph.R 2008-08-05 08:30:52 UTC (rev 156)
@@ -3,6 +3,13 @@
#' @include functional.R
roxygen()
+register.preref.parsers(parse.value,
+ 'callGraphDepth')
+
+register.preref.parsers(parse.toggle,
+ 'callGraph',
+ 'callGraphPrimitives')
+
#' Make a callgraph roclet.
#'
#' The callgraph roclet is awkward in the sense that
Modified: pkg/R/collate.R
===================================================================
--- pkg/R/collate.R 2008-08-04 02:41:34 UTC (rev 155)
+++ pkg/R/collate.R 2008-08-05 08:30:52 UTC (rev 156)
@@ -3,8 +3,12 @@
#' @include functional.R
#' @include roclet.R
#' @include description.R
+#' @include parse.R
roxygen()
+register.preref.parsers(parse.value,
+ 'include')
+
#' Make collate roclet which parses the given files; topologically
#' sorting \code{@@include}s, and either merging the \code{Collate:}
#' directive with a pre-existing \file{DESCRIPTION} or writing to
Modified: pkg/R/namespace.R
===================================================================
--- pkg/R/namespace.R 2008-08-04 02:41:34 UTC (rev 155)
+++ pkg/R/namespace.R 2008-08-05 08:30:52 UTC (rev 156)
@@ -4,6 +4,19 @@
#' @include string.R
roxygen()
+register.preref.parsers(parse.default,
+ 'export')
+
+register.preref.parsers(parse.value,
+ 'exportClass',
+ 'exportMethod',
+ 'exportPattern',
+ 'S3method',
+ 'import',
+ 'importFrom',
+ 'importClassesFrom',
+ 'importMethodsFrom')
+
#' Make a namespace roclet which parses the given files and writes a list of
#' namespace directives to a given file or standard out; see
#' \cite{Writing R Extensions}
Modified: pkg/R/parse.R
===================================================================
--- pkg/R/parse.R 2008-08-04 02:41:34 UTC (rev 155)
+++ pkg/R/parse.R 2008-08-05 08:30:52 UTC (rev 156)
@@ -136,7 +136,9 @@
parse.description <- function(expression)
list(description=expression)
-#' Default parser which simply emits the key and expression.
+#' Default parser which simply emits the key and expression;
+#' used for elements with optional values (like \code{@@export})
+#' where roclets can do more sophisticated things with \code{NULL}.
#' @param key the parsing key
#' @param rest the expression to be parsed
#' @return A list containing the key and expression (possibly
@@ -157,11 +159,6 @@
parse.default(key, rest)
}
-#' Possibly NA; in which case, the Roclets can do something more
-#' sophisticated with the srcref.
-#' @name parse.preref.export
-register.preref.parser('export', parse.default)
-
#' Parse an element with a mandatory value.
#' @param key the parsing key
#' @param rest the expression to be parsed
@@ -174,41 +171,8 @@
parse.default(key, rest)
}
-#' Parsers with a mandatory value.
-#' @name value.parsers
-#' @aliases prototype exportClass exportMethod exportPattern S3method
-#' import importFrom importClassesFrom importMethodsFrom name
-#' title usage references concept note seealso example
-#' examples keywords return author include callGraphDepth
-register.preref.parsers(parse.value,
- 'prototype',
- 'exportClass',
- 'exportMethod',
- 'exportPattern',
- 'S3method',
- 'import',
- 'importFrom',
- 'importClassesFrom',
- 'importMethodsFrom',
- 'name',
- 'aliases',
- 'title',
- 'usage',
- 'references',
- 'concept',
- 'note',
- 'seealso',
- 'example',
- 'examples',
- 'keywords',
- 'return',
- 'author',
- 'include',
- 'callGraphDepth',
- 'TODO')
-
#' Parse an element containing a mandatory name
-#' and description (such as @@param).
+#' and description (such as \code{@@param}).
#' @param key the parsing key
#' @param rest the expression to be parsed
#' @return A list containing the key, name and
@@ -225,14 +189,6 @@
names=key))
}
-#' Parsers with name and description
-#' @name name.description.parsers
-#' @aliases slot param
-register.preref.parsers(parse.name.description,
- 'slot',
- 'param',
- 'method')
-
#' Parse an element containing a single name and only a name;
#' extra material will be ignored and a warning issued.
#' @param key parsing key
@@ -247,14 +203,6 @@
parse.default(key, strcar(name))
}
-#' Parsers taking a name
-#' @name name.parsers
-#' @aliases S3class returnType
-register.preref.parsers(parse.name,
- 'S3class',
- 'returnType',
- 'docType')
-
#' Turn a binary element on; parameters are ignored.
#' @param key parsing key
#' @param rest the expression to be parsed
@@ -263,51 +211,12 @@
parse.toggle <- function(key, rest)
as.list(structure(TRUE, names=key))
-#' Toggling parsers
-#' @name toggle.parsers
-#' @aliases listObject attributeObject environmentObject
-#' callGraph callGraphPrimitives
-register.preref.parsers(parse.toggle,
- 'listObject',
- 'attributeObject',
- 'environmentObject',
- 'callGraph',
- 'callGraphPrimitives')
-
#' By default, srcrefs are ignored; this parser returns \code{nil}.
#' @param pivot the parsing pivot
#' @param expression the expression to be parsed
#' @return \code{nil}
parse.srcref <- function(pivot, expression) nil
-#' Parse S4 \code{setClass} method.
-#' @name parse.srcref.setClass
-#' @param pivot the parsing pivot
-#' @param expression the expression to be parsed
-#' @return An list containing the class to be set
-register.srcref.parser('setClass',
- function(pivot, expression)
- list(S4class=car(expression)))
-
-#' Parse S4 \code{setGeneric} method.
-#' @name parse.srcref.setGeneric
-#' @param pivot the parsing pivot
-#' @param expression the expression to be parsed
-#' @return A list containing the generic
-register.srcref.parser('setGeneric',
- function(pivot, expression)
- list(S4generic=car(expression)))
-
-#' Parse S4 \code{setMethod} method.
-#' @name parse.srcref.setMethod
-#' @param pivot the parsing pivot
-#' @param expression the expression to be parsed
-#' @return A list containing the method to be set
-register.srcref.parser('setMethod',
- function(pivot, expression)
- list(S4method=car(expression),
- signature=cadr(expression)))
-
#' Default parser-lookup; if key not found, return
#' the default parser specified.
#' @param table the parser table from which to look
Modified: pkg/sandbox/Rd.R
===================================================================
--- pkg/sandbox/Rd.R 2008-08-04 02:41:34 UTC (rev 155)
+++ pkg/sandbox/Rd.R 2008-08-05 08:30:52 UTC (rev 156)
@@ -4,7 +4,10 @@
source('../R/parse.R')
source('../R/string.R')
source('../R/roclet.R')
+source('../R/namespace.R')
+source('../R/collate.R')
source('../R/Rd.R')
+source('../R/callgraph.R')
FILES <- list('../R/Rd.R')
Modified: pkg/sandbox/namespace.R
===================================================================
--- pkg/sandbox/namespace.R 2008-08-04 02:41:34 UTC (rev 155)
+++ pkg/sandbox/namespace.R 2008-08-05 08:30:52 UTC (rev 156)
@@ -1,3 +1,4 @@
+source('../R/roxygen.R')
source('../R/functional.R')
source('../R/list.R')
source('../R/string.R')
@@ -4,6 +5,9 @@
source('../R/parse.R')
source('../R/roclet.R')
source('../R/namespace.R')
+source('../R/collate.R')
+source('../R/Rd.R')
+source('../R/callgraph.R')
FILES <- list('example-function-mcpi.R',
'example-S3-mcpi.R',
More information about the Roxygen-commits
mailing list