handle -ve constants

This commit is contained in:
Bill Currie 2001-06-27 19:40:43 +00:00
parent 1fd4590212
commit 1eef491c1c

View file

@ -425,30 +425,34 @@ const
$$->type = ex_float; $$->type = ex_float;
$$->e.float_val = $1; $$->e.float_val = $1;
} }
| STRING_VAL {} | STRING_VAL
{ {
$$ = new_expr (); $$ = new_expr ();
$$->type = ex_string; $$->type = ex_string;
$$->e.string_val = $1; $$->e.string_val = $1;
} }
| VECTOR_VAL {} | VECTOR_VAL
{ {
$$ = new_expr (); $$ = new_expr ();
$$->type = ex_vector; $$->type = ex_vector;
memcpy ($$->e.vector_val, $1, sizeof ($$->e.vector_val)); memcpy ($$->e.vector_val, $1, sizeof ($$->e.vector_val));
} }
| QUATERNION_VAL {} | QUATERNION_VAL
{ {
$$ = new_expr (); $$ = new_expr ();
$$->type = ex_quaternion; $$->type = ex_quaternion;
memcpy ($$->e.quaternion_val, $1, sizeof ($$->e.quaternion_val)); memcpy ($$->e.quaternion_val, $1, sizeof ($$->e.quaternion_val));
} }
| INT_VAL {} | INT_VAL
{ {
$$ = new_expr (); $$ = new_expr ();
$$->type = ex_int; $$->type = ex_int;
$$->e.int_val = $1; $$->e.int_val = $1;
} }
| '-' const
{
$$ = unary_expr ('-', $2);
}
; ;
%% %%