]> git.saurik.com Git - cycript.git/blobdiff - Output.cpp
Let's at least parse Objective-J.
[cycript.git] / Output.cpp
index 27ea3fcff21b87fbd7a4e537bdfb1546f51e4111..c6686587eb87345dedb17cbca06b77f078a20863 100644 (file)
@@ -89,12 +89,10 @@ CYOutput &CYOutput::operator <<(char rhs) {
         if (right_) {
             out_ << '\n';
             right_ = false;
-            goto mode;
-        }
+        } goto done;
     } else goto work;
 
     right_ = true;
-  mode:
     mode_ = NoMode;
     goto done;
 
@@ -236,7 +234,8 @@ void Catch::Output(CYOutput &out) const {
 
 void CYComment::Output(CYOutput &out, CYFlags flags) const {
     out << '\r';
-    out << value_;
+    out.out_ << value_;
+    out.right_ = true;
     out << '\r';
 }
 
@@ -294,6 +293,7 @@ void CYDeclaration::ForIn(CYOutput &out, CYFlags flags) const {
 
 void CYDeclaration::Output(CYOutput &out, CYFlags flags) const {
     out << *identifier_;
+    //out.out_ << ':' << identifier_->usage_ << '#' << identifier_->offset_;
     if (initialiser_ != NULL) {
         out << ' ' << '=' << ' ';
         initialiser_->Output(out, CYPA, CYRight(flags));
@@ -326,7 +326,7 @@ void CYDeclarations::Output(CYOutput &out, CYFlags flags) const {
 }
 
 void CYDirectMember::Output(CYOutput &out, CYFlags flags) const {
-    object_->Output(out, Precedence(), CYLeft(flags));
+    object_->Output(out, Precedence(), CYLeft(flags) | CYNoInteger);
     if (const char *word = property_->Word())
         out << '.' << word;
     else
@@ -352,7 +352,6 @@ void CYElement::Output(CYOutput &out) const {
 }
 
 void CYEmpty::Output(CYOutput &out, CYFlags flags) const {
-    out << '`';
     out.Terminate();
 }
 
@@ -433,8 +432,6 @@ void CYFunction::Output(CYOutput &out, CYFlags flags) const {
     if (protect)
         out << '(';
     out << "function";
-    if (out.options_.verbose_)
-        out.out_ << ':' << static_cast<const CYScope *>(this);
     if (name_ != NULL)
         out << ' ' << *name_;
     out << '(' << parameters_ << ')';
@@ -563,6 +560,13 @@ void CYObject::Output(CYOutput &out, CYFlags flags) const {
         out << ')';
 }
 
+void CYOptionalFunctionParameter::Output(CYOutput &out) const {
+    out << *name_ << '=';
+    initializer_->Output(out, CYPA, CYNoFlags);
+    if (next_ != NULL)
+        out << ',' << ' ' << *next_;
+}
+
 void CYPostfix::Output(CYOutput &out, CYFlags flags) const {
     lhs_->Output(out, Precedence(), CYLeft(flags));
     out << Operator();
@@ -603,6 +607,17 @@ void CYReturn::Output(CYOutput &out, CYFlags flags) const {
     out << ';';
 }
 
+void CYRubyBlock::Output(CYOutput &out, CYFlags flags) const {
+    call_->Output(out, CYLeft(flags));
+    out << ' ';
+    proc_->Output(out, CYRight(flags));
+}
+
+void CYRubyProc::Output(CYOutput &out, CYFlags flags) const {
+    // XXX: this is not outputting the parameters
+    out << code_;
+}
+
 void CYStatement::Multiple(CYOutput &out, CYFlags flags) const {
     bool first(true);
     for (const CYStatement *next(this); next != NULL; next = next->next_) {
@@ -657,8 +672,6 @@ static const char *Reserved_[] = {
 
     "let", "yield",
 
-    "each",
-
     NULL
 };