qse/ase/awk/err.c

60 lines
1.5 KiB
C
Raw Normal View History

2006-03-04 10:08:13 +00:00
/*
2006-04-10 15:52:07 +00:00
* $Id: err.c,v 1.9 2006-04-10 15:52:07 bacon Exp $
2006-03-04 10:08:13 +00:00
*/
2006-03-31 16:35:37 +00:00
#include <xp/awk/awk_i.h>
2006-03-04 10:08:13 +00:00
int xp_awk_geterrnum (xp_awk_t* awk)
{
return awk->errnum;
}
const xp_char_t* xp_awk_geterrstr (xp_awk_t* awk)
{
static const xp_char_t* __errstr[] =
{
XP_TEXT("no error"),
XP_TEXT("out of memory"),
XP_TEXT("cannot open source"),
XP_TEXT("cannot close source"),
XP_TEXT("cannot read source"),
XP_TEXT("invalid character"),
XP_TEXT("cannot unget character"),
2006-04-07 04:23:11 +00:00
2006-03-04 10:08:13 +00:00
XP_TEXT("unexpected end of source"),
2006-04-07 04:23:11 +00:00
XP_TEXT("unexpected end of a string"),
2006-03-04 10:08:13 +00:00
XP_TEXT("left brace expected"),
XP_TEXT("left parenthesis expected"),
XP_TEXT("right parenthesis expected"),
XP_TEXT("right bracket expected"),
XP_TEXT("comma expected"),
XP_TEXT("semicolon expected"),
2006-04-10 15:52:07 +00:00
XP_TEXT("colon expected"),
2006-03-04 10:08:13 +00:00
XP_TEXT("expression expected"),
2006-04-10 15:52:07 +00:00
2006-03-04 10:08:13 +00:00
XP_TEXT("keyword 'while' expected"),
XP_TEXT("assignment statement expected"),
XP_TEXT("identifier expected"),
XP_TEXT("duplicate BEGIN"),
XP_TEXT("duplicate END"),
XP_TEXT("duplicate function name"),
XP_TEXT("duplicate parameter name"),
XP_TEXT("duplicate variable name"),
XP_TEXT("duplicate name"),
2006-04-02 12:45:04 +00:00
XP_TEXT("undefined identifier"),
2006-04-05 15:56:20 +00:00
XP_TEXT("l-value required"),
2006-04-06 16:25:37 +00:00
XP_TEXT("divide by zero"),
2006-04-07 16:52:42 +00:00
XP_TEXT("invalid operand"),
2006-04-09 15:31:13 +00:00
XP_TEXT("no such function"),
2006-04-07 16:52:42 +00:00
XP_TEXT("internal error that should never have happened")
2006-03-04 10:08:13 +00:00
};
if (awk->errnum >= 0 && awk->errnum < xp_countof(__errstr)) {
return __errstr[awk->errnum];
}
return XP_TEXT("unknown error");
}