)
out_ << ' ';
- if (WordEndRange_[rhs[size - 1]])
+ char last(rhs[size - 1]);
+ if (WordEndRange_[last] || last == '/')
mode_ = NoLetter;
else
mode_ = NoMode;
rhs_->Output(out, Precedence(), CYRight(flags));
}
-void CYBlock::Output(CYOutput &out) const {
+void CYBlock::Output(CYOutput &out, CYFlags flags) const {
out << '{' << '\n';
++out.indent_;
- if (statements_ != NULL)
- statements_->Multiple(out);
+ out << code_;
--out.indent_;
out << '\t' << '}';
}
-void CYBlock::Output(CYOutput &out, CYFlags flags) const {
- if (statements_ == NULL)
- out.Terminate();
- else if (statements_->next_ == NULL)
- statements_->Single(out, flags);
- else
- Output(out);
-}
-
void CYBoolean::Output(CYOutput &out, CYFlags flags) const {
out << (Value() ? "true" : "false");
}
namespace Syntax {
void Catch::Output(CYOutput &out) const {
- out << ' ' << "catch" << ' ' << '(' << *name_ << ')' << ' ' << code_;
+ out << ' ' << "catch" << ' ' << '(' << *name_ << ')' << ' ';
+ out << '{' << '\n';
+ ++out.indent_;
+ out << code_;
+ --out.indent_;
+ out << '\t' << '}';
}
} }
else
out << "default";
out << ':' << '\n';
- if (statements_ != NULL)
- statements_->Multiple(out);
+ out << code_;
out << next_;
}
void CYForDeclarations::Output(CYOutput &out, CYFlags flags) const {
out << "var";
- Output(out, CYRight(flags));
+ declarations_->Output(out, CYRight(flags));
}
void CYDeclarations::Output(CYOutput &out) const {
}
void CYFatArrow::Output(CYOutput &out, CYFlags flags) const {
- out << '(' << parameters_ << ')' << ' ' << "=>" << ' ' << code_;
+ out << '(' << parameters_ << ')' << ' ' << "=>" << ' ' << '{' << code_ << '}';
}
void CYFinally::Output(CYOutput &out) const {
- out << ' ' << "finally" << ' ' << code_;
+ out << ' ' << "finally" << ' ';
+ out << '{' << '\n';
+ ++out.indent_;
+ out << code_;
+ --out.indent_;
+ out << '\t' << '}';
}
void CYFor::Output(CYOutput &out, CYFlags flags) const {
out << "function";
if (name_ != NULL)
out << ' ' << *name_;
- out << '(' << parameters_ << ')';
- out << ' ' << code_;
+ out << '(' << parameters_ << ')' << ' ';
+ out << '{' << '\n';
+ ++out.indent_;
+ out << code_;
+ --out.indent_;
+ out << '\t' << '}';
if (protect)
out << ')';
}
statement_->Single(out, CYRight(flags));
}
+void CYParenthetical::Output(CYOutput &out, CYFlags flags) const {
+ out << '(';
+ expression_->Output(out, CYCompound::Precedence_, CYNoFlags);
+ out << ')';
+}
+
+void CYStatement::Output(CYOutput &out) const {
+ Multiple(out);
+}
+
void CYTypeArrayOf::Output(CYOutput &out, CYIdentifier *identifier) const {
next_->Output(out, Precedence(), identifier);
out << '[';
}
void CYProgram::Output(CYOutput &out) const {
- if (statements_ != NULL)
- statements_->Multiple(out);
+ out << code_;
}
void CYProperty::Output(CYOutput &out) const {
void CYRubyProc::Output(CYOutput &out, CYFlags flags) const {
// XXX: this is not outputting the parameters
+ out << '{' << '\n';
+ ++out.indent_;
out << code_;
+ --out.indent_;
+ out << '\t' << '}';
}
void CYStatement::Multiple(CYOutput &out, CYFlags flags) const {
}
void Try::Output(CYOutput &out, CYFlags flags) const {
- out << "try" << ' ' << code_ << catch_ << finally_;
+ out << "try" << ' ';
+ out << '{' << '\n';
+ ++out.indent_;
+ out << code_;
+ --out.indent_;
+ out << '\t' << '}';
+ out << catch_ << finally_;
}
} }