compatibility with older versions: allow ? operator with missing :

This commit is contained in:
zimoch
2011-12-09 17:32:55 +00:00
parent 7f89ccdfba
commit 3eb1470713
+15 -8
View File
@@ -376,6 +376,7 @@ epicsShareFunc long
/* For : operator, also push COND_END code to stack */
if (pel->name[0] == ':') {
if (--cond_count < 0) {
fprintf(stderr, "postfix: ':' without '?'\n");
*perror = CALC_ERR_CONDITIONAL;
goto bad;
}
@@ -405,10 +406,13 @@ epicsShareFunc long
pstacktop--;
}
if (cond_count != 0) {
*perror = CALC_ERR_CONDITIONAL;
goto bad;
}
/*
* if (cond_count != 0) {
* fprintf(stderr, "postfix: unbalanced '?:' at ';'\n");
* *perror = CALC_ERR_CONDITIONAL;
* goto bad;
* }
*/
if (runtime_depth > 1) {
*perror = CALC_ERR_TOOMANY;
goto bad;
@@ -452,10 +456,13 @@ epicsShareFunc long
}
*pout = END_EXPRESSION;
if (cond_count != 0) {
*perror = CALC_ERR_CONDITIONAL;
goto bad;
}
/*
* if (cond_count != 0) {
* fprintf(stderr, "postfix: unbalanced '?:' at end of CALC\n");
* *perror = CALC_ERR_CONDITIONAL;
* goto bad;
* }
*/
if (operand_needed || runtime_depth != 1) {
*perror = CALC_ERR_INCOMPLETE;
goto bad;