]> git.saurik.com Git - cycript.git/blobdiff - Output.cpp
The grammar and lexer should not share a filename.
[cycript.git] / Output.cpp
index 95d2f19ee51512cca7d5c5b477872f3f327469e7..c8205e5c05ebd106b1f222d0abbe876741d0395c 100644 (file)
 /* }}} */
 
 #include "cycript.hpp"
-#include "Parser.hpp"
 
 #include <sstream>
 
+#include "Syntax.hpp"
+
 void CYOutput::Terminate() {
     operator ()(';');
     mode_ = NoMode;
@@ -183,13 +184,6 @@ void Catch::Output(CYOutput &out) const {
 
 } }
 
-void CYComment::Output(CYOutput &out, CYFlags flags) const {
-    out << '\r';
-    out(value_);
-    out.right_ = true;
-    out << '\r';
-}
-
 void CYCompound::Output(CYOutput &out, CYFlags flags) const {
     if (next_ == NULL)
         expression_->Output(out, flags);
@@ -298,12 +292,16 @@ void CYDoWhile::Output(CYOutput &out, CYFlags flags) const {
     out << "while" << ' ' << '(' << *test_ << ')';
 }
 
-void CYElement::Output(CYOutput &out) const {
+void CYElementSpread::Output(CYOutput &out) const {
+    out << "..." << value_;
+}
+
+void CYElementValue::Output(CYOutput &out) const {
     if (value_ != NULL)
         value_->Output(out, CYAssign::Precedence_, CYNoFlags);
     if (next_ != NULL || value_ == NULL) {
         out << ',';
-        if (next_ != NULL && next_->value_ != NULL)
+        if (next_ != NULL && !next_->Elision())
             out << ' ';
     }
     if (next_ != NULL)
@@ -510,6 +508,10 @@ void CYStatement::Output(CYOutput &out) const {
     Multiple(out);
 }
 
+void CYTemplate::Output(CYOutput &out, CYFlags flags) const {
+    _assert(false);
+}
+
 void CYTypeArrayOf::Output(CYOutput &out, CYIdentifier *identifier) const {
     next_->Output(out, Precedence(), identifier);
     out << '[';