Mercurial > ~dholland > hg > tradcpp > index.cgi
comparison 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 |
comparison
equal
deleted
inserted
replaced
90:594495750d84 | 91:bd1b7a09da89 |
---|---|
443 } | 443 } |
444 | 444 |
445 t5 = (num >= 5) ? tokenarray_get(&tokens, num-5) : NULL; | 445 t5 = (num >= 5) ? tokenarray_get(&tokens, num-5) : NULL; |
446 t6 = (num >= 6) ? tokenarray_get(&tokens, num-6) : NULL; | 446 t6 = (num >= 6) ? tokenarray_get(&tokens, num-6) : NULL; |
447 | 447 |
448 if (num >=6 && | 448 if (num >= 6 && |
449 t6->tok == T_VAL && | 449 t6->tok == T_VAL && |
450 t5->tok == T_QUES && | 450 t5->tok == T_QUES && |
451 t4->tok == T_VAL && | 451 t4->tok == T_VAL && |
452 t3->tok == T_COLON && | 452 t3->tok == T_COLON && |
453 t2->tok == T_VAL && | 453 t2->tok == T_VAL && |
686 result = false; | 686 result = false; |
687 num = tokenarray_num(&tokens); | 687 num = tokenarray_num(&tokens); |
688 if (num == 2) { | 688 if (num == 2) { |
689 t1 = tokenarray_get(&tokens, num-1); | 689 t1 = tokenarray_get(&tokens, num-1); |
690 t2 = tokenarray_get(&tokens, num-2); | 690 t2 = tokenarray_get(&tokens, num-2); |
691 if (t1->tok == T_VAL && | 691 if (t2->tok == T_VAL && |
692 t2->tok == T_EOF) { | 692 t1->tok == T_EOF) { |
693 result = t1->val != 0; | 693 result = t2->val != 0; |
694 } | 694 } |
695 } | 695 } |
696 | 696 |
697 tokenarray_destroyall(&tokens); | 697 tokenarray_destroyall(&tokens); |
698 tokenarray_cleanup(&tokens); | 698 tokenarray_cleanup(&tokens); |