-
Notifications
You must be signed in to change notification settings - Fork 2
/
alternate.R
29 lines (25 loc) · 904 Bytes
/
alternate.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
simple <- function(src,...){#title a simple Parser Function
noquotes <- gsub("([\"'`]).*\\1","",src)
print(noquotes)
comments <- grep("#",noquotes,value=TRUE)
pat <- "[^#]*#([^ ]*) (.*)"
tags <- gsub(pat,"\\1",comments)
docs <- as.list(gsub(pat,"\\2",comments))
names(docs) <- tags
docs[tags!=""]#value all the tags with a single pound sign
}
.parsers <- list(simple=inlinedocs::forfun(simple))
testfun <- function(x,y,z){#item{x} the first arg
a <- (x+y)*z # just a regular comment
a #value the sum of the first two times the third
#description a useless formula
}
.result <- list(
testfun=list(
`item{x}`="the first arg",
value="the sum of the first two times the third",
description="a useless formula"),
simple=list(
title="a simple Parser Function",
value="all the tags with a single pound sign"))
.dontcheck <- TRUE # because of use of forfun here