X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/9561f209ba7d08b95e2bd3b86b6338bd2537ea55..9cad30fab188a57c3db8df0912a1691099468e64:/Output.cpp diff --git a/Output.cpp b/Output.cpp index 9ffc4f6..04f893c 100644 --- a/Output.cpp +++ b/Output.cpp @@ -85,14 +85,24 @@ CYOutput &CYOutput::operator <<(char rhs) { for (unsigned i(0); i != indent_; ++i) out_ << " "; else goto done; - else goto work; + else if (rhs == '\r') { + if (right_) { + out_ << '\n'; + right_ = false; + goto mode; + } + } else goto work; + right_ = true; + mode: mode_ = NoMode; goto done; work: - if (mode_ == Terminated && rhs != '}') + if (mode_ == Terminated && rhs != '}') { + right_ = true; out_ << ';'; + } if (rhs == ';') { if (pretty_) @@ -116,6 +126,7 @@ CYOutput &CYOutput::operator <<(char rhs) { } else none: mode_ = NoMode; + right_ = true; out_ << rhs; done: return *this; @@ -141,6 +152,7 @@ CYOutput &CYOutput::operator <<(const char *rhs) { else mode_ = NoMode; + right_ = true; out_ << rhs; return *this; } @@ -222,6 +234,12 @@ void Catch::Output(CYOutput &out) const { } } +void CYComment::Output(CYOutput &out, CYFlags flags) const { + out << '\r'; + out << value_; + out << '\r'; +} + void CYCompound::Output(CYOutput &out, CYFlags flags) const { if (CYExpression *expression = expressions_) if (CYExpression *next = expression->next_) {