diff options
author | Mattias Andrée <maandree@kth.se> | 2022-01-03 12:27:39 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-01-03 12:27:39 +0100 |
commit | 71e245e74c8c09c0b19cd2c99e3c348f8ee7477a (patch) | |
tree | 36b1ae0b0adfe5312afc170f0b58e5498c7463e1 /libparser-generate.c | |
parent | Update todo (diff) | |
download | libparser-1b843f035dbc61d94ad3226b38da60be3c6a59ed.tar.gz libparser-1b843f035dbc61d94ad3226b38da60be3c6a59ed.tar.bz2 libparser-1b843f035dbc61d94ad3226b38da60be3c6a59ed.tar.xz |
Fix reject and char-range support1.1.1
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libparser-generate.c')
-rw-r--r-- | libparser-generate.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libparser-generate.c b/libparser-generate.c index 9f82a2e..3f544c3 100644 --- a/libparser-generate.c +++ b/libparser-generate.c @@ -454,6 +454,8 @@ order_sentences(struct node *node) goto again_operators; } } else { + if (node->token->s[0] == '!') + node->data = order_sentences(node->data); *head = node; head = &node->next; } @@ -474,6 +476,7 @@ order_sentences(struct node *node) prev = stack->next->next->next; stack->data = stack->next->next; stack->data->next = stack->next; + stack->next->next = NULL; /* for debugging */ stack->next = prev; } } @@ -487,8 +490,7 @@ emit_and_free_rule(struct node *rule) { size_t index = 0; - if (rule->data->token->s[0] != '<') - rule->data = order_sentences(rule->data); + rule->data = order_sentences(rule->data); emit_and_free_sentence(rule->data, &index); printf("static struct libparser_rule rule_%zu = {\"%s\", &sentence_%zu_0};\n", nrule_names, rule->token->s, nrule_names); |