The R Project SVN R

Rev

Rev 72296 | Rev 77976 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 72296 Rev 72338
Line 1... Line 1...
1
.ptime <- proc.time()
1
.ptime <- proc.time()
2
 
2
 
3
### tests of recursion in PCRE matching
3
### tests of recursion in PCRE matching
4
### Based on PR16757
4
### Based on PR16757
5
 
5
 
6
## This is expected to throw a warning at some point, depending on the
6
## This is expected to throw a warning at some point if PCRE uses a stack,
7
## system and stack size.
7
## depending on the system and stack size.
-
 
8
## Typical stack 8-10M, some people use 40M.
-
 
9
 
-
 
10
pcre_config()["stack"]
8
 
11
 
9
op <- options(warn = 1)
12
op <- options(warn = 1)
10
for (n in seq(5000L, 10000L, 1000L)) {
13
for (n in c(seq(5000L, 10000L, 1000L), 20000L, 50000L, 100000L)) {
11
    print(n)
14
    print(n)
12
    x <- paste0(rep("a", n), collapse="")
15
    x <- paste0(rep("a", n), collapse="")
13
    print(grepl("(a|b)+", x, perl = TRUE))
16
    print(grepl("(a|b)+", x, perl = TRUE))
14
}
17
}
15
options(op)
18
options(op)