*semantic = data.semantic_;
switch (token) {
+ case tk::OpenBrace:
+ case tk::OpenBracket:
+ case tk::OpenParen:
+ driver.in_.push(false);
+ break;
+
case tk::_in_:
if (driver.in_.top())
token = tk::_in__;
break;
+ case tk::CloseBrace:
+ case tk::CloseBracket:
+ case tk::CloseParen:
+ driver.in_.pop();
+ break;
+
+
case tk::_yield_:
if (driver.yield_.top())
token = tk::_yield__;
;
CoverParenthesizedExpressionAndArrowParameterList
- : "(" LexPushInOff Expression ")" LexPopIn { $$ = CYNew CYParenthetical($3); }
- | "(" LexPushInOff LexSetRegExp ")" LexPopIn { $$ = NULL; }
- | "(" LexPushInOff LexSetRegExp "..." BindingIdentifier ")" LexPopIn { CYNOT(@$); }
- | "(" LexPushInOff Expression "," LexSetRegExp "..." BindingIdentifier ")" LexPopIn { CYNOT(@$); }
+ : "(" Expression ")" { $$ = CYNew CYParenthetical($2); }
+ | "(" LexSetRegExp ")" { $$ = NULL; }
+ | "(" LexSetRegExp "..." BindingIdentifier ")" { CYNOT(@$); }
+ | "(" Expression "," LexSetRegExp "..." BindingIdentifier ")" { CYNOT(@$); }
;
/* }}} */
/* 12.2.4 Literals {{{ */
/* }}} */
/* 12.2.5 Array Initializer {{{ */
ArrayLiteral
- : "[" LexPushInOff ElementListOpt "]" LexPopIn { $$ = CYNew CYArray($3); }
+ : "[" ElementListOpt "]" { $$ = CYNew CYArray($2); }
;
ElementList
/* }}} */
/* 12.2.6 Object Initializer {{{ */
ObjectLiteral
- : BRACE LexPushInOff PropertyDefinitionListOpt "}" LexPopIn { $$ = CYNew CYObject($3); }
+ : BRACE PropertyDefinitionListOpt "}" { $$ = CYNew CYObject($2); }
;
PropertyDefinitionList_
/* 12.3 Left-Hand-Side Expressions {{{ */
MemberAccess
- : "[" LexPushInOff Expression "]" LexPopIn { $$ = CYNew CYDirectMember(NULL, $3); }
+ : "[" Expression "]" { $$ = CYNew CYDirectMember(NULL, $2); }
| "." IdentifierName { $$ = CYNew CYDirectMember(NULL, CYNew CYString($2)); }
| "." AutoComplete { driver.mode_ = CYDriver::AutoDirect; YYACCEPT; }
| TemplateLiteral { CYNOT(@$); }
;
Arguments
- : "(" LexPushInOff ArgumentListOpt ")" LexPopIn { $$ = $3; }
+ : "(" ArgumentListOpt ")" { $$ = $2; }
;
ArgumentList_
;
FunctionExpression
- : "function" BindingIdentifierOpt "(" LexPushInOff FormalParameters ")" LexPopIn BRACE LexPushSuperOff LexPushInOff FunctionBody "}" LexPopIn LexPopSuper { $$ = CYNew CYFunctionExpression($2, $5, $11); }
+ : "function" BindingIdentifierOpt "(" FormalParameters ")" BRACE LexPushSuperOff FunctionBody "}" LexPopSuper { $$ = CYNew CYFunctionExpression($2, $4, $8); }
;
StrictFormalParameters
ConciseBody
: AssignmentExpression { $$ = CYNew CYReturn($1); }
- | LexSetRegExp ";{" LexPushInOff FunctionBody "}" LexPopIn { $$ = $4; }
+ | LexSetRegExp ";{" FunctionBody "}" { $$ = $3; }
;
/* }}} */
/* 14.3 Method Definitions {{{ */
/* Cycript (C): Type Encoding {{{ */
TypeSignifier
: IdentifierType { $$ = CYNew CYTypedIdentifier(@1, $1); }
- | "(" LexPushInOff "*" TypeQualifierRight ")" LexPopIn { $$ = $4; }
+ | "(" "*" TypeQualifierRight ")" { $$ = $3; }
;
SuffixedType
: SuffixedType "[" NumericLiteral "]" { $$ = $1; $$->modifier_ = CYNew CYTypeArrayOf($3, $$->modifier_); }
- | "(" LexPushInOff "^" TypeQualifierRight ")" LexPopIn "(" LexPushInOff TypedParameterListOpt ")" LexPopIn { $$ = $4; $$->modifier_ = CYNew CYTypeBlockWith($9, $$->modifier_); }
- | TypeSignifier "(" LexPushInOff TypedParameterListOpt ")" LexPopIn { $$ = $1; $$->modifier_ = CYNew CYTypeFunctionWith($4, $$->modifier_); }
- | "(" LexPushInOff TypedParameterListOpt ")" LexPopIn { $$ = CYNew CYTypedIdentifier(@1); $$->modifier_ = CYNew CYTypeFunctionWith($3, $$->modifier_); }
+ | "(" "^" TypeQualifierRight ")" "(" TypedParameterListOpt ")" { $$ = $3; $$->modifier_ = CYNew CYTypeBlockWith($6, $$->modifier_); }
+ | TypeSignifier "(" TypedParameterListOpt ")" { $$ = $1; $$->modifier_ = CYNew CYTypeFunctionWith($3, $$->modifier_); }
+ | "(" TypedParameterListOpt ")" { $$ = CYNew CYTypedIdentifier(@1); $$->modifier_ = CYNew CYTypeFunctionWith($2, $$->modifier_); }
| TypeSignifier { $$ = $1; }
| { $$ = CYNew CYTypedIdentifier(@$); }
;
;
MessageExpression
- : "[" LexPushInOff AssignmentExpressionClassic { driver.contexts_.push_back($3); } SelectorList "]" LexPopIn { driver.contexts_.pop_back(); } { $$ = CYNew CYSendDirect($3, $5); }
- | "[" LexPushInOff LexSetRegExp "super" { driver.context_ = NULL; } SelectorList "]" LexPopIn { $$ = CYNew CYSendSuper($6); }
+ : "[" AssignmentExpressionClassic { driver.contexts_.push_back($2); } SelectorList "]" { driver.contexts_.pop_back(); } { $$ = CYNew CYSendDirect($2, $4); }
+ | "[" LexSetRegExp "super" { driver.context_ = NULL; } SelectorList "]" { $$ = CYNew CYSendSuper($5); }
;
SelectorExpression_
PrimaryExpression
: MessageExpression { $$ = $1; }
- | "@selector" "(" LexPushInOff SelectorExpression ")" LexPopIn { $$ = CYNew CYSelector($4); }
+ | "@selector" "(" SelectorExpression ")" { $$ = CYNew CYSelector($3); }
;
/* }}} */
@end
/* }}} */
/* Cycript (Objective-C): Block Expressions {{{ */
PrimaryExpression
- : "^" TypedIdentifier { if ($2->identifier_ != NULL) CYERR($2->location_, "unexpected identifier"); } BRACE LexPushInOff FunctionBody "}" LexPopIn { if (CYTypeFunctionWith *function = $2->Function()) $$ = CYNew CYObjCBlock($2, function->parameters_, $6); else CYERR($2->location_, "expected parameters"); }
+ : "^" TypedIdentifier { if ($2->identifier_ != NULL) CYERR($2->location_, "unexpected identifier"); } BRACE FunctionBody "}" { if (CYTypeFunctionWith *function = $2->Function()) $$ = CYNew CYObjCBlock($2, function->parameters_, $5); else CYERR($2->location_, "expected parameters"); }
;
/* }}} */
/* Cycript (Objective-C): Instance Literals {{{ */
;
PrimaryExpression
- : "[" LexPushInOff LexSetRegExp "&" LexSetRegExp "]" LexPopIn "(" LexPushInOff TypedParameterListOpt ")" LexPopIn "->" TypedIdentifier BRACE LexPushInOff FunctionBody "}" LexPopIn { $$ = CYNew CYLambda($14, $10, $17); }
+ : "[" LexSetRegExp "&" LexSetRegExp "]" "(" TypedParameterListOpt ")" "->" TypedIdentifier BRACE FunctionBody "}" { $$ = CYNew CYLambda($10, $7, $12); }
;
/* }}} */
/* Cycript (C): Type Definitions {{{ */
PropertySelector_
: PropertySelector { $$ = $1; }
- | "[" LexPushInOff Expression "]" LexPopIn { $$ = CYNew CYSelector($3); }
+ | "[" Expression "]" { $$ = CYNew CYSelector($2); }
;
PropertySelector
;
ArrayComprehension
- : "[" LexPushInOff Comprehension "]" LexPopIn { $$ = $3; }
+ : "[" Comprehension "]" { $$ = $2; }
;
Comprehension
;
PrimaryExpression
- : BRACE LexPushInOff RubyProcParameters StatementListOpt "}" LexPopIn { $$ = CYNew CYRubyProc($3, $4); }
+ : BRACE RubyProcParameters StatementListOpt "}" { $$ = CYNew CYRubyProc($2, $3); }
;
PostfixExpression