Mercurial > ~dholland > hg > tradcpp > index.cgi
diff eval.c @ 91:bd1b7a09da89
Don't expect the eval result to contain EOF *then* a value.
author | David A. Holland |
---|---|
date | Mon, 10 Jun 2013 22:51:17 -0400 |
parents | 5e24746d8335 |
children | b127a69061b2 |
line wrap: on
line diff
--- a/eval.c Mon Jun 10 22:00:06 2013 -0400 +++ b/eval.c Mon Jun 10 22:51:17 2013 -0400 @@ -445,7 +445,7 @@ t5 = (num >= 5) ? tokenarray_get(&tokens, num-5) : NULL; t6 = (num >= 6) ? tokenarray_get(&tokens, num-6) : NULL; - if (num >=6 && + if (num >= 6 && t6->tok == T_VAL && t5->tok == T_QUES && t4->tok == T_VAL && @@ -688,9 +688,9 @@ if (num == 2) { t1 = tokenarray_get(&tokens, num-1); t2 = tokenarray_get(&tokens, num-2); - if (t1->tok == T_VAL && - t2->tok == T_EOF) { - result = t1->val != 0; + if (t2->tok == T_VAL && + t1->tok == T_EOF) { + result = t2->val != 0; } }