Skip to content

Commit

Permalink
Fix: wrong token printed in cases where a token is peeked
Browse files Browse the repository at this point in the history
  • Loading branch information
positively-charged committed Apr 22, 2017
1 parent a6e1a3a commit 036425b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/parse/phase.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ void p_diag( struct parse* parse, int flags, ... ) {
}

void p_unexpect_diag( struct parse* parse ) {
p_diag( parse, DIAG_POS_ERR | DIAG_SYNTAX, &parse->token->pos,
"unexpected %s", p_present_token_temp( parse, parse->token->type ) );
p_diag( parse, DIAG_POS_ERR | DIAG_SYNTAX, &parse->tk_pos,
"unexpected %s", p_present_token_temp( parse, parse->tk ) );
}

void p_unexpect_item( struct parse* parse, struct pos* pos, enum tk tk ) {
Expand All @@ -117,7 +117,7 @@ void p_unexpect_item( struct parse* parse, struct pos* pos, enum tk tk ) {

void p_unexpect_name( struct parse* parse, struct pos* pos,
const char* subject ) {
p_diag( parse, DIAG_POS, ( pos ? pos : &parse->token->pos ),
p_diag( parse, DIAG_POS, ( pos ? pos : &parse->tk_pos ),
"expecting %s here, or", subject );
}

Expand All @@ -127,10 +127,10 @@ void p_unexpect_last( struct parse* parse, struct pos* pos, enum tk tk ) {

void p_unexpect_last_name( struct parse* parse, struct pos* pos,
const char* subject ) {
p_diag( parse, DIAG_POS, ( pos ? pos : &parse->token->pos ),
p_diag( parse, DIAG_POS, ( pos ? pos : &parse->tk_pos ),
"expecting %s here", subject );
}

void p_bail( struct parse* parse ) {
t_bail( parse->task );
}
}

0 comments on commit 036425b

Please sign in to comment.