aboutsummaryrefslogtreecommitdiffstats
path: root/libparser-generate.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libparser-generate.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libparser-generate.c b/libparser-generate.c
index 47d2ebd..1ec2d6e 100644
--- a/libparser-generate.c
+++ b/libparser-generate.c
@@ -483,13 +483,11 @@ order_sentences(struct node *node)
* higher precedence */
goto push_to_stack;
} else if (node->token->s[0] == stack->token->s[0]) {
- /* If however our operator is the same as on the top
- * of the stack (meaning they have the same precedence),
- * we pop the top of the stack onto the queue, and push
- * our operator to the stack */
- *head = stack;
- head = &stack->next;
- stack = stack->next;
+ /* If our operator is the same as on the top of the
+ * stack (meaning they have the same precedence), we
+ * push it to the stack; but we do not pop the stack
+ * first because we want our operators to be associated
+ * right to left */
push_to_stack:
node->next = stack;
stack = node;