jscript: Added support for relational CC expressions.
This commit is contained in:
parent
d9e8c013c6
commit
e7b8459bc3
|
@ -192,13 +192,13 @@ CCEqualityExpression
|
||||||
CCRelationalExpression
|
CCRelationalExpression
|
||||||
: CCShiftExpression { $$ = $1; }
|
: CCShiftExpression { $$ = $1; }
|
||||||
| CCRelationalExpression '<' CCShiftExpression
|
| CCRelationalExpression '<' CCShiftExpression
|
||||||
{ FIXME("'<' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
|
{ $$ = ccval_bool(get_ccnum($1) < get_ccnum($3)); }
|
||||||
| CCRelationalExpression tLEQ CCShiftExpression
|
| CCRelationalExpression tLEQ CCShiftExpression
|
||||||
{ FIXME("'<=' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
|
{ $$ = ccval_bool(get_ccnum($1) <= get_ccnum($3)); }
|
||||||
| CCRelationalExpression '>' CCShiftExpression
|
| CCRelationalExpression '>' CCShiftExpression
|
||||||
{ FIXME("'>' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
|
{ $$ = ccval_bool(get_ccnum($1) > get_ccnum($3)); }
|
||||||
| CCRelationalExpression tGEQ CCShiftExpression
|
| CCRelationalExpression tGEQ CCShiftExpression
|
||||||
{ FIXME("'>=' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; }
|
{ $$ = ccval_bool(get_ccnum($1) >= get_ccnum($3)); }
|
||||||
|
|
||||||
CCShiftExpression
|
CCShiftExpression
|
||||||
: CCAdditiveExpression { $$ = $1; }
|
: CCAdditiveExpression { $$ = $1; }
|
||||||
|
|
|
@ -152,8 +152,33 @@ ok(@test === true, "@test = " + @test);
|
||||||
@set @test = (1==false+1)
|
@set @test = (1==false+1)
|
||||||
ok(@test === true, "@test = " + @test);
|
ok(@test === true, "@test = " + @test);
|
||||||
|
|
||||||
@set @test = (1+true==false+1)
|
function expect(val, exval) {
|
||||||
ok(@test === false, "@test = " + @test);
|
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)
|
@if (false)
|
||||||
this wouldn not parse
|
this wouldn not parse
|
||||||
|
|
Loading…
Reference in New Issue