More friendly error messages
This commit is contained in:
parent
e6cf500ea0
commit
7a94499916
@ -39,4 +39,9 @@ struct _C99
|
||||
int in_switch;
|
||||
};
|
||||
|
||||
|
||||
/* functions */
|
||||
/* accessors */
|
||||
char const * code_get_string(TokenCode code);
|
||||
|
||||
#endif /* !C99_C99_H */
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -47,6 +47,15 @@ static char * _tokens[] =
|
||||
};
|
||||
|
||||
|
||||
/* protected */
|
||||
/* functions */
|
||||
/* accessors */
|
||||
char const * code_get_string(TokenCode code)
|
||||
{
|
||||
return _tokens[code];
|
||||
}
|
||||
|
||||
|
||||
/* public */
|
||||
/* functions */
|
||||
/* useful */
|
||||
|
Loading…
Reference in New Issue
Block a user