*** empty log message ***
This commit is contained in:
parent
8a7e79a9c9
commit
295058a3e5
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: err.c,v 1.87 2007-03-06 14:51:51 bacon Exp $
|
* $Id: err.c,v 1.88 2007-03-08 14:31:34 bacon Exp $
|
||||||
*
|
*
|
||||||
* {License}
|
* {License}
|
||||||
*/
|
*/
|
||||||
@ -59,7 +59,7 @@ static const ase_char_t* __geterrstr (int errnum)
|
|||||||
ASE_T("unexpected end of a comment"),
|
ASE_T("unexpected end of a comment"),
|
||||||
ASE_T("unexpected end of a string"),
|
ASE_T("unexpected end of a string"),
|
||||||
ASE_T("unexpected end of a regular expression"),
|
ASE_T("unexpected end of a regular expression"),
|
||||||
ASE_T("a left brace expected"),
|
ASE_T("a left brace expected n place of '%.*s'"),
|
||||||
ASE_T("a left parenthesis expected in place of '%.*s'"),
|
ASE_T("a left parenthesis expected in place of '%.*s'"),
|
||||||
ASE_T("a right parenthesis expected in place of '%.*s'"),
|
ASE_T("a right parenthesis expected in place of '%.*s'"),
|
||||||
ASE_T("a right bracket expected in place of '%.*s'"),
|
ASE_T("a right bracket expected in place of '%.*s'"),
|
||||||
@ -75,8 +75,8 @@ static const ase_char_t* __geterrstr (int errnum)
|
|||||||
ASE_T("assignment statement expected"),
|
ASE_T("assignment statement expected"),
|
||||||
ASE_T("identifier expected"),
|
ASE_T("identifier expected"),
|
||||||
ASE_T("'%.*s' not a valid function name"),
|
ASE_T("'%.*s' not a valid function name"),
|
||||||
ASE_T("BEGIN requires an action block"),
|
ASE_T("BEGIN not followed by a left bracket on the same line"),
|
||||||
ASE_T("END requires an action block"),
|
ASE_T("END not followed by a left bracket on the same line"),
|
||||||
ASE_T("duplicate BEGIN"),
|
ASE_T("duplicate BEGIN"),
|
||||||
ASE_T("duplicate END"),
|
ASE_T("duplicate END"),
|
||||||
ASE_T("built-in function '%.*s' redefined"),
|
ASE_T("built-in function '%.*s' redefined"),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: parse.c,v 1.253 2007-03-06 14:51:52 bacon Exp $
|
* $Id: parse.c,v 1.254 2007-03-08 14:31:34 bacon Exp $
|
||||||
*
|
*
|
||||||
* {License}
|
* {License}
|
||||||
*/
|
*/
|
||||||
@ -573,17 +573,15 @@ static ase_awk_t* __parse_progunit (ase_awk_t* awk)
|
|||||||
{
|
{
|
||||||
/* when the blockless pattern is supported
|
/* when the blockless pattern is supported
|
||||||
* BEGIN and { should be located on the same line */
|
* BEGIN and { should be located on the same line */
|
||||||
ase_awk_seterror_old (
|
ase_awk_seterror (
|
||||||
awk, ASE_AWK_EBLKBEG, awk->token.prev.line,
|
awk, ASE_AWK_EBLKBEG, awk->token.prev.line,
|
||||||
ASE_T("BEGIN not followed by a left bracket on the same line"));
|
ASE_NULL, 0);
|
||||||
return ASE_NULL;
|
return ASE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!MATCH(awk,TOKEN_LBRACE))
|
if (!MATCH(awk,TOKEN_LBRACE))
|
||||||
{
|
{
|
||||||
ase_awk_seterror_old (
|
SET_ERROR_TOKEN (awk, ASE_AWK_ELBRACE);
|
||||||
awk, ASE_AWK_ELBRACE, awk->token.prev.line,
|
|
||||||
ASE_T("BEGIN not followed by a left bracket"));
|
|
||||||
return ASE_NULL;
|
return ASE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -600,17 +598,15 @@ static ase_awk_t* __parse_progunit (ase_awk_t* awk)
|
|||||||
{
|
{
|
||||||
/* when the blockless pattern is supported
|
/* when the blockless pattern is supported
|
||||||
* END and { should be located on the same line */
|
* END and { should be located on the same line */
|
||||||
ase_awk_seterror_old (
|
ase_awk_seterror (
|
||||||
awk, ASE_AWK_EBLKEND, awk->token.prev.line,
|
awk, ASE_AWK_EBLKEND, awk->token.prev.line,
|
||||||
ASE_T("END not followed by a left bracket on the same line"));
|
ASE_NULL, 0);
|
||||||
return ASE_NULL;
|
return ASE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!MATCH(awk,TOKEN_LBRACE))
|
if (!MATCH(awk,TOKEN_LBRACE))
|
||||||
{
|
{
|
||||||
ase_awk_seterror_old (
|
SET_ERROR_TOKEN (awk, ASE_AWK_ELBRACE);
|
||||||
awk, ASE_AWK_ELBRACE, awk->token.prev.line,
|
|
||||||
ASE_T("END not followed by a left bracket"));
|
|
||||||
return ASE_NULL;
|
return ASE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,10 +688,7 @@ static ase_awk_t* __parse_progunit (ase_awk_t* awk)
|
|||||||
if (!MATCH(awk,TOKEN_LBRACE))
|
if (!MATCH(awk,TOKEN_LBRACE))
|
||||||
{
|
{
|
||||||
ase_awk_clrpt (awk, ptn);
|
ase_awk_clrpt (awk, ptn);
|
||||||
ase_awk_seterror_old (
|
SET_ERROR_TOKEN (awk, ASE_AWK_ELBRACE);
|
||||||
awk, ASE_AWK_ELBRACE,
|
|
||||||
(MATCH(awk,TOKEN_EOF)? awk->token.prev.line: awk->token.line),
|
|
||||||
ASE_T("not a valid start of a block"));
|
|
||||||
return ASE_NULL;
|
return ASE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -992,26 +985,7 @@ static ase_awk_nde_t* __parse_function (ase_awk_t* awk)
|
|||||||
ASE_AWK_FREE (awk, name_dup);
|
ASE_AWK_FREE (awk, name_dup);
|
||||||
ase_awk_tab_clear (&awk->parse.params);
|
ase_awk_tab_clear (&awk->parse.params);
|
||||||
|
|
||||||
if (MATCH(awk,TOKEN_EOF))
|
SET_ERROR_TOKEN (awk, ASE_AWK_ELBRACE);
|
||||||
{
|
|
||||||
ase_awk_seterror_old (
|
|
||||||
awk, ASE_AWK_EENDSRC, awk->token.prev.line,
|
|
||||||
ASE_NULL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
awk->prmfns.misc.sprintf (
|
|
||||||
awk->prmfns.misc.custom_data,
|
|
||||||
awk->errmsg, ASE_COUNTOF(awk->errmsg),
|
|
||||||
ASE_T("'%.*s' not a valid start of the function body"),
|
|
||||||
ASE_STR_LEN(&awk->token.name),
|
|
||||||
ASE_STR_BUF(&awk->token.name));
|
|
||||||
|
|
||||||
ase_awk_seterror_old (
|
|
||||||
awk, ASE_AWK_ELBRACE, awk->token.line,
|
|
||||||
awk->errmsg);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ASE_NULL;
|
return ASE_NULL;
|
||||||
}
|
}
|
||||||
if (__get_token(awk) == -1)
|
if (__get_token(awk) == -1)
|
||||||
|
5
ase/test/awk/err-016.awk
Normal file
5
ase/test/awk/err-016.awk
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
BEGIN
|
||||||
|
{
|
||||||
|
print "hello world";
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user