X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/0347fadf3028c2a703a8d259850732e2642a5e78..cee5e1fd5183c06f351c849d6c245b9a8a57e1d7:/Cycript.y.in?ds=sidebyside diff --git a/Cycript.y.in b/Cycript.y.in index a77265f..3b7d21f 100644 --- a/Cycript.y.in +++ b/Cycript.y.in @@ -51,7 +51,7 @@ @end @begin E4X -#include "E4X.hpp" +#include "E4X/Syntax.hpp" @end typedef struct { @@ -67,6 +67,7 @@ typedef struct { CYBoolean *boolean_; CYClause *clause_; cy::Syntax::Catch *catch_; + CYComment *comment_; CYComprehension *comprehension_; CYCompound *compound_; CYDeclaration *declaration_; @@ -98,11 +99,14 @@ typedef struct { CYField *field_; CYMessage *message_; CYMessageParameter *messageParameter_; + CYProtocol *protocol_; CYSelectorPart *selector_; @end @begin E4X CYAttribute *attribute_; + CYPropertyIdentifier *propertyIdentifier_; + CYSelector *selector_; @end }; } YYSTYPE; @@ -151,11 +155,14 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %token SlashRight "/>" %token LeftSlash " Comment + %token OpenParen "(" %token CloseParen ")" @@ -309,7 +318,6 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %type AdditiveExpression %type AdditiveExpressionNoBF -%type AdditiveExpressionNoWC %type ArgumentList %type ArgumentList_ %type ArgumentListOpt @@ -317,27 +325,22 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %type ArrayLiteral %type AssigneeExpression %type AssigneeExpressionNoBF -%type AssigneeExpressionNoWC %type AssignmentExpression %type AssignmentExpression_ %type AssignmentExpressionNoBF %type AssignmentExpressionNoIn -%type AssignmentExpressionNoWC %type BitwiseANDExpression %type BitwiseANDExpressionNoBF %type BitwiseANDExpressionNoIn -%type BitwiseANDExpressionNoWC %type Block %type Block_ %type BooleanLiteral %type BitwiseORExpression %type BitwiseORExpressionNoBF %type BitwiseORExpressionNoIn -%type BitwiseORExpressionNoWC %type BitwiseXORExpression %type BitwiseXORExpressionNoBF %type BitwiseXORExpressionNoIn -%type BitwiseXORExpressionNoWC %type BreakStatement %type CallExpression %type CallExpressionNoBF @@ -350,7 +353,6 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %type ConditionalExpression %type ConditionalExpressionNoBF %type ConditionalExpressionNoIn -%type ConditionalExpressionNoWC %type ContinueStatement %type DefaultClause %type DoWhileStatement @@ -363,7 +365,6 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %type EqualityExpression %type EqualityExpressionNoBF %type EqualityExpressionNoIn -%type EqualityExpressionNoWC %type Expression %type ExpressionOpt %type Expression_ @@ -383,7 +384,6 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %type FunctionBody %type FunctionDeclaration %type FunctionExpression -%type FunctionExpression_ %type Identifier %type IdentifierOpt %type IfComprehension @@ -396,7 +396,6 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %type LabelledStatement %type LeftHandSideExpression %type LeftHandSideExpressionNoBF -%type LeftHandSideExpressionNoWC //%type LetStatement %type Literal %type LiteralNoRE @@ -404,39 +403,30 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %type LogicalANDExpression %type LogicalANDExpressionNoBF %type LogicalANDExpressionNoIn -%type LogicalANDExpressionNoWC %type LogicalORExpression %type LogicalORExpressionNoBF %type LogicalORExpressionNoIn -%type LogicalORExpressionNoWC %type MemberAccess %type MemberExpression %type MemberExpression_ %type MemberExpressionNoBF -%type MemberExpressionNoWC %type MultiplicativeExpression %type MultiplicativeExpressionNoBF -%type MultiplicativeExpressionNoWC %type NewExpression %type NewExpression_ %type NewExpressionNoBF -%type NewExpressionNoWC %type NullLiteral %type ObjectLiteral %type PostfixExpression %type PostfixExpressionNoBF -%type PostfixExpressionNoWC %type PrimaryExpression %type PrimaryExpressionNo %type PrimaryExpressionNoBF -%type PrimaryExpressionNoWC -%type PrimaryExpressionNoWC_ -@begin E4X -%type PrimaryExpressionWC -@end +%type PrimaryExpressionNoRE %type PrimaryExpressionBF %type Program %type PropertyName +%type PropertyName_ %type PropertyNameAndValueList %type PropertyNameAndValueList_ %type PropertyNameAndValueListOpt @@ -444,12 +434,10 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %type RelationalExpression_ %type RelationalExpressionNoBF %type RelationalExpressionNoIn -%type RelationalExpressionNoWC %type RelationalExpressionNoIn_ %type ReturnStatement %type ShiftExpression %type ShiftExpressionNoBF -%type ShiftExpressionNoWC %type SourceElement %type SourceElement_ %type SourceElements @@ -460,11 +448,9 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %type SwitchStatement %type ThrowStatement %type TryStatement -%type UnaryAssigneeExpression %type UnaryExpression %type UnaryExpression_ %type UnaryExpressionNoBF -%type UnaryExpressionNoWC %type VariableDeclaration %type VariableDeclarationNoIn %type VariableDeclarationList @@ -475,6 +461,17 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %type WhileStatement %type WithStatement +@begin C +%type AssigneeExpressionNoRE +%type CallExpressionNoRE +%type LeftHandSideExpressionNoRE +%type MemberExpressionNoRE +%type NewExpressionNoRE +%type PostfixExpressionNoRE +%type UnaryAssigneeExpression +%type UnaryExpressionNoRE +@end + @begin ObjectiveC %type CategoryStatement %type ClassExpression @@ -485,6 +482,9 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %type ClassMessageDeclarationListOpt %type ClassName %type ClassNameOpt +%type ClassProtocolListOpt +%type ClassProtocols +%type ClassProtocolsOpt %type MessageExpression %type MessageParameter %type MessageParameters @@ -504,9 +504,9 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); @end @begin E4X -%type PropertyIdentifier_ -%type PropertySelector -%type PropertySelector_ +%type PropertyIdentifier_ +%type PropertySelector +%type PropertySelector_ %type QualifiedIdentifier %type QualifiedIdentifier_ %type WildcardIdentifier @@ -518,13 +518,20 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %type XMLPI %type AttributeIdentifier -%type DefaultXMLNamespaceStatement +/* XXX: %type DefaultXMLNamespaceStatement */ %type PropertyIdentifier %type XMLListInitialiser %type XMLInitialiser @end -/* +%nonassoc Identifier_ "abstract" "boolean" "break" "byte" "case" "catch" "char" "class" "const" "continue" "debugger" "default" "delete" "do" "double" "each" "enum" "export" "extends" "false" "final" "finally" "float" /*"for"*/ "function" "goto" "implements" "import" /*"in"*/ /*"instanceof"*/ "int" "interface" "let" "long" "namespace" "native" "new" "null" "package" "private" "protected" "public" "return" "short" "super" "static" "switch" "synchronized" "this" "throw" "throws" "transient" "true" "try" "typeof" "var" "void" "volatile" "while" "with" "xml" "yield" + +%nonassoc "if" +%nonassoc "else" + +%nonassoc "++" "--" +%nonassoc "(" "[" + %left "*" "/" "%" %left "+" "-" %left "<<" ">>" ">>>" @@ -537,10 +544,6 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %left "||" %right "=" "*=" "/=" "%=" "+=" "-=" "<<=" ">>=" ">>>=" "&=" "^=" "|=" -*/ - -%nonassoc "if" -%nonassoc "else" %start Program @@ -672,6 +675,7 @@ LiteralNoRE | BooleanLiteral { $$ = $1; } | NumericLiteral { $$ = $1; } | StringLiteral { $$ = $1; } + | "@" StringLiteral { $$ = $2; } ; LiteralRE @@ -694,28 +698,18 @@ BooleanLiteral /* 11.1 Primary Expressions {{{ */ PrimaryExpression - : PrimaryExpressionNoWC { $$ = $1; } -@begin E4X - | LexSetRegExp PrimaryExpressionWC { $$ = $2; } -@end + : LexSetRegExp PrimaryExpressionNoRE { $$ = $2; } ; PrimaryExpressionNoBF : PrimaryExpressionNo { $$ = $1; } -@begin E4X - | PrimaryExpressionWC { $$ = $1; } -@end ; -PrimaryExpressionNoWC_ +PrimaryExpressionNoRE : PrimaryExpressionBF { $$ = $1; } | PrimaryExpressionNo { $$ = $1; } ; -PrimaryExpressionNoWC - : LexSetRegExp PrimaryExpressionNoWC_ { $$ = $2; } - ; - PrimaryExpressionNo : "this" { $$ = $1; } | Identifier { $$ = new(driver.pool_) CYVariable($1); } @@ -771,11 +765,15 @@ PropertyNameAndValueList : PropertyName ":" AssignmentExpression PropertyNameAndValueList_ { $$ = new(driver.pool_) CYProperty($1, $3, $4); } ; -PropertyName +PropertyName_ : Identifier { $$ = $1; } | StringLiteral { $$ = $1; } | NumericLiteral { $$ = $1; } ; + +PropertyName + : LexSetRegExp PropertyName_ { $$ = $2; } + ; /* }}} */ /* 11.2 Left-Hand-Side Expressions {{{ */ @@ -790,7 +788,7 @@ MemberAccess MemberExpression : PrimaryExpression { $$ = $1; } - | FunctionExpression { $$ = $1; } + | LexSetRegExp FunctionExpression { $$ = $2; } | MemberExpression MemberAccess { $2->SetLeft($1); $$ = $2; } | LexSetRegExp MemberExpression_ { $$ = $2; } ; @@ -801,12 +799,14 @@ MemberExpressionNoBF | MemberExpression_ { $$ = $1; } ; -MemberExpressionNoWC - : PrimaryExpressionNoWC { $$ = $1; } +@begin C +MemberExpressionNoRE + : PrimaryExpressionNoRE { $$ = $1; } | FunctionExpression { $$ = $1; } - | MemberExpression MemberAccess { $2->SetLeft($1); $$ = $2; } - | LexSetRegExp MemberExpression_ { $$ = $2; } + | MemberExpressionNoRE MemberAccess { $2->SetLeft($1); $$ = $2; } + | MemberExpression_ { $$ = $1; } ; +@end NewExpression_ : "new" NewExpression { $$ = new(driver.pool_) CYNew($2, NULL); } @@ -822,13 +822,15 @@ NewExpressionNoBF | NewExpression_ { $$ = $1; } ; -NewExpressionNoWC - : MemberExpressionNoWC { $$ = $1; } - | LexSetRegExp NewExpression_ { $$ = $2; } +@begin C +NewExpressionNoRE + : MemberExpressionNoRE { $$ = $1; } + | NewExpression_ { $$ = $1; } ; +@end CallExpression - : PrimaryExpressionNoWC Arguments { $$ = new(driver.pool_) CYCall($1, $2); } + : MemberExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); } | CallExpression Arguments { $$ = new(driver.pool_) CYCall($1, $2); } | CallExpression MemberAccess { $2->SetLeft($1); $$ = $2; } ; @@ -839,6 +841,14 @@ CallExpressionNoBF | CallExpressionNoBF MemberAccess { $2->SetLeft($1); $$ = $2; } ; +@begin C +CallExpressionNoRE + : MemberExpressionNoRE Arguments { $$ = new(driver.pool_) CYCall($1, $2); } + | CallExpressionNoRE Arguments { $$ = new(driver.pool_) CYCall($1, $2); } + | CallExpressionNoRE MemberAccess { $2->SetLeft($1); $$ = $2; } + ; +@end + ArgumentList_ : "," ArgumentList { $$ = $2; } | { $$ = NULL; } @@ -867,10 +877,12 @@ LeftHandSideExpressionNoBF | CallExpressionNoBF { $$ = $1; } ; -LeftHandSideExpressionNoWC - : NewExpressionNoWC { $$ = $1; } - | CallExpression { $$ = $1; } +@begin C +LeftHandSideExpressionNoRE + : NewExpressionNoRE { $$ = $1; } + | CallExpressionNoRE { $$ = $1; } ; +@end /* }}} */ /* 11.3 Postfix Expressions {{{ */ PostfixExpression @@ -885,11 +897,13 @@ PostfixExpressionNoBF | LeftHandSideExpressionNoBF "--" { $$ = new(driver.pool_) CYPostDecrement($1); } ; -PostfixExpressionNoWC - : AssigneeExpressionNoWC { $$ = $1; } - | LeftHandSideExpression "++" { $$ = new(driver.pool_) CYPostIncrement($1); } - | LeftHandSideExpression "--" { $$ = new(driver.pool_) CYPostDecrement($1); } +@begin C +PostfixExpressionNoRE + : AssigneeExpressionNoRE { $$ = $1; } + | LeftHandSideExpressionNoRE "++" { $$ = new(driver.pool_) CYPostIncrement($1); } + | LeftHandSideExpressionNoRE "--" { $$ = new(driver.pool_) CYPostDecrement($1); } ; +@end /* }}} */ /* 11.4 Unary Operators {{{ */ UnaryExpression_ @@ -916,10 +930,12 @@ UnaryExpressionNoBF | UnaryExpression_ { $$ = $1; } ; -UnaryExpressionNoWC - : PostfixExpressionNoWC { $$ = $1; } - | LexSetRegExp UnaryExpression_ { $$ = $2; } +@begin C +UnaryExpressionNoRE + : PostfixExpressionNoRE { $$ = $1; } + | UnaryExpression_ { $$ = $1; } ; +@end /* }}} */ /* 11.5 Multiplicative Operators {{{ */ MultiplicativeExpression @@ -935,13 +951,6 @@ MultiplicativeExpressionNoBF | MultiplicativeExpressionNoBF "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); } | MultiplicativeExpressionNoBF "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); } ; - -MultiplicativeExpressionNoWC - : UnaryExpressionNoWC { $$ = $1; } - | MultiplicativeExpression "*" UnaryExpression { $$ = new(driver.pool_) CYMultiply($1, $3); } - | MultiplicativeExpression "/" UnaryExpression { $$ = new(driver.pool_) CYDivide($1, $3); } - | MultiplicativeExpression "%" UnaryExpression { $$ = new(driver.pool_) CYModulus($1, $3); } - ; /* }}} */ /* 11.6 Additive Operators {{{ */ AdditiveExpression @@ -955,12 +964,6 @@ AdditiveExpressionNoBF | AdditiveExpressionNoBF "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); } | AdditiveExpressionNoBF "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); } ; - -AdditiveExpressionNoWC - : MultiplicativeExpressionNoWC{ $$ = $1; } - | AdditiveExpression "+" MultiplicativeExpression { $$ = new(driver.pool_) CYAdd($1, $3); } - | AdditiveExpression "-" MultiplicativeExpression { $$ = new(driver.pool_) CYSubtract($1, $3); } - ; /* }}} */ /* 11.7 Bitwise Shift Operators {{{ */ ShiftExpression @@ -976,13 +979,6 @@ ShiftExpressionNoBF | ShiftExpressionNoBF ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); } | ShiftExpressionNoBF ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); } ; - -ShiftExpressionNoWC - : AdditiveExpressionNoWC { $$ = $1; } - | ShiftExpression "<<" AdditiveExpression { $$ = new(driver.pool_) CYShiftLeft($1, $3); } - | ShiftExpression ">>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightSigned($1, $3); } - | ShiftExpression ">>>" AdditiveExpression { $$ = new(driver.pool_) CYShiftRightUnsigned($1, $3); } - ; /* }}} */ /* 11.8 Relational Operators {{{ */ RelationalExpressionNoIn_ @@ -1012,11 +1008,6 @@ RelationalExpressionNoBF : ShiftExpressionNoBF { $$ = $1; } | RelationalExpressionNoBF RelationalExpression_ { $2->SetLeft($1); $$ = $2; } ; - -RelationalExpressionNoWC - : ShiftExpressionNoWC { $$ = $1; } - | RelationalExpression RelationalExpression_ { $2->SetLeft($1); $$ = $2; } - ; /* }}} */ /* 11.9 Equality Operators {{{ */ EqualityExpression @@ -1042,14 +1033,6 @@ EqualityExpressionNoBF | EqualityExpressionNoBF "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); } | EqualityExpressionNoBF "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); } ; - -EqualityExpressionNoWC - : RelationalExpressionNoWC { $$ = $1; } - | EqualityExpression "==" RelationalExpression { $$ = new(driver.pool_) CYEqual($1, $3); } - | EqualityExpression "!=" RelationalExpression { $$ = new(driver.pool_) CYNotEqual($1, $3); } - | EqualityExpression "===" RelationalExpression { $$ = new(driver.pool_) CYIdentical($1, $3); } - | EqualityExpression "!==" RelationalExpression { $$ = new(driver.pool_) CYNotIdentical($1, $3); } - ; /* }}} */ /* 11.10 Binary Bitwise Operators {{{ */ BitwiseANDExpression @@ -1067,11 +1050,6 @@ BitwiseANDExpressionNoBF | BitwiseANDExpressionNoBF "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); } ; -BitwiseANDExpressionNoWC - : EqualityExpressionNoWC { $$ = $1; } - | BitwiseANDExpression "&" EqualityExpression { $$ = new(driver.pool_) CYBitwiseAnd($1, $3); } - ; - BitwiseXORExpression : BitwiseANDExpression { $$ = $1; } | BitwiseXORExpression "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); } @@ -1087,11 +1065,6 @@ BitwiseXORExpressionNoBF | BitwiseXORExpressionNoBF "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); } ; -BitwiseXORExpressionNoWC - : BitwiseANDExpressionNoWC { $$ = $1; } - | BitwiseXORExpression "^" BitwiseANDExpression { $$ = new(driver.pool_) CYBitwiseXOr($1, $3); } - ; - BitwiseORExpression : BitwiseXORExpression { $$ = $1; } | BitwiseORExpression "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); } @@ -1106,11 +1079,6 @@ BitwiseORExpressionNoBF : BitwiseXORExpressionNoBF { $$ = $1; } | BitwiseORExpressionNoBF "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); } ; - -BitwiseORExpressionNoWC - : BitwiseXORExpressionNoWC { $$ = $1; } - | BitwiseORExpression "|" BitwiseXORExpression { $$ = new(driver.pool_) CYBitwiseOr($1, $3); } - ; /* }}} */ /* 11.11 Binary Logical Operators {{{ */ LogicalANDExpression @@ -1128,11 +1096,6 @@ LogicalANDExpressionNoBF | LogicalANDExpressionNoBF "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); } ; -LogicalANDExpressionNoWC - : BitwiseORExpressionNoWC { $$ = $1; } - | LogicalANDExpression "&&" BitwiseORExpression { $$ = new(driver.pool_) CYLogicalAnd($1, $3); } - ; - LogicalORExpression : LogicalANDExpression { $$ = $1; } | LogicalORExpression "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); } @@ -1147,11 +1110,6 @@ LogicalORExpressionNoBF : LogicalANDExpressionNoBF { $$ = $1; } | LogicalORExpressionNoBF "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); } ; - -LogicalORExpressionNoWC - : LogicalANDExpressionNoWC { $$ = $1; } - | LogicalORExpression "||" LogicalANDExpression { $$ = new(driver.pool_) CYLogicalOr($1, $3); } - ; /* }}} */ /* 11.12 Conditional Operator ( ? : ) {{{ */ ConditionalExpression @@ -1168,11 +1126,6 @@ ConditionalExpressionNoBF : LogicalORExpressionNoBF { $$ = $1; } | LogicalORExpressionNoBF "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); } ; - -ConditionalExpressionNoWC - : LogicalORExpressionNoWC { $$ = $1; } - | LogicalORExpression "?" AssignmentExpression ":" AssignmentExpression { $$ = new(driver.pool_) CYCondition($1, $3, $5); } - ; /* }}} */ /* 11.13 Assignment Operators {{{ */ AssignmentExpression_ @@ -1192,18 +1145,24 @@ AssignmentExpression_ AssigneeExpression : LeftHandSideExpression { $$ = $1; } +@begin C | LexSetRegExp UnaryAssigneeExpression { $$ = $2; } +@end ; AssigneeExpressionNoBF : LeftHandSideExpressionNoBF { $$ = $1; } +@begin C | UnaryAssigneeExpression { $$ = $1; } +@end ; -AssigneeExpressionNoWC - : LeftHandSideExpressionNoWC { $$ = $1; } - | LexSetRegExp UnaryAssigneeExpression { $$ = $2; } +@begin C +AssigneeExpressionNoRE + : LeftHandSideExpressionNoRE { $$ = $1; } + | UnaryAssigneeExpression { $$ = $1; } ; +@end AssignmentExpression : ConditionalExpression { $$ = $1; } @@ -1230,11 +1189,6 @@ AssignmentExpressionNoBF : ConditionalExpressionNoBF { $$ = $1; } | AssigneeExpressionNoBF AssignmentExpression_ { $2->SetLeft($1); $$ = $2; } ; - -AssignmentExpressionNoWC - : ConditionalExpressionNoWC { $$ = $1; } - | AssigneeExpression AssignmentExpression_ { $2->SetLeft($1); $$ = $2; } - ; /* }}} */ /* 11.14 Comma Operator {{{ */ Expression_ @@ -1494,12 +1448,8 @@ FunctionDeclaration : "function" Identifier "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunctionStatement($2, $4, $7); } ; -FunctionExpression_ - : "function" IdentifierOpt "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunctionExpression($2, $4, $7); } - ; - FunctionExpression - : LexSetRegExp FunctionExpression_ { $$ = $2; } + : "function" IdentifierOpt "(" FormalParameterList ")" "{" FunctionBody "}" { $$ = new(driver.pool_) CYFunctionExpression($2, $4, $7); } ; FormalParameterList_ @@ -1595,12 +1545,27 @@ ClassNameOpt | { $$ = NULL; } ; +// XXX: this should be AssignmentExpressionNoRight +ClassProtocols + : ShiftExpression ClassProtocolsOpt { $$ = new(driver.pool_) CYProtocol($1, $2); } + ; + +ClassProtocolsOpt + : "," ClassProtocols { $$ = $2; } + | { $$ = NULL; } + ; + +ClassProtocolListOpt + : "<" ClassProtocols ">" { $$ = $2; } + | { $$ = NULL; } + ; + ClassExpression - : "@class" ClassNameOpt ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassExpression($2, $3, $4, $5); } + : "@class" ClassNameOpt ClassSuperOpt ClassProtocolListOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassExpression($2, $3, $4, $5, $6); } ; ClassStatement - : "@class" ClassName ClassSuperOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassStatement($2, $3, $4, $5); } + : "@class" ClassName ClassSuperOpt ClassProtocolListOpt ClassFieldList ClassMessageDeclarationListOpt "@end" { $$ = new(driver.pool_) CYClassStatement($2, $3, $4, $5, $6); } ; CategoryStatement @@ -1637,7 +1602,7 @@ SelectorList ; MessageExpression - : "[" AssignmentExpressionNoWC SelectorList "]" { $$ = new(driver.pool_) CYSendDirect($2, $3); } + : "[" AssignmentExpression SelectorList "]" { $$ = new(driver.pool_) CYSendDirect($2, $3); } | "[" LexSetRegExp "super" SelectorList "]" { $$ = new(driver.pool_) CYSendSuper($4); } ; @@ -1665,7 +1630,7 @@ PrimaryExpressionNo @begin C /* Cycript (C): Pointer Indirection/Addressing {{{ */ UnaryAssigneeExpression - : "*" UnaryExpression { $$ = new(driver.pool_) CYIndirect($2); } + : "*" UnaryExpressionNoRE { $$ = new(driver.pool_) CYIndirect($2); } ; UnaryExpression_ @@ -1679,6 +1644,12 @@ MemberAccess /* }}} */ @end +/* YUI: Documentation Comments {{{ */ +Statement_ + : Comment { $$ = $1; } + ; +/* }}} */ + @begin E4X /* Lexer State {{{ */ LexPushRegExp @@ -1725,8 +1696,8 @@ XMLMarkup ; /* }}} */ /* 11.1 Primary Expressions {{{ */ -PrimaryExpressionWC - : PropertyIdentifier { $$ = $1; } +PrimaryExpressionNo + : PropertyIdentifier { $$ = new(driver.pool_) CYPropertyVariable($1); } | XMLInitialiser { $$ = $1; } | XMLListInitialiser { $$ = $1; } ; @@ -1743,23 +1714,23 @@ AttributeIdentifier ; PropertySelector_ - : PropertySelector - | "[" Expression "]" + : PropertySelector { $$ = $1; } + | "[" Expression "]" { $$ = new(driver.pool_) CYSelector($2); } ; PropertySelector - : Identifier { $$ = $1; } + : Identifier { $$ = new(driver.pool_) CYSelector($1); } | WildcardIdentifier { $$ = $1; } ; /* }}} */ /* 11.1.2 Qualified Identifiers {{{ */ QualifiedIdentifier_ - : PropertySelector_ { $$ = $1; } + : PropertySelector_ { $$ = new(driver.pool_) CYQualified(NULL, $1); } | QualifiedIdentifier { $$ = $1; } ; QualifiedIdentifier - : PropertySelector "::" PropertySelector_ { $$ = new(driver.pool_) CYQName($1, $3); } + : PropertySelector "::" PropertySelector_ { $$ = new(driver.pool_) CYQualified($1, $3); } ; /* }}} */ /* 11.1.3 Wildcard Identifiers {{{ */ @@ -1840,13 +1811,13 @@ MemberAccess ; /* }}} */ /* 12.1 The default xml namespace Statement {{{ */ -DefaultXMLNamespaceStatement +/* XXX: DefaultXMLNamespaceStatement : "default" "xml" "namespace" "=" Expression Terminator { $$ = new(driver.pool_) CYDefaultXMLNamespace($5); } ; Statement_ : DefaultXMLNamespaceStatement { $$ = $1; } - ; + ; */ /* }}} */ @end