: multiplicative_expression
| integer_division_expression OP_IDIV multiplicative_expression
{
- //FIXME: Is this right ?
- $$ = new Binary (Binary.Operator.Division,
+ $$ = new Binary (Binary.Operator.IntegerDivision,
(Expression) $1, (Expression) $3, lexer.Location);
}
;
: mod_expression
| additive_expression PLUS mod_expression
{
- $$ = new Binary (Binary.Operator.Addition,
- (Expression) $1, (Expression) $3, lexer.Location);
+ $$ = new Binary (Binary.Operator.Addition,
+ (Expression) $1, (Expression) $3, lexer.Location);
}
| additive_expression MINUS mod_expression
{
- $$ = new Binary (Binary.Operator.Subtraction,
- (Expression) $1, (Expression) $3, lexer.Location);
+ $$ = new Binary (Binary.Operator.Subtraction,
+ (Expression) $1, (Expression) $3, lexer.Location);
}
;
: additive_expression
| concat_expression OP_CONCAT additive_expression
{
- // FIXME: This should only work for String expressions
- // We probably need to use something from the runtime
- $$ = new Binary (Binary.Operator.Addition,
+ $$ = new Binary (Binary.Operator.Concatenation,
(Expression) $1, (Expression) $3, lexer.Location);
}
;
: concat_expression
| shift_expression OP_SHIFT_LEFT concat_expression
{
- // TODO
+ $$ = new Binary (Binary.Operator.LeftShift,
+ (Expression) $1, (Expression) $3, lexer.Location);
}
| shift_expression OP_SHIFT_RIGHT concat_expression
{
- //TODO
+ $$ = new Binary (Binary.Operator.RightShift,
+ (Expression) $1, (Expression) $3, lexer.Location);
}
;
}
| relational_expression IS shift_expression
{
- //FIXME: Should be a different op for reference equality but allows tests to use Is
- $$ = new Binary (Binary.Operator.Equality,
+ $$ = new Binary (Binary.Operator.Is,
(Expression) $1, (Expression) $3, lexer.Location);
}
| TYPEOF shift_expression IS type
{
- //FIXME: Is this rule correctly defined ?
- $$ = new Is ((Expression) $2, (Expression) $4, lexer.Location);
+ $$ = new Is ((Expression) $2, (Expression) $4, lexer.Location);
}
;
: relational_expression
| NOT negation_expression
{
- //FIXME: Is this rule correctly defined ?
- $$ = new Unary (Unary.Operator.LogicalNot, (Expression) $2, lexer.Location);
+ $$ = new Unary (Unary.Operator.OnesComplement, (Expression) $2, lexer.Location);
}
;
: negation_expression
| conditional_and_expression AND negation_expression
{
-// $$ = new Binary (Binary.Operator.LogicalAnd,
-// (Expression) $1, (Expression) $3, lexer.Location);
+ $$ = new Binary (Binary.Operator.BitwiseAnd,
+ (Expression) $1, (Expression) $3, lexer.Location);
}
| conditional_and_expression ANDALSO negation_expression
- { // FIXME: this is likely to be broken
+ {
$$ = new Binary (Binary.Operator.LogicalAndAlso,
(Expression) $1, (Expression) $3, lexer.Location);
}
: conditional_and_expression
| conditional_or_expression OR conditional_and_expression
{
-// $$ = new Binary (Binary.Operator.LogicalOr,
-// (Expression) $1, (Expression) $3, lexer.Location);
+ $$ = new Binary (Binary.Operator.BitwiseOr,
+ (Expression) $1, (Expression) $3, lexer.Location);
}
| conditional_or_expression ORELSE conditional_and_expression
- { // FIXME: this is likely to be broken
+ {
$$ = new Binary (Binary.Operator.LogicalOrElse,
(Expression) $1, (Expression) $3, lexer.Location);
}