Skip to content

Commit

Permalink
wren_core.wren.inc backslash characters escaped (#1023)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThakeeNathees authored May 21, 2021
1 parent 9903ddf commit d78f481
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/vm/wren_core.wren
Original file line number Diff line number Diff line change
Expand Up @@ -480,4 +480,4 @@ class ClassAttributes {
_methods = methods
}
toString { "attributes:%(_attributes) methods:%(_methods)" }
}
}
13 changes: 6 additions & 7 deletions src/vm/wren_core.wren.inc
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,11 @@ static const char* coreModuleSource =
" return result\n"
" }\n"
"\n"
" trim() { trim_(\"\t\r\n \", true, true) }\n"
" trim() { trim_(\"\\t\\r\\n \", true, true) }\n"
" trim(chars) { trim_(chars, true, true) }\n"
" trimEnd() { trim_(\"\t\r\n \", false, true) }\n"
" trimEnd() { trim_(\"\\t\\r\\n \", false, true) }\n"
" trimEnd(chars) { trim_(chars, false, true) }\n"
" trimStart() { trim_(\"\t\r\n \", true, false) }\n"
" trimStart() { trim_(\"\\t\\r\\n \", true, false) }\n"
" trimStart(chars) { trim_(chars, true, false) }\n"
"\n"
" trim_(chars, trimStart, trimEnd) {\n"
Expand Down Expand Up @@ -441,18 +441,18 @@ static const char* coreModuleSource =
"\n"
"class System {\n"
" static print() {\n"
" writeString_(\"\n\")\n"
" writeString_(\"\\n\")\n"
" }\n"
"\n"
" static print(obj) {\n"
" writeObject_(obj)\n"
" writeString_(\"\n\")\n"
" writeString_(\"\\n\")\n"
" return obj\n"
" }\n"
"\n"
" static printAll(sequence) {\n"
" for (object in sequence) writeObject_(object)\n"
" writeString_(\"\n\")\n"
" writeString_(\"\\n\")\n"
" }\n"
"\n"
" static write(obj) {\n"
Expand Down Expand Up @@ -483,4 +483,3 @@ static const char* coreModuleSource =
" }\n"
" toString { \"attributes:%(_attributes) methods:%(_methods)\" }\n"
"}\n";

1 change: 1 addition & 0 deletions util/wren_to_c_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
def wren_to_c_string(input_path, wren_source_lines, module):
wren_source = ""
for line in wren_source_lines:
line = line.replace("\\", "\\\\")
line = line.replace('"', "\\\"")
line = line.replace("\n", "\\n\"")
if wren_source: wren_source += "\n"
Expand Down

0 comments on commit d78f481

Please sign in to comment.