[Roxygen-commits] r151 - in pkg: . R sandbox
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Aug 3 03:30:56 CEST 2008
Author: pcd
Date: 2008-08-03 03:30:53 +0200 (Sun, 03 Aug 2008)
New Revision: 151
Modified:
pkg/DESCRIPTION
pkg/R/callgraph.R
pkg/R/description.R
pkg/R/string.R
pkg/sandbox/description.R
Log:
abstract substr.regexpr; fix description.dependencies to deal with version; keep toFile-formals until 19.2 becomes mainstream
Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION 2008-08-02 07:21:43 UTC (rev 150)
+++ pkg/DESCRIPTION 2008-08-03 01:30:53 UTC (rev 151)
@@ -7,4 +7,4 @@
Manuel Eugster <Manuel.Eugster at stat.uni-muenchen.de>
Maintainer: Peter Danenberg <pcd at roxygen.org>
URL: http://roxygen.org
-Suggests: Rgraphviz
+Suggests: Rgraphviz (>= 1.19.2)
Modified: pkg/R/callgraph.R
===================================================================
--- pkg/R/callgraph.R 2008-08-02 07:21:43 UTC (rev 150)
+++ pkg/R/callgraph.R 2008-08-03 01:30:53 UTC (rev 151)
@@ -157,6 +157,8 @@
graphviz <- function(subcalls) {
FORMAT <- 'pdf'
+ ## This should be in here until the current Rgraphviz (19.2)
+ ## becomes mainstream.
formals(toFile) <- alist(graph=,
layoutType=c("dot", "neato", "twopi",
"circo", "fdp"),
Modified: pkg/R/description.R
===================================================================
--- pkg/R/description.R 2008-08-02 07:21:43 UTC (rev 150)
+++ pkg/R/description.R 2008-08-03 01:30:53 UTC (rev 151)
@@ -1,5 +1,7 @@
#' @include roxygen.R
#' @include list.R
+#' @include string.R
+#' @include functional.R
roxygen()
#' Parse lines of text corresponding to a package DESCRIPTION file.
@@ -14,19 +16,8 @@
contains.field <- function(line)
length(grep(paste(FIELD, SEPARATOR, sep=''), line)) > 0
- substr.regexp <- function(pattern, text) {
- matches <- regexpr(pattern, text, perl=TRUE)
- if (length(match) < 1)
- NULL
- else {
- start <- car(matches)
- end <- car(attr(matches, 'match.length'))
- substr(text, start, end)
- }
- }
-
field <- function(line)
- substr.regexp(FIELD, line)
+ substr.regexpr(FIELD, line)
rest <- function(line)
substr(line, nchar(field(line)) + 2, nchar(line))
@@ -130,11 +121,12 @@
description.dependencies <- function(description.file) {
dependencies <- NULL
split.dependencies <- function(parsed.fields)
- car(strsplit(dependencies, split='[[:space:]]+'))
+ Map(Curry(substr.regexpr, pattern='[^[:space:](]*'),
+ trim(car(strsplit(dependencies, split=',', fixed=TRUE))))
parser <- make.description.parser(noop.description,
post.parse=split.dependencies)
augment.dependencies <- function(field, value)
- dependencies <<- paste(value, dependencies)
+ dependencies <<- paste(value, dependencies, sep=',')
parser$register.parsers(augment.dependencies,
'Package',
Modified: pkg/R/string.R
===================================================================
--- pkg/R/string.R 2008-08-02 07:21:43 UTC (rev 150)
+++ pkg/R/string.R 2008-08-03 01:30:53 UTC (rev 151)
@@ -143,3 +143,20 @@
(parsed, proc(elt)),
elts,
NIL.STRING)
+
+#' Actually do the substring representation that
+#' regexpr should do; does not acknowledge groups,
+#' since \code{regexpr} doesn't.
+#' @param pattern the pattern to match
+#' @param text the text to match against
+#' @return The matched substring
+substr.regexpr <- function(pattern, text) {
+ matches <- regexpr(pattern, text, perl=TRUE)
+ if (length(match) < 1)
+ NULL
+ else {
+ start <- car(matches)
+ end <- car(attr(matches, 'match.length'))
+ substr(text, start, end)
+ }
+}
Modified: pkg/sandbox/description.R
===================================================================
--- pkg/sandbox/description.R 2008-08-02 07:21:43 UTC (rev 150)
+++ pkg/sandbox/description.R 2008-08-03 01:30:53 UTC (rev 151)
@@ -5,5 +5,4 @@
source('../R/description.R')
parser <- make.description.parser()
-## parser$parse(parse.description.file('../DESCRIPTION'))
description.dependencies('../DESCRIPTION')
More information about the Roxygen-commits
mailing list