fix handling of $ in strings ChaiScript#553

This commit is contained in:
Bernd Amend 2021-05-23 12:03:44 +02:00
parent 55ec76fd39
commit a4fd5371bd
2 changed files with 8 additions and 0 deletions

View File

@ -1369,6 +1369,10 @@ namespace chaiscript
} }
} }
if (cparser.saw_interpolation_marker) {
match.push_back('$');
}
return cparser.is_interpolated; return cparser.is_interpolated;
}(); }();

View File

@ -2,3 +2,7 @@ assert_equal("\$ {4 + 5}", "$ {4 + 5}")
assert_equal("\$9", "$${4+5}") assert_equal("\$9", "$${4+5}")
assert_equal("Value: \${4 + 5}", "Value: \${4 + 5}") assert_equal("Value: \${4 + 5}", "Value: \${4 + 5}")
assert_equal("Value: \$9", "Value: \$${4 + 5}") assert_equal("Value: \$9", "Value: \$${4 + 5}")
assert_equal("\$code\$", "$code$")
assert_equal("\$\$", "$$")
assert_equal("\$", "$")
assert_equal("\${", "\${") // ensure this doesn't fail