# SCM Repository

[inlinedocs] Diff of /pkg/inlinedocs/R/parsers.R
 [inlinedocs] / pkg / inlinedocs / R / parsers.R

# Diff of /pkg/inlinedocs/R/parsers.R

revision 158, Mon Nov 8 12:26:12 2010 UTC revision 159, Tue Nov 9 16:42:39 2010 UTC
# Line 136  Line 136
136    starts <- c(1,bounds+1)    starts <- c(1,bounds+1)
137    ends <- c(bounds,length(clines))    ends <- c(bounds,length(clines))
138    ## detect body of function using paren matching    ## detect body of function using paren matching
139    f <- function(ch)cumsum(nchar(gsub(sprintf("[^%s]",ch),"",src)))    code <- gsub("#.*","",src)
140      f <- function(ch)cumsum(nchar(gsub(sprintf("[^%s]",ch),"",code)))
141    parens <- f("(")-f(")")    parens <- f("(")-f(")")
142    body.begin <- which(diff(parens)<0 & parens[-1]==0)+2    body.begin <- which(diff(parens)<0 & parens[-1]==0)+2
143    is.arg <- function(){    is.arg <- function(){
144      0 == length(grep("^\\s*#",src[start-1],perl=TRUE)) &&      gres <- grep("^\\s*#",src[start-1],perl=TRUE)
145        start<=body.begin      0 == length(gres) && start<=body.begin
146      }      }
147    res <- list()    res <- list()
148    for(i in seq_along(starts)){    for(i in seq_along(starts)){

Legend:
 Removed from v.158 changed lines Added in v.159