X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/457afcc98a03ef56c699cff9f468813567f10182..e7ed5354ae029d47ace1bc152aa5686f495e5737:/Cycript.y diff --git a/Cycript.y b/Cycript.y index 8d5c257..b7e17eb 100644 --- a/Cycript.y +++ b/Cycript.y @@ -29,6 +29,7 @@ typedef struct { CYNumber *number_; CYParameter *parameter_; CYProperty *property_; + CYSelector *selector_; CYSource *source_; CYStatement *statement_; CYString *string_; @@ -118,6 +119,8 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %token OpenBracket "[" %token CloseBracket "]" +%token AtSelector "@selector" + %token Break "break" %token Case "case" %token Catch "catch" @@ -253,6 +256,9 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %type RelationalExpressionNoBF %type RelationalExpressionNoIn %type ReturnStatement +%type SelectorExpression +%type SelectorExpression_ +%type SelectorExpressionOpt %type ShiftExpression %type ShiftExpressionNoBF %type SourceElement @@ -1063,8 +1069,23 @@ MessageExpression : "[" AssignmentExpression SelectorList "]" { $$ = new(driver.pool_) CYMessage($2, $3); } ; +SelectorExpressionOpt + : SelectorExpression_ { $$ = $1; } + | { $$ = NULL; } + ; + +SelectorExpression_ + : WordOpt ":" SelectorExpressionOpt { $$ = new CYSelector($1, true, $3); } + ; + +SelectorExpression + : SelectorExpression_ { $$ = $1; } + | Word { $$ = new CYSelector($1, false, NULL); } + ; + PrimaryExpression_ : MessageExpression { $$ = $1; } + | "@selector" "(" SelectorExpression ")" { $$ = $3; } ; /* }}} */