selection-condition-helpers: Selection Focused Condition Helpers

selection-condition-helpersR Documentation

Selection Focused Condition Helpers

Description

These helpers are meant to be used on the left hand side of the trick specification, to filter which tricks the addin should display.

Usage

selection_is_empty(target = c("default", "lines", "script"))

selection_is_comment_line(target = c("default", "lines", "script"))

selection_is_comment_block(target = c("default", "lines", "script"))

selection_is_n_lines(n, target = c("default", "lines", "script"))

selection_is_single_line(target = c("default", "lines", "script"))

selection_is_parsable(
  multi_ok = TRUE,
  single_ok = TRUE,
  symbol_ok = TRUE,
  empty_ok = FALSE,
  target = c("default", "lines", "script")
)

selection_is_evaluable(
  simple_only = FALSE,
  target = c("default", "lines", "script")
)

selection_is_litteral(type = NA)

selection_is_reserved_word()

selection_is_symbol(litteral_ok = FALSE, reserved_ok = FALSE)

selection_is_call(
  symbol_ok = FALSE,
  litteral_ok = FALSE,
  reserved_ok = FALSE,
  target = c("default", "lines", "script")
)

selection_matches(
  pattern,
  n_min = 1L,
  n_max = Inf,
  target = c("default", "lines", "script"),
  ...
)

selection_inherits(class)

selection_is_function()

selection_is_data_frame()

selection_is_syntactic_package_name()

selection_is_installed_package()

selection_is_cran_package()

selection_is_in_rmd_chunk()

selection_is_in_rmd_text()

Arguments

target

If target is "lines" the selection is extended to lines, if it is "script" it is extended to the full script

n

number of lines

multi_ok

Are multiple calls eligible ?

single_ok

Are single calls eligible ?

symbol_ok

Are symbols eligible ?

empty_ok

whether an empty section qualifies

simple_only

if TRUE, only symbols and calls to ::, :::, [, [[ or $ are considered. It should be used on condition calls to make sure we never evaluate a call that would have side effects.

type

atomic type

litteral_ok

Are literal strings or numbers eligible ?

reserved_ok

Are reserved words eligible ?

pattern

regular expression

n_min

minimal number of occurences to validate match

n_max

maximal number of occurences to validate match

...

additional arguments passed to regexpr()

class

class used to check inheritance


moodymudskipper/poof documentation built on Dec. 10, 2024, 12:07 a.m.