[Roxygen-commits] r57 - in pkg: R sandbox

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jul 19 23:07:58 CEST 2008


Author: pcd
Date: 2008-07-19 23:07:58 +0200 (Sat, 19 Jul 2008)
New Revision: 57

Modified:
   pkg/R/parse.R
   pkg/sandbox/example-Rd-nlm.R
Log:
@@ escape for @s


Modified: pkg/R/parse.R
===================================================================
--- pkg/R/parse.R	2008-07-19 21:07:46 UTC (rev 56)
+++ pkg/R/parse.R	2008-07-19 21:07:58 UTC (rev 57)
@@ -188,9 +188,21 @@
   if (is.nil(joined.lines))
     nil
   else {
-    ## Must be modified (with a PCRE look-behind?) to skip escaped
-    ## TAG.DELIMITERs.
-    elements <- car(strsplit(joined.lines, TAG.DELIMITER, fixed=T))
+    ## Thanks to Fegis on #regex at Freenode for the
+    ## lookahead/lookbehind hack; as he notes, however, "it's not
+    ## proper escaping though... it will not split a@@@b."
+    elements <- car(strsplit(joined.lines,
+                             sprintf('(?<!%s)%s(?!%s)',
+                                     TAG.DELIMITER,
+                                     TAG.DELIMITER,
+                                     TAG.DELIMITER),
+                             perl=T))
+    ## Compress the escaped delimeters.
+    elements <- Map(function(element)
+                    gsub(sprintf('%s{2}', TAG.DELIMITER),
+                         TAG.DELIMITER,
+                         element),
+                    elements)
     description <- car(elements)
     parsed.elements <- Reduce(function(parsed, element)
                               append(parsed, parse.element(element)),

Modified: pkg/sandbox/example-Rd-nlm.R
===================================================================
--- pkg/sandbox/example-Rd-nlm.R	2008-07-19 21:07:46 UTC (rev 56)
+++ pkg/sandbox/example-Rd-nlm.R	2008-07-19 21:07:58 UTC (rev 57)
@@ -18,6 +18,7 @@
 #' @aliases nlm
 #' @title Non-Linear Minimization
 #' @concept optimization
+#' @author Example Author \email{author@@example.com}
 #' @usage
 #' nlm(f, p, \dots, hessian = FALSE, typsize = rep(1, length(p)),
 #'     fscale = 1, print.level = 0, ndigit = 12, gradtol = 1e-6,



More information about the Roxygen-commits mailing list