: "^" ModifiedType "(" LexPushInOff TypedParameterListOpt ")" LexPopIn BRACE LexPushInOff FunctionBody "}" LexPopIn { $$ = CYNew CYObjCBlock($2, $5, $10); }
;
/* }}} */
+/* Cycript (Objective-C): Instance Literals {{{ */
+PrimaryExpression
+ : "#" NumericLiteral { $$ = CYNew CYInstanceLiteral($2); }
+ ;
+/* }}} */
@end
@begin C
out << "@import";
}
+void CYInstanceLiteral::Output(CYOutput &out, CYFlags flags) const {
+ out << '#';
+ number_->Output(out, CYRight(flags));
+}
+
void CYMessage::Output(CYOutput &out, bool replace) const {
out << (instance_ ? '-' : '+');
return $ CYVar($L1($L(module_->part_->Word(), $C1($V("require"), module_->Replace(context, "/")))));
}
+CYExpression *CYInstanceLiteral::Replace(CYContext &context) {
+ return $N1($V("Instance"), number_);
+}
+
CYStatement *CYMessage::Replace(CYContext &context, bool replace) const { $T(NULL)
CYVariable *cyn($V("$cyn"));
CYVariable *cyt($V("$cyt"));
#include "Parser.hpp"
+struct CYInstanceLiteral :
+ CYExpression
+{
+ CYNumber *number_;
+
+ CYInstanceLiteral(CYNumber *number) :
+ number_(number)
+ {
+ }
+
+ CYPrecedence(1)
+
+ virtual CYExpression *Replace(CYContext &context);
+ virtual void Output(CYOutput &out, CYFlags flags) const;
+};
+
struct CYObjCBlock :
CYExpression
{