Skip to content

Commit

Permalink
* core/syntax.g: reset P->source after every parse.
Browse files Browse the repository at this point in the history
  • Loading branch information
_why committed Aug 11, 2009
1 parent 04e1eeb commit 3cceae0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions core/syntax.g
Original file line number Diff line number Diff line change
Expand Up @@ -299,25 +299,30 @@ PN potion_parse(Potion *P, PN code) {
printf("** Syntax error!\n");
potion_code_parse_free(G);

return P->source;
code = P->source;
P->source = PN_NIL;
return code;
}

PN potion_sig(Potion *P, char *fmt) {
PN out = PN_NIL;
if (fmt == NULL) return PN_NIL; // no signature, arg check off
if (fmt[0] == '\0') return PN_FALSE; // empty signature, no args

GREG *G = potion_code_parse_new(P);
P->yypos = 0;
P->input = potion_byte_str(P, fmt);
P->source = PN_TUP0();
P->source = out = PN_TUP0();
P->pbuf = NULL;

G->pos = G->limit = 0;
if (!potion_code_parse_from(G, yy_sig))
printf("** Syntax error!\n");
potion_code_parse_free(G);

return P->source;
out = P->source;
P->source = PN_NIL;
return out;
}

int potion_sig_find(Potion *P, PN cl, PN name)
Expand Down

0 comments on commit 3cceae0

Please sign in to comment.