Skip to content

Commit

Permalink
Merge pull request #1115 from sbfnk/develop
Browse files Browse the repository at this point in the history
Catch last space in regex in `expose_stan_functions`
  • Loading branch information
andrjohns committed Feb 9, 2024
2 parents c44402a + 0d5d50f commit 50c3c6f
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 50c3c6f

Please sign in to comment.