View source: R/utils-navigate-nest.R
next_terminal | R Documentation |
If the first is a terminal, return it. If not, go inside it and search the next terminal
next_terminal(
pd,
stack = FALSE,
vars = c("pos_id", "token", "text"),
tokens_exclude = NULL
)
pd |
A nest. |
stack |
Whether or not to also return information on the tokens that
are between |
vars |
The variables to return. |
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. |
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
nested structure.
withr::with_options(
list(styler.cache_name = NULL), # temporarily deactivate cache
{
pd <- compute_parse_data_nested("if (TRUE) f()")
styler:::next_terminal(pd)
}
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.