Skip to content

Commit

Permalink
ignore all spacing in regex for lp_accum functions
Browse files Browse the repository at this point in the history
  • Loading branch information
sbfnk committed Oct 5, 2023
1 parent a6dd8d1 commit f74cc08
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\\* pstream__ = (nullptr|0))(\\s*)?\\{",
code <- gsub("stan::math::accumulator<double>& 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 f74cc08

Please sign in to comment.