From fe9e12f34c0623c22448bbda4ed97a30146f77bf Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 6 Mar 2007 13:19:28 +0000 Subject: [PATCH] *** empty log message *** --- ase/awk/err.c | 10 ++++---- ase/awk/parse.c | 50 ++++++++-------------------------------- ase/test/awk/err-014.awk | 7 ++++++ ase/test/awk/err-015.awk | 3 +++ 4 files changed, 25 insertions(+), 45 deletions(-) create mode 100644 ase/test/awk/err-014.awk create mode 100644 ase/test/awk/err-015.awk diff --git a/ase/awk/err.c b/ase/awk/err.c index fc7fe578..8236a519 100644 --- a/ase/awk/err.c +++ b/ase/awk/err.c @@ -1,5 +1,5 @@ /* - * $Id: err.c,v 1.85 2007-03-05 14:58:36 bacon Exp $ + * $Id: err.c,v 1.86 2007-03-06 13:19:28 bacon Exp $ * * {License} */ @@ -60,14 +60,14 @@ static const ase_char_t* __geterrstr (int errnum) ASE_T("unexpected end of a string"), ASE_T("unexpected end of a regular expression"), ASE_T("a left brace expected"), - ASE_T("a left parenthesis expected"), + ASE_T("a left parenthesis expected in place of '%.*s'"), ASE_T("a right parenthesis expected in place of '%.*s'"), - ASE_T("a right bracket expected"), + ASE_T("a right bracket expected in place of '%.*s'"), ASE_T("a comma expected in place of '%.*s'"), ASE_T("a semicolon expected in place of '%.*s'"), - ASE_T("a colon expected"), + ASE_T("a colon expected in place of '%.*s'"), ASE_T("statement not ending with a semicolon"), - ASE_T("keyword 'in' expected"), + ASE_T("keyword 'in' expected in place of '%.*s'"), ASE_T("not a variable after 'in'"), ASE_T("expression expected"), diff --git a/ase/awk/parse.c b/ase/awk/parse.c index 2b1b114b..5ea8f129 100644 --- a/ase/awk/parse.c +++ b/ase/awk/parse.c @@ -1,5 +1,5 @@ /* - * $Id: parse.c,v 1.251 2007-03-05 14:58:36 bacon Exp $ + * $Id: parse.c,v 1.252 2007-03-06 13:19:28 bacon Exp $ * * {License} */ @@ -809,9 +809,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk) /* a function name is not followed by a left parenthesis */ ASE_AWK_FREE (awk, name_dup); - ase_awk_seterror_old ( - awk, ASE_AWK_ELPAREN, awk->token.line, - ASE_T("function name not followed by a left parenthesis")); + SET_ERROR_TOKEN (awk, ASE_AWK_ELPAREN); return ASE_NULL; } @@ -1888,18 +1886,7 @@ static ase_awk_nde_t* __parse_basic_expr (ase_awk_t* awk, ase_size_t line) if (!MATCH(awk,TOKEN_COLON)) { - if (MATCH(awk,TOKEN_EOF)) - { - ase_awk_seterror_old ( - awk, ASE_AWK_EENDSRC, - awk->token.prev.line, ASE_NULL); - } - else - { - ase_awk_seterror_old ( - awk, ASE_AWK_ECOLON, - awk->token.line, ASE_NULL); - } + SET_ERROR_TOKEN (awk, ASE_AWK_ECOLON); return ASE_NULL; } if (__get_token(awk) == -1) return ASE_NULL; @@ -2866,8 +2853,7 @@ static ase_awk_nde_t* __parse_primary (ase_awk_t* awk, ase_size_t line) { ase_awk_clrpt (awk, nde); - SET_ERROR_0 (awk, ASE_AWK_EIN, - ASE_T("'in' expected in place of '%.*s'")); + SET_ERROR_TOKEN (awk, ASE_AWK_EIN); return ASE_NULL; } } @@ -2994,16 +2980,9 @@ static ase_awk_nde_t* __parse_primary_ident (ase_awk_t* awk, ase_size_t line) { /* built-in function should be in the form * of the function call */ - - awk->prmfns.misc.sprintf ( - awk->prmfns.misc.custom_data, - awk->errmsg, ASE_COUNTOF(awk->errmsg), - ASE_T("function name '%.*s' without a left parenthesis"), - name_len, name_dup); - ASE_AWK_FREE (awk, name_dup); - ase_awk_seterror_old (awk, ASE_AWK_ELPAREN, line, awk->errmsg); + SET_ERROR_TOKEN (awk, ASE_AWK_ELPAREN); return ASE_NULL; } @@ -3166,8 +3145,7 @@ static ase_awk_nde_t* __parse_hashidx ( { ase_awk_clrpt (awk, idx); - SET_ERROR_0 (awk, ASE_AWK_ERBRACK, - ASE_T("right bracket expected in place of '%.*s'")); + SET_ERROR_TOKEN (awk, ASE_AWK_ERBRACK); return ASE_NULL; } @@ -3375,9 +3353,7 @@ static ase_awk_nde_t* __parse_if (ase_awk_t* awk, ase_size_t line) if (!MATCH(awk,TOKEN_LPAREN)) { - SET_ERROR_0 ( - awk, ASE_AWK_ELPAREN, - ASE_T("left parenthesis expected in place of '%.*s'")); + SET_ERROR_TOKEN (awk, ASE_AWK_ELPAREN); return ASE_NULL; } @@ -3456,9 +3432,7 @@ static ase_awk_nde_t* __parse_while (ase_awk_t* awk, ase_size_t line) if (!MATCH(awk,TOKEN_LPAREN)) { - SET_ERROR_0 ( - awk, ASE_AWK_ELPAREN, - ASE_T("left parenthesis expected in place of '%.*s'")); + SET_ERROR_TOKEN (awk, ASE_AWK_ELPAREN); return ASE_NULL; } if (__get_token(awk) == -1) return ASE_NULL; @@ -3516,9 +3490,7 @@ static ase_awk_nde_t* __parse_for (ase_awk_t* awk, ase_size_t line) if (!MATCH(awk,TOKEN_LPAREN)) { - SET_ERROR_0 ( - awk, ASE_AWK_ELPAREN, - ASE_T("left parenthesis expected in place of '%.*s'")); + SET_ERROR_TOKEN (awk, ASE_AWK_ELPAREN); return ASE_NULL; } if (__get_token(awk) == -1) return ASE_NULL; @@ -3717,9 +3689,7 @@ static ase_awk_nde_t* __parse_dowhile (ase_awk_t* awk, ase_size_t line) { ase_awk_clrpt (awk, body); - SET_ERROR_0 ( - awk, ASE_AWK_ELPAREN, - ASE_T("left parenthesis expected in place of '%.*s'")); + SET_ERROR_TOKEN (awk, ASE_AWK_ELPAREN); return ASE_NULL; } diff --git a/ase/test/awk/err-014.awk b/ase/test/awk/err-014.awk new file mode 100644 index 00000000..4a273de7 --- /dev/null +++ b/ase/test/awk/err-014.awk @@ -0,0 +1,7 @@ +BEGIN { + local a; + + a = 21; + print a > 20? 1 2; +} + diff --git a/ase/test/awk/err-015.awk b/ase/test/awk/err-015.awk new file mode 100644 index 00000000..638cba0c --- /dev/null +++ b/ase/test/awk/err-015.awk @@ -0,0 +1,3 @@ +BEGIN { + substr = 20; +}