[Roxygen-commits] r31 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jun 3 21:11:23 CEST 2008


Author: pcd
Date: 2008-06-03 21:11:22 +0200 (Tue, 03 Jun 2008)
New Revision: 31

Modified:
   pkg/R/parse.R
Log:
grouping layout


Modified: pkg/R/parse.R
===================================================================
--- pkg/R/parse.R	2008-06-03 05:26:12 UTC (rev 30)
+++ pkg/R/parse.R	2008-06-03 19:11:22 UTC (rev 31)
@@ -8,7 +8,11 @@
   gsub('^[[:space:]]+', '',
        gsub('[[:space:]]+$', '', string))
 
-#' Comment blocks (possibly null) that precede a file's expressions.
+paste.list <- function(list) {
+  do.call(paste, list)
+}
+
+## Comment blocks (possibly null) that precede a file's expressions.
 prerefs <- function(srcfile, srcrefs) {
   length.line <- function(lineno)
     nchar(getSrcLines(srcfile, lineno, lineno))
@@ -28,21 +32,12 @@
   Map(pair.preref, pairs)
 }
 
-parse.ref <- function(x, ...)
-  UseMethod('parse.ref')
+## preref parsers
 
-parse.ref.list <- function(preref.srcref)
-  append(parse.ref(car(preref.srcref)),
-         parse.ref(cadr(preref.srcref)))
-
 parse.preref <- function(...) {
   list(unknown=paste(...))
 }
 
-parse.srcref <- function(...) {
-  nil
-}
-
 parse.element <- function(element) {
   tokens <- car(strsplit(element, ' ', fixed=T))
   parser <- parser.preref(car(tokens))
@@ -65,6 +60,10 @@
 
 parse.param <- parse.name.description
 
+## srcref parsers
+
+parse.srcref <- function(...) nil
+
 parse.setClass <- function(expression)
   list(class=cadr(car(expression)))
 
@@ -75,6 +74,8 @@
   list(method=cadr(car(expression)),
        class=caddr(car(expression)))
 
+## Parser lookup
+
 parser.default <- function(key, default) {
   f <- sprintf('parse.%s', key)
   if (length(ls(1, pattern=f)) > 0) f else default
@@ -84,10 +85,13 @@
 
 parser.srcref <- Curry(parser.default, default=parse.srcref)
 
-paste.list <- function(list) {
-  do.call(paste, list)
-}
+parse.ref <- function(x, ...)
+  UseMethod('parse.ref')
 
+parse.ref.list <- function(preref.srcref)
+  append(parse.ref(car(preref.srcref)),
+         parse.ref(cadr(preref.srcref)))
+
 parse.ref.preref <- function(preref) {
   lines <- getSrcLines(attributes(preref)$srcfile,
                        car(preref),



More information about the Roxygen-commits mailing list