SCM Repository
[inlinedocs] Annotation of /pkg/inlinedocs/inst/testfiles/alternate.R
Annotation of /pkg/inlinedocs/inst/testfiles/alternate.R
Parent Directory
|
Revision Log
Revision 204 -
(view)
(download)
1 : |
tdhock |
204 |
simple <- function(src,...){#title a simple Parser Function
|
2 : |
|
|
noquotes <- gsub("([\"'`]).*\\1","",src)
|
3 : |
|
|
print(noquotes)
|
4 : |
|
|
comments <- grep("#",noquotes,value=TRUE)
|
5 : |
|
|
pat <- "[^#]*#([^ ]*) (.*)"
|
6 : |
|
|
tags <- gsub(pat,"\\1",comments)
|
7 : |
|
|
docs <- as.list(gsub(pat,"\\2",comments))
|
8 : |
|
|
names(docs) <- tags
|
9 : |
|
|
docs[tags!=""]#value all the tags with a single pound sign
|
10 : |
|
|
}
|
11 : |
|
|
|
12 : |
|
|
.parsers <- list(simple=forfun(simple))
|
13 : |
|
|
|
14 : |
|
|
testfun <- function(x,y,z){#item{x} the first arg
|
15 : |
|
|
a <- (x+y)*z # just a regular comment
|
16 : |
|
|
a #value the sum of the first two times the third
|
17 : |
|
|
}#description a useless formula
|
18 : |
|
|
|
19 : |
|
|
.result <- list(testfun=list(`item{x}`="the first arg",
|
20 : |
|
|
value="the sum of the first two times the third",
|
21 : |
|
|
description="a useless formula"),
|
22 : |
|
|
simple=list(title="a simple Parser Function",
|
23 : |
|
|
value="all the tags with a single pound sign"))
|
24 : |
|
|
|
25 : |
|
|
.dontcheck <- TRUE # because of use of forfun here
|