Skip to content

Commit

Permalink
C/CPP/Julia: Print Escape Sequences Correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
gptsarthak committed Feb 4, 2023
1 parent acd593e commit 8068d3c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/libasr/codegen/asr_to_c_cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -836,9 +836,9 @@ R"(#include <stdio.h>
if (s[idx] == '\n') {
src += "\\n";
} else if (s[idx] == '\\') {
src += "\\\\";
src += "\\";
} else if (s[idx] == '\"') {
src += "\\\"";
src += "\"";
} else {
src += s[idx];
}
Expand Down
4 changes: 2 additions & 2 deletions src/libasr/codegen/asr_to_julia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1422,9 +1422,9 @@ class ASRToJuliaVisitor : public ASR::BaseVisitor<ASRToJuliaVisitor>
if (s[idx] == '\n') {
src += "\\n";
} else if (s[idx] == '\\') {
src += "\\\\";
src += "\\";
} else if (s[idx] == '\"') {
src += "\\\"";
src += "\"";
} else {
src += s[idx];
}
Expand Down

0 comments on commit 8068d3c

Please sign in to comment.