X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/bce8339b629582dd04df0570468ac746adc0fcf7..e5bc40dbf98979310a3c9fd5d552c710b24d6762:/Cycript.y diff --git a/Cycript.y b/Cycript.y index a82e7f8..9a3480d 100644 --- a/Cycript.y +++ b/Cycript.y @@ -56,6 +56,7 @@ typedef struct { CYBoolean *boolean_; CYClause *clause_; CYCatch *catch_; + CYClassName *className_; CYCompound *compound_; CYDeclaration *declaration_; CYDeclarations *declarations_; @@ -70,10 +71,10 @@ typedef struct { CYLiteral *literal_; CYMessage *message_; CYMessageParameter *messageParameter_; - CYName *name_; CYNull *null_; CYNumber *number_; CYProperty *property_; + CYPropertyName *propertyName_; CYSelectorPart *selector_; CYSource *source_; CYStatement *statement_; @@ -264,6 +265,7 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %type ClassDeclaration %type ClassMessageDeclaration %type ClassMessageDeclarationListOpt +%type ClassName %type ClassSuperOpt %type ClassFieldList %type ConditionalExpression @@ -338,7 +340,7 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %type PrimaryExpression_ %type PrimaryExpressionNoBF %type Program -%type PropertyName +%type PropertyName %type PropertyNameAndValueList %type PropertyNameAndValueList_ %type PropertyNameAndValueListOpt @@ -1227,8 +1229,14 @@ ClassMessageDeclarationListOpt | { $$ = NULL; } ; +ClassName + : Identifier { $$ = $1; } + | "(" AssignmentExpression ")" { $$ = $2; } + ; + ClassDeclaration : "@class" Identifier ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new CYClass($2, $3, $4, $5); } + | "@class" ClassName ClassMessageDeclarationListOpt "@end" { $$ = new CYCategory($2, $3); } ; SourceElement