Skip to content

Commit

Permalink
Merge pull request #61 from jhorzek/curly_comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jhorzek authored Mar 9, 2024
2 parents 0bcdd97 + b754719 commit 4a1e1a7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: mxsem
Type: Package
Title: Specify 'OpenMx' Models with a 'lavaan'-Style Syntax
Version: 0.0.8
Version: 0.0.9
Date: 2023-10-03
Authors@R: c(person(given = "Jannik H.", family = "Orzek",
role = c("aut", "cre", "cph"),
Expand Down
4 changes: 4 additions & 0 deletions src/clean_syntax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ std::vector<std::string> clean_syntax(const std::string& syntax) {
// check for curly braces:
switch(c){
case '{':
if(is_comment)
break;
n_curly_open++;
break;
case '}':
if(is_comment)
break;
n_curly_open--;
if(n_curly_open < 0){
Rcpp::stop("Error parsing the syntax: Found a closing curly brace } without an opening curly brance {. The last line was " +
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-clean-syntax.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ test_that("cleaning syntax works", {
dem60 ~ ind60
dem65 ~ ind60 + dem60
# {commented algebra}
#no space after comment
# residual correlations
y1 ~~ y5
y2 ~~ y4 + y6; y3 ~
Expand Down

0 comments on commit 4a1e1a7

Please sign in to comment.