%type <null_> NullLiteral
%type <literal_> ObjectLiteral
%type <compound_> Parenthetical
-//%type <compound_> ParentheticalOpt
%type <expression_> PostfixExpression
%type <expression_> PrimaryExpression
%type <statement_> Program
: "(" LexPushInOff Expression ")" LexPopIn { $$ = $3; }
;
-/*ParentheticalOpt
- : Parenthetical { $$ = $1; }
- | { $$ = NULL; }
- ;*/
-
Variable
: Identifier { $$ = CYNew CYVariable($1); }
;
ArrowParameters
: BindingIdentifier { $$ = CYNew CYFunctionParameter(CYNew CYDeclaration($1)); }
- //| ParentheticalOpt { $$ = $1; }
+ | "(" LexPushInOff LexSetRegExp ")" LexPopIn { $$ = NULL; }
+ | Parenthetical { $$ = $1->Parameters(); if ($$ == NULL) error(@1, "invalid parameter list"); }
;
ConciseBody
virtual void Output(CYOutput &out, CYFlags flags) const = 0;
};
+struct CYFunctionParameter;
+
struct CYNumber;
struct CYString;
return NULL;
}
+ virtual CYFunctionParameter *Parameter() const;
+ virtual CYFunctionParameter *Parameters() const;
+
virtual CYNumber *Number(CYContext &context) {
return NULL;
}
void Output(CYOutput &out, CYFlags flags) const;
virtual CYExpression *Primitive(CYContext &context);
+ virtual CYFunctionParameter *Parameters() const;
};
struct CYDeclaration;
virtual CYExpression *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
+
+ virtual CYFunctionParameter *Parameter() const;
};
struct CYPrefix :
return expression->Primitive(context);
}
+CYFunctionParameter *CYCompound::Parameters() const {
+ CYFunctionParameter *next;
+ if (next_ == NULL)
+ next = NULL;
+ else {
+ next = next_->Parameters();
+ if (next == NULL)
+ return NULL;
+ }
+
+ CYFunctionParameter *parameter(expression_->Parameter());
+ if (parameter == NULL)
+ return NULL;
+
+ parameter->SetNext(next);
+ return parameter;
+}
+
CYFunctionParameter *CYComprehension::Parameters(CYContext &context) const { $T(NULL)
CYFunctionParameter *next(next_->Parameters(context));
if (CYFunctionParameter *parameter = Parameter(context)) {
return NULL;
}
+CYFunctionParameter *CYExpression::Parameter() const {
+ return NULL;
+}
+
+CYFunctionParameter *CYExpression::Parameters() const {
+ return NULL;
+}
+
CYStatement *CYExternal::Replace(CYContext &context) {
return $E($ CYAssign($V(typed_->identifier_), $C1(typed_->Replace(context), $C2($V("dlsym"), $V("RTLD_DEFAULT"), $S(typed_->identifier_->Word())))));
}
return this;
}
+CYFunctionParameter *CYVariable::Parameter() const {
+ return $ CYFunctionParameter($ CYDeclaration(name_));
+}
+
CYStatement *CYWhile::Replace(CYContext &context) {
context.Replace(test_);
context.Replace(code_);