diff --git a/DESCRIPTION b/DESCRIPTION index f5ebb4bdd..986be39e8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -31,7 +31,6 @@ Imports: R.cache (>= 0.15.0), rlang (>= 0.1.1), rprojroot (>= 1.1), - tibble (>= 1.4.2), tools, vctrs (>= 0.4.1), withr (>= 1.0.0), @@ -45,6 +44,7 @@ Suggests: rmarkdown, roxygen2, rstudioapi (>= 0.7), + tibble (>= 1.4.2), testthat (>= 3.0.0) VignetteBuilder: knitr diff --git a/NAMESPACE b/NAMESPACE index 6a3d591e2..6b0139d46 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -42,7 +42,6 @@ importFrom(rlang,is_installed) importFrom(rlang,seq2) importFrom(rlang,warn) importFrom(rlang,with_handlers) -importFrom(tibble,tribble) importFrom(utils,capture.output) importFrom(utils,tail) importFrom(utils,write.table) diff --git a/R/environments.R b/R/environments.R index b5ce9e80a..0f895517c 100755 --- a/R/environments.R +++ b/R/environments.R @@ -58,7 +58,7 @@ parser_version_find <- function(pd) { #' @details #' * `parser_version`: Needed to dispatch between parser versions, see #' [parser_version_set()] for details. -#' * `stylerignore`: A tibble with parse data containing tokens that fall within +#' * `stylerignore`: A data frame with parse data containing tokens that fall within #' a stylerignore sequence. This is used after serializing the flattened #' parse table to apply the initial formatting to these tokens. See #' [stylerignore] for details. diff --git a/R/nest.R b/R/nest.R index cb77b4a35..1cf270cc7 100644 --- a/R/nest.R +++ b/R/nest.R @@ -330,7 +330,7 @@ set_spaces <- function(spaces_after_prefix, force_one) { #' a parent to other tokens (called internal) and such that are not (called #' child). Then, the token in child are joined to their parents in internal #' and all token information of the children is nested into a column "child". -#' This is done recursively until we are only left with a nested tibble that +#' This is done recursively until we are only left with a nested data frame that #' contains one row: The nested parse table. #' @param pd_flat A flat parse table including both terminals and non-terminals. #' @seealso [compute_parse_data_nested()] diff --git a/R/nested-to-tree.R b/R/nested-to-tree.R index eb5489030..46377bf89 100644 --- a/R/nested-to-tree.R +++ b/R/nested-to-tree.R @@ -21,11 +21,11 @@ create_tree_from_pd_with_default_style_attributes <- function(pd, } -#' Convert a nested tibble into a node tree +#' Convert a nested data frame into a node tree #' -#' This function is convenient to display all nesting levels of a nested tibble +#' This function is convenient to display all nesting levels of a nested data frame #' at once. -#' @param pd_nested A nested tibble. +#' @param pd_nested A nested data frame. #' @param structure_only Whether or not create a tree that represents the #' structure of the expression without any information on the tokens. Useful #' to check whether two structures are identical. diff --git a/R/token-define.R b/R/token-define.R index b0385b7db..963d39218 100644 --- a/R/token-define.R +++ b/R/token-define.R @@ -1,31 +1,32 @@ -token <- tibble::tribble( - ~text, ~class, ~token, - "&", "logical", "AND", - "&&", "logical", "AND2", - "|", "logical", "OR", - "||", "logical", "OR2", - ">", "logical", "GT", - "<", "logical", "LT", - "<=", "logical", "LE", - ">=", "logical", "GE", - "!=", "logical", "NE", - "==", "logical", "EQ", - "=", "assign_left", "EQ_SUB", - "=", "assign_left", "EQ_ASSIGN", - "<-", "assign_left", "LEFT_ASSIGN", - "->", "assign_right", "RIGHT_ASSIGN", - "+", "math", "'+'", - "-", "math", "'-'", - "*", "math", "'*'", - "/", "math", "'/'", - "^", "math", "'^'", - "~", "formula", "'~'", - "if", "cond", "IF", - "else", "cond", "ELSE", - "in", "loop_cond", "IN", - "while", "loop_cond", "WHILE" +token <- rbind.data.frame( + c("&", "logical", "AND"), + c("&&", "logical", "AND2"), + c("|", "logical", "OR"), + c("||", "logical", "OR2"), + c(">", "logical", "GT"), + c("<", "logical", "LT"), + c("<=", "logical", "LE"), + c(">=", "logical", "GE"), + c("!=", "logical", "NE"), + c("==", "logical", "EQ"), + c("=", "assign_left", "EQ_SUB"), + c("=", "assign_left", "EQ_ASSIGN"), + c("<-", "assign_left", "LEFT_ASSIGN"), + c("->", "assign_right", "RIGHT_ASSIGN"), + c("+", "math", "'+'"), + c("-", "math", "'-'"), + c("*", "math", "'*'"), + c("/", "math", "'/'"), + c("^", "math", "'^'"), + c("~", "formula", "'~'"), + c("if", "cond", "IF"), + c("else", "cond", "ELSE"), + c("in", "loop_cond", "IN"), + c("while", "loop_cond", "WHILE"), + stringsAsFactors = FALSE ) +colnames(token) <- c("text", "class", "token") math_token <- token$token[token$class == "math"] logical_token <- token$token[token$class == "logical"] left_assignment_token <- token$token[token$class == "assign_left"] diff --git a/R/ui-styling.R b/R/ui-styling.R index 484a453b8..b208ff122 100644 --- a/R/ui-styling.R +++ b/R/ui-styling.R @@ -1,5 +1,4 @@ #' @keywords api -#' @importFrom tibble tribble #' @importFrom magrittr %>% NULL diff --git a/R/utils-navigate-nest.R b/R/utils-navigate-nest.R index 2a151fee3..99cd8ee84 100644 --- a/R/utils-navigate-nest.R +++ b/R/utils-navigate-nest.R @@ -33,7 +33,7 @@ previous_non_comment <- function(pd, pos) { #' next terminal #' @param pd A nest. #' @param stack Whether or not to also return information on the tokens that -#' are between `pd` and the first terminal, so the returned tibble can be +#' are between `pd` and the first terminal, so the returned data frame can be #' understood as a transition path from `pd` to the next terminal, instead of #' the information at the terminal only. The order is inside-out, #' i.e. the first non-terminal on top, the terminal last. @@ -41,7 +41,7 @@ previous_non_comment <- function(pd, pos) { #' @param tokens_exclude A vector with tokens to exclude. This can be helpful if #' one wants to find the next token that is not a comment for example. #' @return -#' Returns a tibble (which is **not** a valid parse table for +#' Returns a data frame (which is **not** a valid parse table for #' `stack = TRUE`), with `vars` and another variable `position` that denotes #' the index each element in the transition. This can be helpful in conjunction #' with [purrr::pluck()] or [purrr::modify_in()] to reach the terminal in the diff --git a/inst/WORDLIST b/inst/WORDLIST index cbb5ee766..d4c3a037e 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -23,6 +23,7 @@ cli CMD codecov coercible +coercions compat config CONST diff --git a/man/create_node_from_nested.Rd b/man/create_node_from_nested.Rd index 476867fd7..755f8d9fd 100644 --- a/man/create_node_from_nested.Rd +++ b/man/create_node_from_nested.Rd @@ -7,7 +7,7 @@ create_node_from_nested(pd_nested, parent, structure_only) } \arguments{ -\item{pd_nested}{A nested tibble.} +\item{pd_nested}{A nested data frame.} \item{parent}{The parent of the node to be created.} diff --git a/man/create_node_from_nested_root.Rd b/man/create_node_from_nested_root.Rd index 0fb4511d0..2127abaf5 100644 --- a/man/create_node_from_nested_root.Rd +++ b/man/create_node_from_nested_root.Rd @@ -2,12 +2,12 @@ % Please edit documentation in R/nested-to-tree.R \name{create_node_from_nested_root} \alias{create_node_from_nested_root} -\title{Convert a nested tibble into a node tree} +\title{Convert a nested data frame into a node tree} \usage{ create_node_from_nested_root(pd_nested, structure_only) } \arguments{ -\item{pd_nested}{A nested tibble.} +\item{pd_nested}{A nested data frame.} \item{structure_only}{Whether or not create a tree that represents the structure of the expression without any information on the tokens. Useful @@ -17,7 +17,7 @@ to check whether two structures are identical.} An object of class "Node" and "R6". } \description{ -This function is convenient to display all nesting levels of a nested tibble +This function is convenient to display all nesting levels of a nested data frame at once. } \examples{ diff --git a/man/env_current.Rd b/man/env_current.Rd index 2ce069855..bdd407371 100644 --- a/man/env_current.Rd +++ b/man/env_current.Rd @@ -17,7 +17,7 @@ The elements that are added to this environment are: \itemize{ \item \code{parser_version}: Needed to dispatch between parser versions, see \code{\link[=parser_version_set]{parser_version_set()}} for details. -\item \code{stylerignore}: A tibble with parse data containing tokens that fall within +\item \code{stylerignore}: A data frame with parse data containing tokens that fall within a stylerignore sequence. This is used after serializing the flattened parse table to apply the initial formatting to these tokens. See \link{stylerignore} for details. diff --git a/man/nest_parse_data.Rd b/man/nest_parse_data.Rd index 8484513ea..228fe40f9 100644 --- a/man/nest_parse_data.Rd +++ b/man/nest_parse_data.Rd @@ -17,7 +17,7 @@ A nested parse table. a parent to other tokens (called internal) and such that are not (called child). Then, the token in child are joined to their parents in internal and all token information of the children is nested into a column "child". -This is done recursively until we are only left with a nested tibble that +This is done recursively until we are only left with a nested data frame that contains one row: The nested parse table. } \seealso{ diff --git a/man/next_terminal.Rd b/man/next_terminal.Rd index dbe418426..9ddaf7775 100644 --- a/man/next_terminal.Rd +++ b/man/next_terminal.Rd @@ -15,7 +15,7 @@ next_terminal( \item{pd}{A nest.} \item{stack}{Whether or not to also return information on the tokens that -are between \code{pd} and the first terminal, so the returned tibble can be +are between \code{pd} and the first terminal, so the returned data frame can be understood as a transition path from \code{pd} to the next terminal, instead of the information at the terminal only. The order is inside-out, i.e. the first non-terminal on top, the terminal last.} @@ -26,7 +26,7 @@ i.e. the first non-terminal on top, the terminal last.} one wants to find the next token that is not a comment for example.} } \value{ -Returns a tibble (which is \strong{not} a valid parse table for +Returns a data frame (which is \strong{not} a valid parse table for \code{stack = TRUE}), with \code{vars} and another variable \code{position} that denotes the index each element in the transition. This can be helpful in conjunction with \code{\link[purrr:pluck]{purrr::pluck()}} or \code{\link[purrr:modify_in]{purrr::modify_in()}} to reach the terminal in the diff --git a/tests/testthat/alignment/tribble-three-cols-in.R b/tests/testthat/alignment/tribble-three-cols-in.R index d18336b39..958b370dc 100644 --- a/tests/testthat/alignment/tribble-three-cols-in.R +++ b/tests/testthat/alignment/tribble-three-cols-in.R @@ -1,4 +1,4 @@ -tibble::tribble( +tribble( ~x, ~y, ~z, "one", TRUE, 1L, "two", FALSE, 2L diff --git a/tests/testthat/alignment/tribble-three-cols-out.R b/tests/testthat/alignment/tribble-three-cols-out.R index d18336b39..958b370dc 100644 --- a/tests/testthat/alignment/tribble-three-cols-out.R +++ b/tests/testthat/alignment/tribble-three-cols-out.R @@ -1,4 +1,4 @@ -tibble::tribble( +tribble( ~x, ~y, ~z, "one", TRUE, 1L, "two", FALSE, 2L diff --git a/tests/testthat/test-roxygen-examples-complete.R b/tests/testthat/test-roxygen-examples-complete.R index 658b17510..c6d9019db 100644 --- a/tests/testthat/test-roxygen-examples-complete.R +++ b/tests/testthat/test-roxygen-examples-complete.R @@ -1,5 +1,3 @@ - - test_that("analogous to test-roxygen-examples-complete", { expect_warning(test_collection( "roxygen-examples-complete", "^1[^1234567890]",