More friendly error messages

This commit is contained in:
Pierre Pronchery 2008-03-11 16:40:36 +00:00
parent e6cf500ea0
commit 7a94499916
3 changed files with 15 additions and 2 deletions

View File

@ -39,4 +39,9 @@ struct _C99
int in_switch;
};
/* functions */
/* accessors */
char const * code_get_string(TokenCode code);
#endif /* !C99_C99_H */

View File

@ -100,8 +100,7 @@ static int _parse_check(C99 * c99, TokenCode code)
int ret;
if((ret = (token_get_code(c99->token) != code)))
/* FIXME use a string for the code */
_parse_error(c99, "%s%x", "Expected code 0x", code);
_parse_error(c99, "Expected \"%s\"", code_get_string(code));
c99_scan(c99);
return ret;
}

View File

@ -47,6 +47,15 @@ static char * _tokens[] =
};
/* protected */
/* functions */
/* accessors */
char const * code_get_string(TokenCode code)
{
return _tokens[code];
}
/* public */
/* functions */
/* useful */