diff --git a/expression.c b/expression.c index 1e27e3b..e09eb7a 100644 --- a/expression.c +++ b/expression.c @@ -885,7 +885,7 @@ void ExpressionStackCollapse(struct ParseState *Parser, struct ExpressionStack * *StackTop = TopOperatorNode->Next->Next; /* do the infix operation */ - if (Parser->Mode == RunModeRun && FoundPrecedence < *IgnorePrecedence) + if (Parser->Mode == RunModeRun && FoundPrecedence <= *IgnorePrecedence) { /* run the operator */ ExpressionInfixOperator(Parser, StackTop, TopOperatorNode->Op, BottomValue, TopValue); @@ -1067,10 +1067,11 @@ int ExpressionParse(struct ParseState *Parser, struct Value **Result) Done = TRUE; } else + { + /* collapse to the bracket precedence */ + ExpressionStackCollapse(Parser, &StackTop, BracketPrecedence, &IgnorePrecedence); BracketPrecedence -= BRACKET_PRECEDENCE; - - /* collapse to the bracket precedence */ - ExpressionStackCollapse(Parser, &StackTop, BracketPrecedence, &IgnorePrecedence); + } break; default: diff --git a/tests/30_hanoi.c b/tests/30_hanoi.c index c5846c6..5ca6667 100644 --- a/tests/30_hanoi.c +++ b/tests/30_hanoi.c @@ -71,27 +71,9 @@ PrintAll() int Move(int *source, int *dest) { int i,j; - int done = FALSE; - - for (i=0; i