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 done;
+ } else goto work;
+
+ right_ = true;
mode_ = NoMode;
goto done;
work:
- if (mode_ == Terminated && rhs != '}')
+ if (mode_ == Terminated && rhs != '}') {
+ right_ = true;
out_ << ';';
+ }
if (rhs == ';') {
if (pretty_)
} else none:
mode_ = NoMode;
+ right_ = true;
out_ << rhs;
done:
return *this;
else
mode_ = NoMode;
+ right_ = true;
out_ << rhs;
return *this;
}
} }
+void CYComment::Output(CYOutput &out, CYFlags flags) const {
+ out << '\r';
+ out.out_ << value_;
+ out.right_ = true;
+ out << '\r';
+}
+
void CYCompound::Output(CYOutput &out, CYFlags flags) const {
if (CYExpression *expression = expressions_)
if (CYExpression *next = expression->next_) {
}
const char *CYDeclaration::ForEachIn() const {
- return identifier_->Value();
+ return identifier_->Word();
}
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));
void CYForIn::Output(CYOutput &out, CYFlags flags) const {
out << "for" << ' ' << '(';
- initialiser_->ForIn(out, CYNoIn);
+ if (initialiser_ != NULL)
+ initialiser_->ForIn(out, CYNoIn);
out << "in" << *set_ << ')';
code_->Single(out, CYRight(flags));
}
out << ',' << ' ' << *next_;
}
+const char *CYIdentifier::Word() const {
+ return replace_ == NULL || replace_ == this ? CYWord::Word() : replace_->Word();
+}
+
void CYIf::Output(CYOutput &out, CYFlags flags) const {
bool protect(false);
if (false_ == NULL && (flags & CYNoDangle) != 0) {
"let", "yield",
- "each",
-
NULL
};
void CYWord::ClassName(CYOutput &out, bool object) const {
if (object)
out << "objc_getClass(";
- out << '"' << Value() << '"';
+ out << '"' << Word() << '"';
if (object)
out << ')';
}
void CYWord::Output(CYOutput &out) const {
- out << Value();
+ out << Word();
+ if (out.options_.verbose_)
+ out.out_ << '@' << this;
}
void CYWord::PropertyName(CYOutput &out) const {
Output(out);
}
+
+const char *CYWord::Word() const {
+ return word_;
+}