%token Percent "%"
%token PercentEqual "%="
%token Period "."
+%token PeriodPeriodPeriod "..."
%token Pipe "|"
%token PipeEqual "|="
%token PipePipe "||"
%type <expression_> AdditiveExpression
%type <expression_> AdditiveExpressionNoBF
-%type <argument_> ArgumentList
%type <argument_> ArgumentList_
+%type <argument_> ArgumentList
%type <argument_> ArgumentListOpt
%type <argument_> Arguments
%type <literal_> ArrayLiteral
%type <expression_> AssigneeExpression
%type <expression_> AssigneeExpressionNoBF
-%type <expression_> AssignmentExpression
%type <assignment_> AssignmentExpression_
+%type <expression_> AssignmentExpression
%type <expression_> AssignmentExpressionNoBF
%type <expression_> AssignmentExpressionNoIn
+%type <identifier_> BindingIdentifier
%type <expression_> BitwiseANDExpression
%type <expression_> BitwiseANDExpressionNoBF
%type <expression_> BitwiseANDExpressionNoIn
-%type <statement_> Block
%type <statement_> Block_
+%type <statement_> Block
%type <boolean_> BooleanLiteral
+%type <declaration_> BindingElement
%type <expression_> BitwiseORExpression
%type <expression_> BitwiseORExpressionNoBF
%type <expression_> BitwiseORExpressionNoIn
%type <expression_> BitwiseXORExpressionNoBF
%type <expression_> BitwiseXORExpressionNoIn
%type <statement_> BreakStatement
+%type <statement_> BreakableStatement
%type <expression_> CallExpression
%type <expression_> CallExpressionNoBF
%type <clause_> CaseBlock
%type <expression_> ConditionalExpressionNoBF
%type <expression_> ConditionalExpressionNoIn
%type <statement_> ContinueStatement
+%type <statement_> DebuggerStatement
+%type <statement_> Declaration
%type <clause_> DefaultClause
%type <statement_> DoWhileStatement
%type <expression_> Element
%type <expression_> EqualityExpression
%type <expression_> EqualityExpressionNoBF
%type <expression_> EqualityExpressionNoIn
+%type <compound_> Expression_
%type <expression_> Expression
%type <expression_> ExpressionOpt
-%type <compound_> Expression_
%type <expression_> ExpressionNoBF
-%type <expression_> ExpressionNoIn
%type <compound_> ExpressionNoIn_
+%type <expression_> ExpressionNoIn
%type <expression_> ExpressionNoInOpt
%type <statement_> ExpressionStatement
%type <finally_> FinallyOpt
%type <for_> ForStatementInitialiser
%type <statement_> ForInStatement
%type <forin_> ForInStatementInitialiser
-%type <functionParameter_> FormalParameterList
+%type <declaration_> FormalParameter
%type <functionParameter_> FormalParameterList_
+%type <functionParameter_> FormalParameterList
+%type <functionParameter_> FormalParameterListOpt
%type <statement_> FunctionBody
%type <statement_> FunctionDeclaration
%type <expression_> FunctionExpression
%type <statement_> LabelledStatement
%type <expression_> LeftHandSideExpression
%type <expression_> LeftHandSideExpressionNoBF
-//%type <statement_> LetStatement
+//%type <expression_> LetExpression
+%type <statement_> LetStatement
+%type <statement_> LexicalDeclaration
%type <literal_> Literal
%type <literal_> LiteralNoRE
%type <literal_> LiteralRE
%type <expression_> LogicalORExpressionNoBF
%type <expression_> LogicalORExpressionNoIn
%type <member_> MemberAccess
-%type <expression_> MemberExpression
%type <expression_> MemberExpression_
+%type <expression_> MemberExpression
%type <expression_> MemberExpressionNoBF
%type <expression_> MultiplicativeExpression
%type <expression_> MultiplicativeExpressionNoBF
-%type <expression_> NewExpression
%type <expression_> NewExpression_
+%type <expression_> NewExpression
%type <expression_> NewExpressionNoBF
%type <null_> NullLiteral
%type <literal_> ObjectLiteral
%type <expression_> PrimaryExpressionNoRE
%type <expression_> PrimaryExpressionBF
%type <statement_> Program
-%type <propertyName_> PropertyName
+%type <statement_> ProgramBody
+%type <statement_> ProgramBodyOpt
%type <propertyName_> PropertyName_
-%type <property_> PropertyNameAndValueList
+%type <propertyName_> PropertyName
%type <property_> PropertyNameAndValueList_
+%type <property_> PropertyNameAndValueList
%type <property_> PropertyNameAndValueListOpt
-%type <expression_> RelationalExpression
%type <infix_> RelationalExpression_
+%type <expression_> RelationalExpression
%type <expression_> RelationalExpressionNoBF
-%type <expression_> RelationalExpressionNoIn
%type <infix_> RelationalExpressionNoIn_
+%type <expression_> RelationalExpressionNoIn
%type <statement_> ReturnStatement
%type <rubyProc_> RubyProcExpression
%type <rubyProc_> RubyProcExpressionNoOA
-%type <functionParameter_> RubyProcParameterList
%type <functionParameter_> RubyProcParameterList_
+%type <functionParameter_> RubyProcParameterList
%type <functionParameter_> RubyProcParameters
%type <functionParameter_> RubyProcParametersOpt
%type <expression_> ShiftExpression
%type <expression_> ShiftExpressionNoBF
-%type <statement_> SourceElement
-%type <statement_> SourceElement_
-%type <statement_> SourceElements
-%type <statement_> Statement
+%type <declaration_> SingleNameBinding
%type <statement_> Statement_
+%type <statement_> Statement
%type <statement_> StatementList
%type <statement_> StatementListOpt
+%type <statement_> StatementListItem
%type <statement_> SwitchStatement
%type <statement_> ThrowStatement
%type <statement_> TryStatement
-%type <expression_> UnaryExpression
%type <expression_> UnaryExpression_
+%type <expression_> UnaryExpression
%type <expression_> UnaryExpressionNoBF
%type <declaration_> VariableDeclaration
%type <declaration_> VariableDeclarationNoIn
-%type <declarations_> VariableDeclarationList
%type <declarations_> VariableDeclarationList_
-%type <declarations_> VariableDeclarationListNoIn
+%type <declarations_> VariableDeclarationList
%type <declarations_> VariableDeclarationListNoIn_
+%type <declarations_> VariableDeclarationListNoIn
%type <statement_> VariableStatement
%type <statement_> WhileStatement
%type <statement_> WithStatement
%type <messageParameter_> MessageParameterList
%type <messageParameter_> MessageParameterListOpt
%type <bool_> MessageScope
-%type <argument_> SelectorCall
%type <argument_> SelectorCall_
-%type <selector_> SelectorExpression
+%type <argument_> SelectorCall
%type <selector_> SelectorExpression_
+%type <selector_> SelectorExpression
%type <selector_> SelectorExpressionOpt
%type <argument_> SelectorList
%type <word_> SelectorWordOpt
@begin E4X
%type <propertyIdentifier_> PropertyIdentifier_
-%type <selector_> PropertySelector
%type <selector_> PropertySelector_
-%type <identifier_> QualifiedIdentifier
+%type <selector_> PropertySelector
%type <identifier_> QualifiedIdentifier_
+%type <identifier_> QualifiedIdentifier
%type <identifier_> WildcardIdentifier
%type <identifier_> XMLComment
%type <identifier_> XMLCDATA
| "\n" StrictSemi
;
-TerminatorOpt
+Terminator
: Terminator_
- | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
+ | error { if (yychar != 0 && yychar != cy::parser::token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi
;
-Terminator
+TerminatorOpt
: Terminator_
- | error { if (yychar != 0 && yychar != cy::parser::token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi
+ | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
;
/*CommaOpt
|
;
-WordOpt
- : Word { $$ = $1; }
- | { $$ = NULL; }
- ;
-
Word
: Identifier { $$ = $1; }
| "break" NewLineOpt { $$ = $1; }
| "with" { $$ = $1; }
;
+WordOpt
+ : Word { $$ = $1; }
+ | { $$ = NULL; }
+ ;
+
PrimaryExpressionNo
: "@" LiteralNoRE { $$ = CYNew CYBox($2); }
| "@" ArrayLiteral { $$ = CYNew CYBox($2); }
| "transient" { $$ = $1; }
| "volatile" { $$ = $1; }
- | "let" { $$ = $1; }
+ // XXX: is this allowed?! | "let" { $$ = $1; }
| "yield" { $$ = $1; }
| "each" { $$ = $1; }
| LexSetRegExp { $$ = NULL; }
;
-ElementListOpt
- : ElementList { $$ = $1; }
- | LexSetRegExp { $$ = NULL; }
- ;
-
ElementList
: ElementOpt "," ElementListOpt { $$ = CYNew CYElement($1, $3); }
| Element { $$ = CYNew CYElement($1, NULL); }
;
+
+ElementListOpt
+ : ElementList { $$ = $1; }
+ | LexSetRegExp { $$ = NULL; }
+ ;
/* }}} */
/* 11.1.5 Object Initialiser {{{ */
ObjectLiteral
| { $$ = NULL; }
;
+PropertyNameAndValueList
+ : PropertyName ":" AssignmentExpression PropertyNameAndValueList_ { $$ = CYNew CYProperty($1, $3, $4); }
+ ;
+
PropertyNameAndValueListOpt
: PropertyNameAndValueList { $$ = $1; }
| { $$ = NULL; }
;
-PropertyNameAndValueList
- : PropertyName ":" AssignmentExpression PropertyNameAndValueList_ { $$ = CYNew CYProperty($1, $3, $4); }
- ;
-
PropertyName_
: Identifier { $$ = $1; }
| StringLiteral { $$ = $1; }
/* }}} */
/* 11.2 Left-Hand-Side Expressions {{{ */
-MemberExpression_
- : "new" MemberExpression Arguments { $$ = CYNew cy::Syntax::New($2, $3); }
- ;
-
MemberAccess
: "[" Expression "]" { $$ = CYNew CYDirectMember(NULL, $2); }
| "." Identifier { $$ = CYNew CYDirectMember(NULL, CYNew CYString($2)); }
| "." AutoComplete { driver.mode_ = CYDriver::AutoDirect; YYACCEPT; }
;
+MemberExpression_
+ : "new" MemberExpression Arguments { $$ = CYNew cy::Syntax::New($2, $3); }
+ ;
+
MemberExpression
: PrimaryExpression { $$ = $1; }
| LexSetRegExp FunctionExpression { $$ = $2; }
| { $$ = NULL; }
;
+ArgumentList
+ : AssignmentExpression ArgumentList_ { $$ = CYNew CYArgument(NULL, $1, $2); }
+ ;
+
ArgumentListOpt
: ArgumentList { $$ = $1; }
| LexSetRegExp { $$ = NULL; }
;
-ArgumentList
- : AssignmentExpression ArgumentList_ { $$ = CYNew CYArgument(NULL, $1, $2); }
- ;
-
Arguments
: "(" ArgumentListOpt ")" { $$ = $2; }
;
;
/* }}} */
/* 11.8 Relational Operators {{{ */
-RelationalExpressionNoIn_
- : "<" ShiftExpression { $$ = CYNew CYLess(NULL, $2); }
- | ">" ShiftExpression { $$ = CYNew CYGreater(NULL, $2); }
- | "<=" ShiftExpression { $$ = CYNew CYLessOrEqual(NULL, $2); }
- | ">=" ShiftExpression { $$ = CYNew CYGreaterOrEqual(NULL, $2); }
- | "instanceof" ShiftExpression { $$ = CYNew CYInstanceOf(NULL, $2); }
- ;
-
RelationalExpression_
: RelationalExpressionNoIn_ { $$ = $1; }
| "in" ShiftExpression { $$ = CYNew CYIn(NULL, $2); }
| RelationalExpression RelationalExpression_ { $2->SetLeft($1); $$ = $2; }
;
+RelationalExpressionNoIn_
+ : "<" ShiftExpression { $$ = CYNew CYLess(NULL, $2); }
+ | ">" ShiftExpression { $$ = CYNew CYGreater(NULL, $2); }
+ | "<=" ShiftExpression { $$ = CYNew CYLessOrEqual(NULL, $2); }
+ | ">=" ShiftExpression { $$ = CYNew CYGreaterOrEqual(NULL, $2); }
+ | "instanceof" ShiftExpression { $$ = CYNew CYInstanceOf(NULL, $2); }
+ ;
+
RelationalExpressionNoIn
: ShiftExpression { $$ = $1; }
| RelationalExpressionNoIn RelationalExpressionNoIn_ { $2->SetLeft($1); $$ = $2; }
| { $$ = NULL; }
;
-ExpressionNoIn_
- : "," ExpressionNoIn { $$ = CYNew CYCompound($2); }
- | { $$ = NULL; }
+Expression
+ : AssignmentExpression Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
;
ExpressionOpt
| LexSetRegExp { $$ = NULL; }
;
-ExpressionNoInOpt
- : ExpressionNoIn { $$ = $1; }
- | LexSetRegExp { $$ = NULL; }
- ;
-
-Expression
- : AssignmentExpression Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
+ExpressionNoIn_
+ : "," ExpressionNoIn { $$ = CYNew CYCompound($2); }
+ | { $$ = NULL; }
;
ExpressionNoIn
: AssignmentExpressionNoIn ExpressionNoIn_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
;
+ExpressionNoInOpt
+ : ExpressionNoIn { $$ = $1; }
+ | LexSetRegExp { $$ = NULL; }
+ ;
+
ExpressionNoBF
: AssignmentExpressionNoBF Expression_ { if ($2) { $2->AddPrev($1); $$ = $2; } else $$ = $1; }
;
| EmptyStatement { $$ = $1; }
| ExpressionStatement { $$ = $1; }
| IfStatement { $$ = $1; }
- | IterationStatement { $$ = $1; }
+ | BreakableStatement { $$ = $1; }
| ContinueStatement { $$ = $1; }
| BreakStatement { $$ = $1; }
| ReturnStatement { $$ = $1; }
| WithStatement { $$ = $1; }
| LabelledStatement { $$ = $1; }
- | SwitchStatement { $$ = $1; }
| ThrowStatement { $$ = $1; }
| TryStatement { $$ = $1; }
+ | DebuggerStatement { $$ = $1; }
;
Statement
: LexSetRegExp Statement_ { $$ = $2; }
;
+
+Declaration
+ : FunctionDeclaration { $$ = $1; }
+ | LexicalDeclaration { $$ = $1; }
+ ;
+
+BreakableStatement
+ : IterationStatement { $$ = $1; }
+ | SwitchStatement { $$ = $1; }
+ ;
/* }}} */
/* 12.1 Block {{{ */
Block_
;
StatementList
- : Statement StatementListOpt { $1->SetNext($2); $$ = $1; }
+ : StatementListItem StatementListOpt { $1->SetNext($2); $$ = $1; }
;
StatementListOpt
: StatementList { $$ = $1; }
| LexSetRegExp { $$ = NULL; }
;
+
+StatementListItem
+ : Statement { $$ = $1; }
+ | LexSetRegExp Declaration { $$ = $2; }
+ ;
/* }}} */
-/* 12.2 Variable Statement {{{ */
+/* 12.2 Declarations {{{ */
+BindingIdentifier
+ : Identifier { $$ = $1; }
+ ;
+
+// XXX: BindingPattern
+/* }}} */
+/* 12.2.1 Let and Const Declarations {{{ */
+LexicalDeclaration
+ : LetOrConst VariableDeclarationList Terminator { $$ = CYNew CYVar($2); }
+ ;
+
+LetOrConst
+ : "let"
+ | "const"
+ ;
+/* }}} */
+/* 12.2.2 Variable Statement {{{ */
VariableStatement
: "var" VariableDeclarationList Terminator { $$ = CYNew CYVar($2); }
;
| { $$ = NULL; }
;
+VariableDeclarationList
+ : VariableDeclaration VariableDeclarationList_ { $$ = CYNew CYDeclarations($1, $2); }
+ ;
+
VariableDeclarationListNoIn_
: "," VariableDeclarationListNoIn { $$ = $2; }
| { $$ = NULL; }
;
-VariableDeclarationList
- : VariableDeclaration VariableDeclarationList_ { $$ = CYNew CYDeclarations($1, $2); }
- ;
-
VariableDeclarationListNoIn
: VariableDeclarationNoIn VariableDeclarationListNoIn_ { $$ = CYNew CYDeclarations($1, $2); }
;
VariableDeclaration
- : Identifier InitialiserOpt { $$ = CYNew CYDeclaration($1, $2); }
+ : BindingIdentifier InitialiserOpt { $$ = CYNew CYDeclaration($1, $2); }
+ // XXX: | BindingPattern Initialiser { $$ = CYNew CYDeclaration($1, $2); }
;
VariableDeclarationNoIn
- : Identifier InitialiserNoInOpt { $$ = CYNew CYDeclaration($1, $2); }
+ : BindingIdentifier InitialiserNoInOpt { $$ = CYNew CYDeclaration($1, $2); }
+ // XXX: | BindingPattern InitialiserNoIn { $$ = CYNew CYDeclaration($1, $2); }
+ ;
+
+Initialiser
+ : "=" AssignmentExpression { $$ = $2; }
;
InitialiserOpt
| { $$ = NULL; }
;
+InitialiserNoIn
+ : "=" AssignmentExpressionNoIn { $$ = $2; }
+ ;
+
InitialiserNoInOpt
: InitialiserNoIn { $$ = $1; }
| { $$ = NULL; }
;
+/* }}} */
+/* 12.2.4 Destructuring Binding Patterns {{{ */
+// XXX: *
-Initialiser
- : "=" AssignmentExpression { $$ = $2; }
+BindingElement
+ : SingleNameBinding { $$ = $1; }
;
-InitialiserNoIn
- : "=" AssignmentExpressionNoIn { $$ = $2; }
+SingleNameBinding
+ : BindingIdentifier InitialiserOpt { $$ = CYNew CYDeclaration($1, $2); }
;
/* }}} */
/* 12.3 Empty Statement {{{ */
ForStatementInitialiser
: ExpressionNoInOpt { $$ = $1; }
- | LexSetRegExp "var" VariableDeclarationListNoIn { $$ = $3; }
+ | LexSetRegExp "var" VariableDeclarationListNoIn { $$ = CYNew CYForDeclarations($3); }
;
/* }}} */
/* 12.6.4 The for-in Statement {{{ */
: Brace CaseClausesOpt "}" { $$ = $2; }
;
+CaseClause
+ : "case" Expression ":" StatementListOpt { $$ = CYNew CYClause($2, $4); }
+ ;
+
CaseClausesOpt
: CaseClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
| DefaultClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
| { $$ = NULL; }
;
-CaseClause
- : "case" Expression ":" StatementListOpt { $$ = CYNew CYClause($2, $4); }
- ;
-
DefaultClause
: "default" ":" StatementListOpt { $$ = CYNew CYClause(NULL, $3); }
;
| { $$ = NULL; }
;
/* }}} */
+/* 12.14 The debugger Statement {{{ */
+DebuggerStatement
+ : "debugger" Terminator { $$ = CYNew CYDebugger(); }
+ ;
+/* }}} */
/* 13 Function Definition {{{ */
FunctionDeclaration
- : "function" Identifier "(" FormalParameterList ")" Brace FunctionBody "}" { $$ = CYNew CYFunctionStatement($2, $4, $7); }
+ : "function" Identifier "(" FormalParameterListOpt ")" Brace FunctionBody "}" { $$ = CYNew CYFunctionStatement($2, $4, $7); }
;
FunctionExpression
- : "function" IdentifierOpt "(" FormalParameterList ")" Brace FunctionBody "}" { $$ = CYNew CYFunctionExpression($2, $4, $7); }
+ : "function" IdentifierOpt "(" FormalParameterListOpt ")" Brace FunctionBody "}" { $$ = CYNew CYFunctionExpression($2, $4, $7); }
;
FormalParameterList_
;
FormalParameterList
- : Identifier FormalParameterList_ { $$ = CYNew CYFunctionParameter($1, $2); }
+ // XXX: : FunctionRestParameter { $$ = $1; }
+ : FormalParameter FormalParameterList_ { $$ = CYNew CYFunctionParameter($1, $2); }
+ ;
+
+FormalParameterListOpt
+ : FormalParameterList
| { $$ = NULL; }
;
+/* XXX: FunctionRestParameter
+ : "..." BindingIdentifier { $$ = CYNew CYFunctionRestParameter($2); }
+ ;*/
+
+FormalParameter
+ : BindingElement { $$ = $1; }
+ ;
+
FunctionBody
- : SourceElements { $$ = $1; }
+ : StatementListOpt { $$ = $1; }
;
/* }}} */
/* 14 Program {{{ */
Program
- : SourceElements { driver.program_ = CYNew CYProgram($1); }
+ : ProgramBodyOpt { driver.program_ = CYNew CYProgram($1); }
;
-SourceElements
- : SourceElement SourceElements { $1->SetNext($2); $$ = $1; }
- | LexSetRegExp { $$ = NULL; }
- ;
-
-SourceElement_
- : Statement_ { $$ = $1; }
- | FunctionDeclaration { $$ = $1; }
+ProgramBody
+ : StatementList { $$ = $1; }
;
-SourceElement
- : LexSetRegExp SourceElement_ { $$ = $2; }
+ProgramBodyOpt
+ : ProgramBody { $$ = $1; }
+ | { $$ = NULL; }
;
/* }}} */
: Expression Identifier ";"
;
+ClassFieldList
+ : Brace ClassFieldListOpt "}" { $$ = NULL; }
+ ;
+
ClassFieldListOpt
: ClassFieldListOpt ClassField
|
;
-ClassFieldList
- : Brace ClassFieldListOpt "}" { $$ = NULL; }
- ;
-
MessageScope
: "+" { $$ = false; }
| "-" { $$ = true; }
: Word ":" TypeOpt Identifier { $$ = CYNew CYMessageParameter($1, $3, $4); }
;
+MessageParameterList
+ : MessageParameter MessageParameterListOpt { $1->SetNext($2); $$ = $1; }
+ ;
+
MessageParameterListOpt
: MessageParameterList { $$ = $1; }
| { $$ = NULL; }
;
-MessageParameterList
- : MessageParameter MessageParameterListOpt { $1->SetNext($2); $$ = $1; }
- ;
-
MessageParameters
: MessageParameterList { $$ = $1; }
| Word { $$ = CYNew CYMessageParameter($1, NULL, NULL); }
| { $$ = NULL; }
;
-SelectorCall_
- : SelectorCall { $$ = $1; }
- | VariadicCall { $$ = $1; }
- ;
-
SelectorWordOpt
: WordOpt { driver.contexts_.back().words_.push_back($1); } { $$ = $1; }
| AutoComplete { driver.mode_ = CYDriver::AutoMessage; YYACCEPT; }
;
+SelectorCall_
+ : SelectorCall { $$ = $1; }
+ | VariadicCall { $$ = $1; }
+ ;
+
SelectorCall
: SelectorWordOpt ":" AssignmentExpression SelectorCall_ { $$ = CYNew CYArgument($1 ?: CYNew CYBlank(), $3, $4); }
;
| "[" LexSetRegExp "super" { driver.context_ = NULL; } SelectorList "]" { $$ = CYNew CYSendSuper($5); }
;
-SelectorExpressionOpt
- : SelectorExpression_ { $$ = $1; }
- | { $$ = NULL; }
- ;
-
SelectorExpression_
: WordOpt ":" SelectorExpressionOpt { $$ = CYNew CYSelectorPart($1, true, $3); }
;
| Word { $$ = CYNew CYSelectorPart($1, false, NULL); }
;
+SelectorExpressionOpt
+ : SelectorExpression_ { $$ = $1; }
+ | { $$ = NULL; }
+ ;
+
PrimaryExpressionNo
: MessageExpression { $$ = $1; }
| "@selector" "(" SelectorExpression ")" { $$ = CYNew CYSelector($3); }
| StringLiteral
;
-SourceElement_
+StatementListItem
: "@import" ImportPath { $$ = CYNew CYImport(); }
;
/* }}} */
| "for" "each" "(" Identifier "in" Expression ")" { $$ = CYNew CYForEachInComprehension($4, $6); }
;
+ComprehensionList
+ : ForComprehension ComprehensionListOpt { $1->SetNext($2); $$ = $1; }
+ ;
+
ComprehensionListOpt
: ComprehensionList { $$ = $1; }
| IfComprehension { $$ = $1; }
| { $$ = NULL; }
;
-ComprehensionList
- : ForComprehension ComprehensionListOpt { $1->SetNext($2); $$ = $1; }
- ;
-
PrimaryExpressionNo
: "[" AssignmentExpression ComprehensionList "]" { $$ = CYNew CYArrayComprehension($2, $3); }
;
: "for" "each" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = CYNew CYForEachIn($4, $6, $8); }
;
/* }}} */
-/* JavaScript 1.7: let Statements {{{ *//*
+/* JavaScript 1.7: let Expressions {{{ */
+/*LetExpression
+ : "let" "(" VariableDeclarationList ")" Expression { $$ = CYNew CYLetExpression($3, $5); }
+ ;
+
+MemberExpression
+ : LexSetRegExp LetExpression { $$ = $2; }
+ ;*/
+/* }}} */
+/* JavaScript 1.7: let Statements {{{ */
LetStatement
- : "let" "(" VariableDeclarationList ")" Block_ { $$ = CYNew CYLet($3, $5); }
+ : "let" "(" VariableDeclarationList ")" Statement { $$ = CYNew CYLetStatement($3, $5); }
;
Statement_
: LetStatement
;
-*//* }}} */
-
-/* JavaScript FTW: Function Statements {{{ */
-Statement
- : LexSetRegExp FunctionDeclaration { driver.Warning(yylloc, "warning, FunctionDeclaration is a SourceElement, not a Statement"); } { $$ = $2; }
- ;
-/* }}} */
-/* JavaScript FTW: Optional Arguments {{{ */
-FormalParameterList
- : Identifier "=" AssignmentExpression FormalParameterList_ { $$ = CYNew CYOptionalFunctionParameter($1, $3, $4); }
- ;
/* }}} */
+
/* JavaScript FTW: Ruby Blocks {{{ */
RubyProcParameterList_
: "," RubyProcParameterList { $$ = $2; }
;
RubyProcParameterList
- : Identifier RubyProcParameterList_ { $$ = CYNew CYFunctionParameter($1, $2); }
+ : Identifier RubyProcParameterList_ { $$ = CYNew CYFunctionParameter(CYNew CYDeclaration($1), $2); }
| { $$ = NULL; }
;