Skip to content

Commit dbe8e3b

Browse files
committed
Pickle: Escape str when printing tokens
1 parent 77ddb4a commit dbe8e3b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lpython/parser/tokenizer.re

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ std::string pickle_token(int token, const YYSTYPE &yystype)
825825
} else if (token == yytokentype::TK_IMAG_NUM) {
826826
t += " " + std::to_string(yystype.f) + "j";
827827
} else if (token == yytokentype::TK_STRING) {
828-
t = t + " " + "\"" + yystype.string.str() + "\"";
828+
t = t + " " + "\"" + str_escape_c(yystype.string.str()) + "\"";
829829
} else if (token == yytokentype::TK_TYPE_COMMENT) {
830830
t = t + " " + "\"" + yystype.string.str() + "\"";
831831
} else if (token == yytokentype::TK_TYPE_IGNORE) {

0 commit comments

Comments
 (0)