Skip to main content

split_r_formals

Function split_r_formals 

Source
pub(crate) fn split_r_formals(formals: &str) -> Vec<&str>
Expand description

Split an R formals/argument string on top-level commas only.

Commas nested inside parentheses, brackets, or braces — or inside a single- or double-quoted string literal — are ignored. So x, mode = c("a", "b"), ... yields ["x", "mode = c(\"a\", \"b\")", "..."], whereas a naive split(", ") wrongly breaks the c("a", "b") default into two bogus formals (mode = c("a" and "b")) — the source of spurious @param "b") roxygen entries on match_arg’d trait-method shortcuts (ScalerS7 / ScalerR6).