Skip to content

Commit

Permalink
generalise last space in regex for exposing funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
sbfnk committed Feb 8, 2024
1 parent 277167c commit 0d5d50f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rstan/rstan/R/expose_stan_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ expose_stan_functions_hacks <- function(code, includes = NULL) {
code, sep = "\n")
code <- gsub("// [[stan::function]]",
"// [[Rcpp::export]]", code, fixed = TRUE)
code <- gsub("stan::math::accumulator<double>& lp_accum__,(\\n)?(\\s*)?std::ostream\\*(\\n)?(\\s*)?pstream__(\\n)?(\\s*)?=(\\n)?\\s*)?(nullptr|0))(\\s*)?\\{",
code <- gsub("stan::math::accumulator<double>&(\\s*)?lp_accum__,(\\n)?(\\s*)?std::ostream\\*(\\n)?(\\s*)?pstream__(\\n)?(\\s*)?=(\\n)?\\s*)?(nullptr|0))(\\s*)?\\{",
"std::ostream* pstream__ = nullptr){\nstan::math::accumulator<double> lp_accum__;",
code)
code <- gsub("pstream__(\\s*|)=(\\s*|)nullptr", "pstream__ = 0", code)
Expand Down

0 comments on commit 0d5d50f

Please sign in to comment.