Fix handling of quotes and backslashes in property sheet values
This commit is contained in:
parent
e343c83446
commit
4055a29aa9
2 changed files with 5 additions and 7 deletions
|
|
@ -63,11 +63,9 @@ class CodeGenerator {
|
|||
for (const auto &pair : property_set) {
|
||||
if (!first) add(",");
|
||||
first = false;
|
||||
add("\"");
|
||||
add(pair.first);
|
||||
add("\":\"");
|
||||
add(pair.second);
|
||||
add("\"");
|
||||
add_string(pair.first);
|
||||
add(":");
|
||||
add_string(pair.second);
|
||||
}
|
||||
add("}");
|
||||
}
|
||||
|
|
@ -94,7 +92,7 @@ class CodeGenerator {
|
|||
void add_string(const string &s) {
|
||||
add("\"");
|
||||
for (const char c : s) {
|
||||
if (c == '"') add("\\");
|
||||
if (c == '"' || c == '\\') add("\\");
|
||||
add(c);
|
||||
}
|
||||
add("\"");
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ pair<SyntaxGrammar, CompileError> flatten_grammar(const InitialSyntaxGrammar &gr
|
|||
}
|
||||
|
||||
result.word_token = grammar.word_token;
|
||||
|
||||
|
||||
return {result, CompileError::none()};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue