fixed a small problem with the 'symmetric' option; also fixed a
authorceriel <none@none>
Tue, 19 Apr 1988 14:40:27 +0000 (14:40 +0000)
committerceriel <none@none>
Tue, 19 Apr 1988 14:40:27 +0000 (14:40 +0000)
problem with Hex numbers

lang/m2/comp/LLlex.c
lang/m2/comp/chk_expr.c
lang/m2/comp/error.c

index fc5e571..ca1b208 100644 (file)
@@ -434,7 +434,7 @@ again:
                                else {
                                        state = End;
                                        if (ch == 'H') base = 16;
-                                       UnloadChar(ch);
+                                       else UnloadChar(ch);
                                }
                                break;
 
index c0f6464..5684ffd 100644 (file)
@@ -101,14 +101,15 @@ MkCoercion(pnd, tp)
                                wmess = "conversion";
                        }
                        break;
-               case T_INTEGER:  {
-                       long i = min_int[(int)(tp->tp_size)];
-                       long j = nd->nd_INT & i;
-
-                       if (j != 0 && (nd_tp->tp_fund != T_INTEGER || j != i)) {
+               case T_INTEGER:
+                       if (! chk_bounds(nd->nd_INT,
+                                        max_int[(int)(tp->tp_size)],
+                                        nd_tp->tp_fund) ||
+                           ! chk_bounds(min_int[(int)(tp->tp_size)],
+                                        nd->nd_INT,
+                                        T_INTEGER)) {
                                wmess = "conversion";
                        }
-                       }
                        break;
                }
                if (wmess) {
@@ -818,7 +819,6 @@ ChkBinOper(expp)
 {
        /*      Check a binary operation.
        */
-       register t_node *left = expp->nd_left, *right = expp->nd_right;
        register t_type *tpl, *tpr;
        t_type *result_type;
        int allowed;
@@ -826,19 +826,19 @@ ChkBinOper(expp)
 
        /* First, check BOTH operands */
 
-       retval = ChkExpression(left) & ChkExpression(right);
+       retval = ChkExpression(expp->nd_left) & ChkExpression(expp->nd_right);
 
-       tpl = BaseType(left->nd_type);
-       tpr = BaseType(right->nd_type);
+       tpl = BaseType(expp->nd_left->nd_type);
+       tpr = BaseType(expp->nd_right->nd_type);
 
        if (tpl == intorcard_type) {
                if (tpr == int_type || tpr == card_type) {
-                        left->nd_type = tpl = tpr;
+                        expp->nd_left->nd_type = tpl = tpr;
                }
        }
        if (tpr == intorcard_type) {
                if (tpl == int_type || tpl == card_type) {
-                       right->nd_type = tpr = tpl;
+                       expp->nd_right->nd_type = tpr = tpl;
                }
        }
 
@@ -863,12 +863,11 @@ ChkBinOper(expp)
                           I don't know! Should we be allowed to check
                           if a INTEGER is a member of a BITSET???
                        */
-                       node_error(left, "type incompatibility in IN");
+                       node_error(expp->nd_left, "type incompatibility in IN");
                        return 0;
                }
                MkCoercion(&(expp->nd_left), word_type);
-               left = expp->nd_left;
-               if (left->nd_class == Value && right->nd_class == Set) {
+               if (expp->nd_left->nd_class == Value && expp->nd_right->nd_class == Set) {
                        cstset(expp);
                }
                return retval;
@@ -901,12 +900,14 @@ ChkBinOper(expp)
        }
 
        if (tpl->tp_fund == T_SET) {
-               if (left->nd_class == Set && right->nd_class == Set) {
+               if (expp->nd_left->nd_class == Set &&
+                   expp->nd_right->nd_class == Set) {
                        cstset(expp);
                }
        }
        else if ( tpl->tp_fund != T_REAL &&
-                 left->nd_class == Value && right->nd_class == Value) {
+                 expp->nd_left->nd_class == Value &&
+                 expp->nd_right->nd_class == Value) {
                if (expp->nd_left->nd_type->tp_fund == T_INTEGER) {
                        cstibin(expp);
                }
index 068f18f..6312b04 100644 (file)
@@ -208,7 +208,7 @@ _error(class, node, ap)
        switch (class)  {       
        case WARNING:
        case LEXWARNING:
-               if (! warn_class & warning_classes) return;
+               if (! (warn_class & warning_classes)) return;
                switch(warn_class) {
 #ifndef STRICT_3RD_ED
                case W_OLDFASHIONED: