X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/5999c31517bb72b55257d25f482edc566adec045..2b0ddce2b9c3e24fb95f78afaa88e326c61c3085:/Output.cpp diff --git a/Output.cpp b/Output.cpp index b45703f..647f47e 100644 --- a/Output.cpp +++ b/Output.cpp @@ -20,7 +20,7 @@ void CYArgument::Output(std::ostream &out, bool send) const { } if (next_ != NULL) { if (!send) - if (next_->name_ != NULL) + if (next_->name_ == NULL) out << ','; else out << ' '; @@ -28,6 +28,13 @@ void CYArgument::Output(std::ostream &out, bool send) const { } } +void CYArray::Output(std::ostream &out) const { + out << '['; + if (elements_ != NULL) + elements_->Output(out); + out << ']'; +} + void CYBoolean::Output(std::ostream &out) const { out << (Value() ? "true" : "false"); } @@ -107,21 +114,13 @@ void CYDoWhile::Output(std::ostream &out) const { out << "while" << *test_ << ';'; } -void CYElement::Output(std::ostream &out, bool raw) const { - if (!raw) - out << '['; +void CYElement::Output(std::ostream &out) const { if (value_ != NULL) value_->Output(out, true); - if (next_ != NULL) { + if (next_ != NULL || value_ == NULL) out << ','; - next_->Output(out, true); - } - if (!raw) - out << ']'; -} - -void CYElement::Output(std::ostream &out) const { - Output(out, false); + if (next_ != NULL) + next_->Output(out); } void CYEmpty::Output(std::ostream &out) const { @@ -249,6 +248,13 @@ void CYNumber::Output(std::ostream &out) const { out << Value(); } +void CYObject::Output(std::ostream &out) const { + out << '{'; + if (property_ != NULL) + property_->Output(out); + out << '}'; +} + void CYParameter::Output(std::ostream &out) const { out << *name_; if (next_ != NULL) { @@ -265,20 +271,12 @@ void CYPrefix::Output(std::ostream &out) const { out << Operator() << *rhs_; } -void CYProperty::Output(std::ostream &out, bool raw) const { - if (!raw) - out << '{'; +void CYProperty::Output(std::ostream &out) const { out << *name_ << ':' << *value_; if (next_ != NULL) { out << ','; - next_->Output(out, true); + next_->Output(out); } - if (!raw) - out << '}'; -} - -void CYProperty::Output(std::ostream &out) const { - Output(out, false); } void CYReturn::Output(std::ostream &out) const { @@ -288,9 +286,25 @@ void CYReturn::Output(std::ostream &out) const { out << ';'; } -void CYSource::Part(std::ostream &out) const { +void CYSelector::Output(std::ostream &out) const { + out << '"'; + if (name_ != NULL) + name_->Output(out); + out << '"'; +} + +void CYSelectorPart::Output(std::ostream &out) const { + if (name_ != NULL) + out << *name_; + if (value_) + out << ':'; + if (next_ != NULL) + next_->Output(out); +} + +void CYSource::Show(std::ostream &out) const { for (const CYSource *next(this); next != NULL; next = next->next_) - next->Output(out); + next->Output(out, false); } void CYSource::Output(std::ostream &out, bool block) const { @@ -298,7 +312,7 @@ void CYSource::Output(std::ostream &out, bool block) const { Output(out); else { out << '{'; - Part(out); + Show(out); out << '}'; } }