Skip to content
Snippets Groups Projects
Commit d3b74b14 authored by Andrea Shepard's avatar Andrea Shepard
Browse files

Merge branch 'ticket_60_bugfix' into 'master'

Ticket 60 bugfix

See merge request !43
parents ccdc35c8 14a8b9f1
No related branches found
Tags nightly_20200929
No related merge requests found
...@@ -174,9 +174,9 @@ static bool glr_step(HParseResult **result, HSlist *engines, ...@@ -174,9 +174,9 @@ static bool glr_step(HParseResult **result, HSlist *engines,
HSlistNode *x; HSlistNode *x;
for(x=engines->head; x; x=x->next) { for(x=engines->head; x; x=x->next) {
HLREngine *eng = x->elem; HLREngine *eng = x->elem;
if(eng->state == engine->state) { if(eng->state == engine->state && eng->input.index == engine->input.index) {
x->elem = lrengine_merge(eng, engine); x->elem = lrengine_merge(eng, engine);
break; break;
} }
} }
if(!x) // no merge happened if(!x) // no merge happened
......
...@@ -472,6 +472,57 @@ static void test_issue83() { ...@@ -472,6 +472,57 @@ static void test_issue83() {
g_check_cmp_int(r, ==, 0); g_check_cmp_int(r, ==, 0);
} }
static void test_bug60() {
//There is probably an even smaller example that shows the issue
HParser *zed = NULL;
HParser *alpha = NULL;
HParser *vchar = NULL;
HParser *why = NULL;
HParser *plural_zed = NULL;
HParser *plural_zed_zed = NULL;
HParser *a_to_zed = NULL;
HParser *alphas = NULL;
HParser *rule = NULL;
HParser *rulelist = NULL;
HParser *p = NULL;
HParseResult *r = NULL;
int n;
zed = h_ch('z');
vchar = h_ch_range(0x79, 0x7a); // allows y and z
alpha = h_ch('a');
why = h_ch('y');
plural_zed = h_sequence(
why,
h_many(h_choice(alpha, vchar, NULL)),
NULL);
plural_zed_zed = h_choice(plural_zed, zed, NULL);
alphas = h_choice(alpha, h_sequence(plural_zed_zed, alpha, NULL), NULL);
a_to_zed = h_sequence(
zed,
h_many(h_sequence(h_many1(alphas), zed, NULL)),
NULL);
rule = h_sequence(a_to_zed, plural_zed_zed, NULL);
rulelist = h_many1(h_choice(
rule,
h_sequence(h_many(alphas), plural_zed_zed, NULL),
NULL));
p = rulelist;
g_check_parse_ok(p, PB_GLR, "ayzza", 5);
g_check_parse_match(p, PB_GLR, "ayzza", 5, "(((u0x61) (u0x79 (u0x7a u0x7a u0x61))))");
}
void register_regression_tests(void) { void register_regression_tests(void) {
g_test_add_func("/core/regression/bug118", test_bug118); g_test_add_func("/core/regression/bug118", test_bug118);
g_test_add_func("/core/regression/seq_index_path", test_seq_index_path); g_test_add_func("/core/regression/seq_index_path", test_seq_index_path);
...@@ -488,4 +539,5 @@ void register_regression_tests(void) { ...@@ -488,4 +539,5 @@ void register_regression_tests(void) {
g_test_add_func("/core/regression/issue87", test_issue87); g_test_add_func("/core/regression/issue87", test_issue87);
g_test_add_func("/core/regression/issue92", test_issue92); g_test_add_func("/core/regression/issue92", test_issue92);
g_test_add_func("/core/regression/issue83", test_issue83); g_test_add_func("/core/regression/issue83", test_issue83);
g_test_add_func("/core/regression/bug60", test_bug60);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment