Allow negative dynamic precedences

This commit is contained in:
Max Brunsfeld 2017-07-06 22:21:59 -07:00
parent 107feb7960
commit 0de93b3bf2

View file

@ -1,6 +1,7 @@
#include "compiler/prepare_grammar/flatten_grammar.h"
#include <vector>
#include <cassert>
#include <cmath>
#include <algorithm>
#include "compiler/prepare_grammar/extract_choices.h"
#include "compiler/prepare_grammar/initial_syntax_grammar.h"
@ -42,7 +43,7 @@ class FlattenRule {
associativity_stack.push_back(metadata.params.associativity);
}
if (metadata.params.dynamic_precedence > production.dynamic_precedence) {
if (abs(metadata.params.dynamic_precedence) > abs(production.dynamic_precedence)) {
production.dynamic_precedence = metadata.params.dynamic_precedence;
}