harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit ce285b31adbbcaf40fe5d19f671a02bffae2c49a
parent 68a075ec81aaec95824e9200e8333b12cb1972a1
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Tue,  8 Dec 2020 23:01:33 -0500

parse: want: handle null tok

Diffstat:
Msrc/parse.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/parse.c b/src/parse.c @@ -45,10 +45,11 @@ static void want(struct parser *par, enum lexical_token ltok, struct token *tok) { struct token _tok = {0}; - lex(par->lex, tok ? tok : &_tok); - synassert(tok->token == ltok, tok ? tok : &_tok, ltok, T_EOF); + struct token *out = tok ? tok : &_tok; + lex(par->lex, out); + synassert(out->token == ltok, out, ltok, T_EOF); if (!tok) { - token_finish(&_tok); + token_finish(out); } }