summaryrefslogtreecommitdiffstatshomepage
path: root/py/emitcpy.c
diff options
context:
space:
mode:
authorDamien <damien.p.george@gmail.com>2013-10-20 14:41:27 +0100
committerDamien <damien.p.george@gmail.com>2013-10-20 14:41:27 +0100
commita5185f4bc8f60fb2be82580e6f2d93fec53d0a33 (patch)
tree7864b4b9f64e87c5164f5b094c35601dc0a12743 /py/emitcpy.c
parent68f59a96e3cfda47a8c903c1eb8a64cf78ecea4f (diff)
downloadmicropython-a5185f4bc8f60fb2be82580e6f2d93fec53d0a33.tar.gz
micropython-a5185f4bc8f60fb2be82580e6f2d93fec53d0a33.zip
Abstract out back-end stream functionality from lexer.
Diffstat (limited to 'py/emitcpy.c')
-rw-r--r--py/emitcpy.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/py/emitcpy.c b/py/emitcpy.c
index 6e3543da31..089352c0fe 100644
--- a/py/emitcpy.c
+++ b/py/emitcpy.c
@@ -211,7 +211,6 @@ static void emit_cpy_load_const_verbatim_strn(emit_t *emit, const char *str, int
}
static void emit_cpy_load_const_verbatim_quoted_str(emit_t *emit, qstr qstr, bool bytes) {
- // TODO strings should be escaped before we get here
if (emit->pass == PASS_3) {
const char *str = qstr_str(qstr);
int len = strlen(str);
@@ -237,13 +236,8 @@ static void emit_cpy_load_const_verbatim_quoted_str(emit_t *emit, qstr qstr, boo
for (int i = 0; i < len; i++) {
if (str[i] == '\n') {
printf("\\n");
- } else if (str[i] == '\\' && str[i + 1] == '\'') {
- i += 1;
- if (quote_single) {
- printf("\\'");
- } else {
- printf("'");
- }
+ } else if (str[i] == '\\') {
+ printf("\\\\");
} else if (str[i] == '\'' && quote_single) {
printf("\\'");
} else {