jscript: Added support for '-' CC expression.
This commit is contained in:
parent
fcd9817581
commit
9b41bb0345
|
@ -66,6 +66,7 @@ static int cc_parser_lex(void *lval, parser_ctx_t *ctx)
|
|||
case '(':
|
||||
case ')':
|
||||
case '+':
|
||||
case '-':
|
||||
case '*':
|
||||
case '/':
|
||||
return *ctx->ptr++;
|
||||
|
@ -105,6 +106,8 @@ CCAdditiveExpression
|
|||
: CCMultiplicativeExpression { $$ = $1; }
|
||||
| CCAdditiveExpression '+' CCMultiplicativeExpression
|
||||
{ $$ = ccval_num(get_ccnum($1) + get_ccnum($3)); }
|
||||
| CCAdditiveExpression '-' CCMultiplicativeExpression
|
||||
{ $$ = ccval_num(get_ccnum($1) - get_ccnum($3)); }
|
||||
|
||||
CCMultiplicativeExpression
|
||||
: CCUnaryExpression { $$ = $1; }
|
||||
|
|
|
@ -140,6 +140,12 @@ ok(@test === false, "@test = " + @test);
|
|||
@set @test = (0 != true)
|
||||
ok(@test === true, "@test = " + @test);
|
||||
|
||||
@set @test = (true-2)
|
||||
ok(@test === -1, "@test = " + @test);
|
||||
|
||||
@set @test = (true-@_jscript)
|
||||
ok(@test === 0, "@test = " + @test);
|
||||
|
||||
@if (false)
|
||||
this wouldn not parse
|
||||
"@end
|
||||
|
|
Loading…
Reference in New Issue