- Output(out);
-}
-
-void CYSwitch::Output(std::ostream &out) const {
- out << "switch(";
- value_->Output(out, CYNoFlags);
- out << "){";
- if (clauses_ != NULL)
- out << *clauses_;
+ out << *this;
+}
+
+const char *CYString::Word() const {
+ if (size_ == 0 || !WordStartRange_[value_[0]])
+ return NULL;
+ for (size_t i(1); i != size_; ++i)
+ if (!WordEndRange_[value_[i]])
+ return NULL;
+ const char *value(Value());
+ // XXX: we should probably include the full ECMAScript3+5 list.
+ static const char *reserveds[] = {"class", "const", "enum", "export", "extends", "import", "super", NULL};
+ for (const char **reserved(reserveds); *reserved != NULL; ++reserved)
+ if (strcmp(*reserved, value) == 0)
+ return NULL;
+ return value;
+}
+
+void CYSwitch::Output(CYOutput &out, CYFlags flags) const {
+ out << "switch" << ' ' << '(' << *value_ << ')' << ' ' << '{';
+ out << clauses_;