Skip to content

Commit

Permalink
Restore R 3.6 compatibility (#200)
Browse files Browse the repository at this point in the history
Part of #173
  • Loading branch information
hadley authored Jul 3, 2024
1 parent 212acdb commit e00724f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
6 changes: 4 additions & 2 deletions R/parse_all.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
4 changes: 4 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit e00724f

Please sign in to comment.