Skip to content

Commit

Permalink
Fix write_tables() based on accidentally reverted last fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Oct 5, 2022
1 parent 82420ef commit 3d204f2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/write_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -1124,21 +1124,23 @@ static void write_code(FILE *fp, Grammar *g, Rule *r, char *code, char *fname, i
*xx[0] = 0;
*xx[1] = 0;
while (*e != '}') {
char *ss = e, *n;
char *ss = e, *n, *s2;
x = xx[i];
y = xx[!i];
while (*e && *e != '}' && *e != ',') e++;
if (!*e || ss == e) d_fail("bad ${...} at line %d", line);
n = dup_str(ss, e);
if (!*y)
snprintf(x, 4095, "(D_PN(_children[%s], _offset))", n);
else
snprintf(x, 4095, "d_get_child(%s, %s)", y, n);
else {
s2 = dup_str(y, 0);
snprintf(x, 4095, "d_get_child(%s, %s)", s2, n);
}
if (*e == ',') e++;
if (isspace_(*e)) e++;
i = !i;
}
if (!xx[!i]) d_fail("empty ${child } at line %d", line);
//if (!xx[!i]) d_fail("empty ${child } at line %d", line);
fprintf(fp, "%s", xx[!i]);
} else if (STREQ(c, e - c, "reject")) {
fprintf(fp, " return -1 ");
Expand Down

0 comments on commit 3d204f2

Please sign in to comment.