Find the index of the next or previous non-comment in a parse table.
Source:R/utils-navigate-nest.R
next_non_comment.Rd
Find the index of the next or previous non-comment in a parse table.
See also
Other third-party style guide helpers:
pd_is
,
scope_normalize()
Examples
code <- "a <- # hi \n x %>% b()"
writeLines(code)
#> a <- # hi
#> x %>% b()
pd <- compute_parse_data_nested(code)
child <- pd$child[[1]]
previous_non_comment(child, 4L)
#> [1] 2
next_non_comment(child, 2L)
#> [1] 4