Skip to main content

parse_top_level_fn_def_name

Function parse_top_level_fn_def_name 

Source
fn parse_top_level_fn_def_name(line: &str) -> Option<&str>
Expand description

Parse the function name from a top-level name <- function(...) definition line, or return None when the line is not such a definition.

Recognises only top-level definitions: the line must start at column 0 (no leading whitespace – indented forms are R6/S7 closures, not standalone wrappers) and the left-hand side must be a single bare R identifier. Lines where the LHS is a call (e.g. S7::method(...) <- function) or contains $ / [[ / :: are not bare definitions and are skipped.