diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index e712a216..b5214eb1 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -37,6 +37,9 @@ jobs: - {os: ubuntu-latest, r: 'oldrel-3'} - {os: ubuntu-latest, r: 'oldrel-4'} + - {os: ubuntu-latest, r: '3.6'} + + env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} R_KEEP_PKG_SOURCE: yes diff --git a/DESCRIPTION b/DESCRIPTION index 8dc8831b..b0cdfc7f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -23,7 +23,7 @@ License: MIT + file LICENSE URL: https://evaluate.r-lib.org/, https://github.com/r-lib/evaluate BugReports: https://github.com/r-lib/evaluate/issues Depends: - R (>= 4.0.0) + R (>= 3.6.0) Suggests: covr, ggplot2 (>= 3.3.6), diff --git a/R/parse_all.R b/R/parse_all.R index d95b5b43..fc54700e 100644 --- a/R/parse_all.R +++ b/R/parse_all.R @@ -112,8 +112,10 @@ parse_all.character <- function(x, filename = NULL, allow_error = FALSE) { # parse() drops comments and whitespace so we add them back in gaps <- data.frame(start = c(1, pos$end + 1), end = c(pos$start - 1, n)) gaps <- gaps[gaps$start <= gaps$end, ,] - # in sequence(), nvec is equivalent to length.out - lines <- sequence(from = gaps$start, nvec = gaps$end - gaps$start + 1) + # some indexing magic in order to vectorise the extraction + lengths <- gaps$end - gaps$start + 1 + lines <- sequence(lengths) + rep(gaps$start, lengths) - 1 + comments <- data.frame( src = x[lines], expr = empty_expr(length(lines)), diff --git a/R/utils.R b/R/utils.R index 9a29c0fe..6370be1d 100644 --- a/R/utils.R +++ b/R/utils.R @@ -50,3 +50,7 @@ can_parse <- function(x) { error = function(e) FALSE ) } + +deparse1 <- function (expr, collapse = " ", width.cutoff = 500L, ...) { + paste(deparse(expr, width.cutoff, ...), collapse = collapse) +}