X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/fd5cdf97150f0c0f2126d61f6e91511cc6b22936..fa3c5be836cc074bdc12ba66298764a1da026e48:/Cycript.yy.in?ds=sidebyside diff --git a/Cycript.yy.in b/Cycript.yy.in index 3a31f1e..0f16b6e 100644 --- a/Cycript.yy.in +++ b/Cycript.yy.in @@ -79,13 +79,19 @@ typedef struct { CYProperty *property_; CYPropertyName *propertyName_; CYRubyProc *rubyProc_; - CYTypeSpecifier *specifier_; CYStatement *statement_; CYString *string_; CYThis *this_; CYTrue *true_; CYWord *word_; +@begin C + CYTypeModifier *modifier_; + CYTypeSpecifier *specifier_; + CYTypedIdentifier *typedIdentifier_; + CYTypedParameter *typedParameter_; +@end + @begin ObjectiveC CYClassName *className_; CYField *field_; @@ -93,9 +99,6 @@ typedef struct { CYMessageParameter *messageParameter_; CYProtocol *protocol_; CYSelectorPart *selector_; - CYTypeModifier *modifier_; - CYTypedIdentifier *typedIdentifier_; - CYTypedParameter *typedParameter_; @end @begin E4X @@ -426,6 +429,7 @@ int cylex(YYSTYPE *, cy::location *, void *); %type MemberAccess %type MemberExpression_ %type MemberExpression +%type Module %type MultiplicativeExpression %type NewExpression %type NullLiteral @@ -472,8 +476,26 @@ int cylex(YYSTYPE *, cy::location *, void *); %type WordOpt %type Variable -@begin ObjectiveC +@begin C %type ArrayedType +%type EncodedType +%type FunctionedType +%type IntegerType +%type IntegerTypeOpt +%type PrefixedType +%type PrimitiveType +%type TypeParenthetical +%type TypeSignifier +%type SuffixedType +%type TypeQualifierLeft +%type TypeQualifierRight +%type TypedIdentifier +%type TypedParameterList_ +%type TypedParameterList +%type TypedParameterListOpt +@end + +@begin ObjectiveC %type BoxableExpression %type CategoryStatement %type ClassExpression @@ -488,10 +510,6 @@ int cylex(YYSTYPE *, cy::location *, void *); %type ClassProtocolListOpt %type ClassProtocols %type ClassProtocolsOpt -%type EncodedType -%type FunctionedType -%type IntegerType -%type IntegerTypeOpt %type MessageExpression %type MessageParameter %type MessageParameters @@ -499,9 +517,6 @@ int cylex(YYSTYPE *, cy::location *, void *); %type MessageParameterListOpt %type MessageScope %type ModifiedType -%type Module -%type PrefixedType -%type PrimitiveType %type SelectorCall_ %type SelectorCall %type SelectorExpression_ @@ -509,16 +524,7 @@ int cylex(YYSTYPE *, cy::location *, void *); %type SelectorExpressionOpt %type SelectorList %type SelectorWordOpt -%type SuffixedType %type TypeOpt -%type TypeParenthetical -%type TypeQualifierLeft -%type TypeQualifierRight -%type TypeSignifier -%type TypedIdentifier -%type TypedParameterList_ -%type TypedParameterList -%type TypedParameterListOpt %type VariadicCall @end @@ -705,6 +711,8 @@ Identifier | "typedef" { $$ = $1; } | "unsigned" { $$ = $1; } | "signed" { $$ = $1; } +@end +@begin ObjectiveC | "YES" { $$ = $1; } | "NO" { $$ = $1; } @end @@ -1394,8 +1402,8 @@ ProgramBodyOpt ; /* }}} */ -@begin ObjectiveC -/* Cycript (Objective-C): Type Encoding {{{ */ +@begin C +/* Cycript (C): Type Encoding {{{ */ TypeParenthetical : "(" LexPushInOff PrefixedType ")" LexPopIn { $$ = $3; } ; @@ -1473,6 +1481,9 @@ PrimaryExpression : "@encode" "(" EncodedType ")" { $$ = $3; } ; /* }}} */ +@end + +@begin ObjectiveC /* Cycript (Objective-C): @class Declaration {{{ */ ClassSuperOpt /* XXX: why the hell did I choose MemberExpression? */ @@ -1626,7 +1637,9 @@ PrimaryExpression | "@selector" "(" LexPushInOff SelectorExpression ")" LexPopIn { $$ = CYNew CYSelector($4); } ; /* }}} */ -/* Cycript (Objective-C): @import Directive {{{ */ +@end + +/* Cycript: @import Directive {{{ */ Module : Module "." Word { $$ = CYNew CYModule($3, $1); } | Word { $$ = CYNew CYModule($1); } @@ -1636,6 +1649,8 @@ Declaration__ : "@import" Module { $$ = CYNew CYImport($2); } ; /* }}} */ + +@begin ObjectiveC /* Cycript (Objective-C): Boxed Expressions {{{ */ BoxableExpression : NullLiteral { $$ = $1; }