<RegExp>\/{RegularExpressionBody}\/{RegularExpressionFlags} E("")
\/\/[^\n]* L
+\/\*!(\n|[^\*]|\*[^/])*\*\/ V() C yylval->comment_ = new(yyextra->pool_) CYComment(apr_pstrmemdup(yyextra->pool_, yytext, yyleng)); return tk::Comment;
\/\*(\n|[^\*]|\*[^/])*\*\/ V(N)
@begin E4X
CYBoolean *boolean_;
CYClause *clause_;
cy::Syntax::Catch *catch_;
+ CYComment *comment_;
CYComprehension *comprehension_;
CYCompound *compound_;
CYDeclaration *declaration_;
%token SemiColon ";"
%token NewLine "\n"
+%token <comment_> Comment
+
%token OpenParen "("
%token CloseParen ")"
/* }}} */
@end
+/* YUI: Documentation Comments {{{ */
+Statement_
+ : Comment { $$ = $1; }
+ ;
+/* }}} */
+
@begin E4X
/* Lexer State {{{ */
LexPushRegExp
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 mode;
+ }
+ } else goto work;
+ right_ = true;
+ mode:
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 << value_;
+ out << '\r';
+}
+
void CYCompound::Output(CYOutput &out, CYFlags flags) const {
if (CYExpression *expression = expressions_)
if (CYExpression *next = expression->next_) {
std::ostream &out_;
bool pretty_;
unsigned indent_;
+ bool right_;
enum {
NoMode,
out_(out),
pretty_(false),
indent_(0),
+ right_(false),
mode_(NoMode)
{
}
}
};
+struct CYComment :
+ CYStatement
+{
+ const char *value_;
+
+ CYComment(const char *value) :
+ value_(value)
+ {
+ }
+
+ virtual CYStatement *Replace(CYContext &context);
+ virtual void Output(CYOutput &out, CYFlags flags) const;
+};
+
struct CYLabel :
CYStatement
{
next_->Replace(context);
}
+CYStatement *CYComment::Replace(CYContext &context) {
+ return NULL;
+}
+
CYExpression *CYCompound::Replace(CYContext &context) {
expressions_ = expressions_->ReplaceAll(context);
return NULL;