jscript: Added support for relational CC expressions.

This commit is contained in:
Jacek Caban 2014-10-02 14:36:40 +02:00 committed by Alexandre Julliard
parent d9e8c013c6
commit e7b8459bc3
2 changed files with 31 additions and 6 deletions

View File

@ -192,13 +192,13 @@ CCEqualityExpression
CCRelationalExpression
: CCShiftExpression { $$ = $1; }
| CCRelationalExpression '<' CCShiftExpression
{ FIXME("'<' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
{ $$ = ccval_bool(get_ccnum($1) < get_ccnum($3)); }
| CCRelationalExpression tLEQ CCShiftExpression
{ FIXME("'<=' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
{ $$ = ccval_bool(get_ccnum($1) <= get_ccnum($3)); }
| CCRelationalExpression '>' CCShiftExpression
{ FIXME("'>' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
{ $$ = ccval_bool(get_ccnum($1) > get_ccnum($3)); }
| CCRelationalExpression tGEQ CCShiftExpression
{ FIXME("'>=' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
{ $$ = ccval_bool(get_ccnum($1) >= get_ccnum($3)); }
CCShiftExpression
: CCAdditiveExpression { $$ = $1; }

View File

@ -152,8 +152,33 @@ ok(@test === true, "@test = " + @test);
@set @test = (1==false+1)
ok(@test === true, "@test = " + @test);
@set @test = (1+true==false+1)
ok(@test === false, "@test = " + @test);
function expect(val, exval) {
ok(val === exval, "got " + val + " expected " + exval);
}
@set @test = (false < 0.5)
expect(@test, true);
@set @test = (true == 0 < 0.5)
expect(@test, true);
@set @test = (false < 0)
expect(@test, false);
@set @test = (false > 0.5)
expect(@test, false);
@set @test = (1 < true)
expect(@test, false);
@set @test = (1 <= true)
expect(@test, true);
@set @test = (1 >= true)
expect(@test, true);
@set @test = (1 >= true-1)
expect(@test, true);
@if (false)
this wouldn not parse