Mercurial > cpython-lru_cache-weakref
comparison Python/compile.c @ 388:31d509e94271 legacy-trunk
Comment out 'abort()' call.
Changed comparison operators.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Sun, 20 Oct 1991 20:12:38 +0000 |
| parents | 64189ba7e23b |
| children | b5fe6482072f |
comparison
equal
deleted
inserted
replaced
| 387:f01aee6155b3 | 388:31d509e94271 |
|---|---|
| 243 struct compiling *c; | 243 struct compiling *c; |
| 244 int byte; | 244 int byte; |
| 245 { | 245 { |
| 246 int len; | 246 int len; |
| 247 if (byte < 0 || byte > 255) { | 247 if (byte < 0 || byte > 255) { |
| 248 /* | |
| 248 fprintf(stderr, "XXX compiling bad byte: %d\n", byte); | 249 fprintf(stderr, "XXX compiling bad byte: %d\n", byte); |
| 249 abort(); | 250 abort(); |
| 251 */ | |
| 250 err_setstr(SystemError, "com_addbyte: byte out of range"); | 252 err_setstr(SystemError, "com_addbyte: byte out of range"); |
| 251 c->c_errors++; | 253 c->c_errors++; |
| 252 } | 254 } |
| 253 if (c->c_code == NULL) | 255 if (c->c_code == NULL) |
| 254 return; | 256 return; |
| 756 static enum cmp_op | 758 static enum cmp_op |
| 757 cmp_type(n) | 759 cmp_type(n) |
| 758 node *n; | 760 node *n; |
| 759 { | 761 { |
| 760 REQ(n, comp_op); | 762 REQ(n, comp_op); |
| 761 /* comp_op: '<' | '>' | '=' | '>' '=' | '<' '=' | '<' '>' | 763 /* comp_op: '<' | '>' | '=' | '>=' | '<=' | '<>' | '!=' | '==' |
| 762 | 'in' | 'not' 'in' | 'is' | 'is' not' */ | 764 | 'in' | 'not' 'in' | 'is' | 'is' not' */ |
| 763 if (NCH(n) == 1) { | 765 if (NCH(n) == 1) { |
| 764 n = CHILD(n, 0); | 766 n = CHILD(n, 0); |
| 765 switch (TYPE(n)) { | 767 switch (TYPE(n)) { |
| 766 case LESS: return LT; | 768 case LESS: return LT; |
| 767 case GREATER: return GT; | 769 case GREATER: return GT; |
| 770 case EQEQUAL: /* == */ | |
| 768 case EQUAL: return EQ; | 771 case EQUAL: return EQ; |
| 772 case LESSEQUAL: return LE; | |
| 773 case GREATEREQUAL: return GE; | |
| 774 case NOTEQUAL: return NE; /* <> or != */ | |
| 769 case NAME: if (strcmp(STR(n), "in") == 0) return IN; | 775 case NAME: if (strcmp(STR(n), "in") == 0) return IN; |
| 770 if (strcmp(STR(n), "is") == 0) return IS; | 776 if (strcmp(STR(n), "is") == 0) return IS; |
| 771 } | 777 } |
| 772 } | 778 } |
| 773 else if (NCH(n) == 2) { | 779 else if (NCH(n) == 2) { |
| 774 int t2 = TYPE(CHILD(n, 1)); | 780 int t2 = TYPE(CHILD(n, 1)); |
| 775 switch (TYPE(CHILD(n, 0))) { | 781 switch (TYPE(CHILD(n, 0))) { |
| 776 case LESS: if (t2 == EQUAL) return LE; | |
| 777 if (t2 == GREATER) return NE; | |
| 778 break; | |
| 779 case GREATER: if (t2 == EQUAL) return GE; | |
| 780 break; | |
| 781 case NAME: if (strcmp(STR(CHILD(n, 1)), "in") == 0) | 782 case NAME: if (strcmp(STR(CHILD(n, 1)), "in") == 0) |
| 782 return NOT_IN; | 783 return NOT_IN; |
| 783 if (strcmp(STR(CHILD(n, 0)), "is") == 0) | 784 if (strcmp(STR(CHILD(n, 0)), "is") == 0) |
| 784 return IS_NOT; | 785 return IS_NOT; |
| 785 } | 786 } |
