"[" L C return tk::OpenBracket;
"]" L C return tk::CloseBracket;
+@begin Java
+"@class" L C return tk::AtClass;
+@end
+
@begin ObjectiveC
-"@class" L C return tk::AtClass;
-"@end" L C return tk::AtEnd;
-"@selector" L C return tk::AtSelector;
+"@end" L C return tk::AtEnd;
+"@implementation" L C return tk::AtImplementation;
+"@import" L C return tk::AtImport;
+"@selector" L C return tk::AtSelector;
@end
"false" L C yylval->false_ = new(yyextra->pool_) CYFalse(); return tk::False;
%token OpenBracket "["
%token CloseBracket "]"
+@begin Java
%token AtClass "@class"
-%token AtSelector "@selector"
+@end
+
+@begin ObjectiveC
+%token AtImplementation "@implementation"
+%token AtImport "@import"
%token AtEnd "@end"
+%token AtSelector "@selector"
+@end
%token <false_> False "false"
%token <null_> Null "null"
| { $$ = NULL; }
;
+ClassField
+ : Expression Identifier ";"
+ ;
+
+ClassFieldListOpt
+ : ClassFieldListOpt ClassField
+ |
+ ;
+
ClassFieldList
- : Brace "}" { $$ = NULL; }
+ : Brace ClassFieldListOpt "}" { $$ = NULL; }
;
MessageScope
TypeOpt
: "(" Expression ")" { $$ = $2; }
+ | "(" LexSetRegExp "void" ")" { $$ = NULL; }
| { $$ = NULL; }
;
ClassMessageDeclarationListOpt
: ClassMessageDeclarationListOpt ClassMessageDeclaration { $2->SetNext($1); $$ = $2; }
+ | ClassMessageDeclarationListOpt Comment { $$ = $1; }
| { $$ = NULL; }
;
;
ClassExpression
- : "@class" ClassNameOpt ClassSuperOpt ClassProtocolListOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassExpression($2, $3, $4, $5, $6); }
+ : "@implementation" ClassNameOpt ClassSuperOpt ClassProtocolListOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassExpression($2, $3, $4, $5, $6); }
;
ClassStatement
- : "@class" ClassName ClassSuperOpt ClassProtocolListOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassStatement($2, $3, $4, $5, $6); }
+ : "@implementation" ClassName ClassSuperOpt ClassProtocolListOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassStatement($2, $3, $4, $5, $6); }
+ ;
+
+CategoryName
+ : "(" Word ")"
;
CategoryStatement
- : "@class" ClassName ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYCategory($2, $3); }
+ : "@implementation" ClassName CategoryName ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYCategory($2, $4); }
;
PrimaryExpressionBF
| "@selector" "(" SelectorExpression ")" { $$ = new(driver.pool_) CYSelector($3); }
;
/* }}} */
+/* Cycript (Objective-C): @import Directive {{{ */
+PathName
+ : "/" PathName
+ | "." PathName
+ | Word PathName
+ |
+ ;
+
+ImportPath
+ : "<" PathName ">"
+ | StringLiteral
+ ;
+
+SourceElement_
+ : "@import" ImportPath { $$ = new(driver.pool_) CYImport(); }
+ ;
+/* }}} */
@end
@begin C