This commit is contained in:
hyung-hwan 2007-12-19 04:07:04 +00:00
parent dc2f886968
commit 9365283895

View File

@ -839,6 +839,7 @@ static ase_awk_nde_t* parse_function (ase_awk_t* awk)
return ASE_NULL; return ASE_NULL;
} }
#if 0
if (awk->option & ASE_AWK_UNIQUEFN) if (awk->option & ASE_AWK_UNIQUEFN)
{ {
/* check if it coincides to be a global variable name */ /* check if it coincides to be a global variable name */
@ -851,6 +852,7 @@ static ase_awk_nde_t* parse_function (ase_awk_t* awk)
return ASE_NULL; return ASE_NULL;
} }
} }
#endif
/* clone the function name before it is overwritten */ /* clone the function name before it is overwritten */
name_dup = ase_awk_strxdup (awk, name, name_len); name_dup = ase_awk_strxdup (awk, name, name_len);
@ -915,6 +917,7 @@ static ase_awk_nde_t* parse_function (ase_awk_t* awk)
param = ASE_STR_BUF(&awk->token.name); param = ASE_STR_BUF(&awk->token.name);
param_len = ASE_STR_LEN(&awk->token.name); param_len = ASE_STR_LEN(&awk->token.name);
#if 0
if (awk->option & ASE_AWK_UNIQUEFN) if (awk->option & ASE_AWK_UNIQUEFN)
{ {
/* check if a parameter conflicts with a function */ /* check if a parameter conflicts with a function */
@ -937,6 +940,7 @@ static ase_awk_nde_t* parse_function (ase_awk_t* awk)
* x in print x is a parameter * x in print x is a parameter
*/ */
} }
#endif
/* check if a parameter conflicts with other parameters */ /* check if a parameter conflicts with other parameters */
if (ase_awk_tab_find ( if (ase_awk_tab_find (
@ -1433,6 +1437,7 @@ static int add_global (
{ {
ase_size_t nglobals; ase_size_t nglobals;
#if 0
if (awk->option & ASE_AWK_UNIQUEFN) if (awk->option & ASE_AWK_UNIQUEFN)
{ {
/* check if it conflict with a builtin function name */ /* check if it conflict with a builtin function name */
@ -1453,6 +1458,7 @@ static int add_global (
return -1; return -1;
} }
} }
#endif
/* check if it conflicts with other global variable names */ /* check if it conflicts with other global variable names */
if (find_global (awk, name, len) != (ase_size_t)-1) if (find_global (awk, name, len) != (ase_size_t)-1)
@ -1597,8 +1603,11 @@ static ase_awk_t* collect_locals (ase_awk_t* awk, ase_size_t nlocals)
local = ASE_STR_BUF(&awk->token.name); local = ASE_STR_BUF(&awk->token.name);
local_len = ASE_STR_LEN(&awk->token.name); local_len = ASE_STR_LEN(&awk->token.name);
#if 0
if (awk->option & ASE_AWK_UNIQUEFN) if (awk->option & ASE_AWK_UNIQUEFN)
{ {
ase_bool_t iscur = ase_false;
/* check if it conflict with a builtin function name */ /* check if it conflict with a builtin function name */
if (ase_awk_getbfn (awk, local, local_len) != ASE_NULL) if (ase_awk_getbfn (awk, local, local_len) != ASE_NULL)
{ {
@ -1609,11 +1618,14 @@ static ase_awk_t* collect_locals (ase_awk_t* awk, ase_size_t nlocals)
} }
/* check if it conflict with a function name */ /* check if it conflict with a function name */
if (ase_strxncmp ( if (awk->tree.cur_afn.ptr != ASE_NULL)
{
iscur = (ase_strxncmp (
awk->tree.cur_afn.ptr, awk->tree.cur_afn.len, awk->tree.cur_afn.ptr, awk->tree.cur_afn.len,
local, local_len) == 0 || local, local_len) == 0);
ase_awk_map_get ( }
awk->tree.afns, local, local_len) != ASE_NULL)
if (iscur || ase_awk_map_get (awk->tree.afns, local, local_len) != ASE_NULL)
{ {
SETERRARG ( SETERRARG (
awk, ASE_AWK_EAFNRED, awk->token.line, awk, ASE_AWK_EAFNRED, awk->token.line,
@ -1621,6 +1633,7 @@ static ase_awk_t* collect_locals (ase_awk_t* awk, ase_size_t nlocals)
return ASE_NULL; return ASE_NULL;
} }
} }
#endif
/* check if it conflicts with a paremeter name */ /* check if it conflicts with a paremeter name */
n = ase_awk_tab_find (&awk->parse.params, 0, local, local_len); n = ase_awk_tab_find (&awk->parse.params, 0, local, local_len);
@ -3141,8 +3154,11 @@ static ase_awk_nde_t* parse_primary_ident (ase_awk_t* awk, ase_size_t line)
if (awk->option & ASE_AWK_IMPLICIT) if (awk->option & ASE_AWK_IMPLICIT)
{ {
#if 0
if (awk->option & ASE_AWK_UNIQUEFN) if (awk->option & ASE_AWK_UNIQUEFN)
{ {
ase_bool_t iscur;
/* the name should not conflict with a function name */ /* the name should not conflict with a function name */
/* check if it is a builtin function */ /* check if it is a builtin function */
if (ase_awk_getbfn (awk, name_dup, name_len) != ASE_NULL) if (ase_awk_getbfn (awk, name_dup, name_len) != ASE_NULL)
@ -3152,13 +3168,21 @@ static ase_awk_nde_t* parse_primary_ident (ase_awk_t* awk, ase_size_t line)
} }
/* check if it is an AWK function */ /* check if it is an AWK function */
if (ase_awk_map_get (awk->tree.afns, name_dup, name_len) != ASE_NULL) if (awk->tree.cur_afn.ptr != ASE_NULL)
{
iscur = (ase_strxncmp (
awk->tree.cur_afn.ptr, awk->tree.cur_afn.len,
name_dup, name_len) == 0);
}
if (iscur || ase_awk_map_get (awk->tree.afns, name_dup, name_len) != ASE_NULL)
{ {
/* the function is defined previously */ /* the function is defined previously */
SETERRARG (awk, ASE_AWK_EAFNRED, line, name_dup, name_len); SETERRARG (awk, ASE_AWK_EAFNRED, line, name_dup, name_len);
goto exit_func; goto exit_func;
} }
} }
#endif
nde->type = ASE_AWK_NDE_NAMED; nde->type = ASE_AWK_NDE_NAMED;
nde->line = line; nde->line = line;
@ -3295,8 +3319,11 @@ static ase_awk_nde_t* parse_hashidx (
if (awk->option & ASE_AWK_IMPLICIT) if (awk->option & ASE_AWK_IMPLICIT)
{ {
#if 0
if (awk->option & ASE_AWK_UNIQUEFN) if (awk->option & ASE_AWK_UNIQUEFN)
{ {
ase_bool_t iscur = ase_false;
/* check if it is a builtin function */ /* check if it is a builtin function */
if (ase_awk_getbfn (awk, name, name_len) != ASE_NULL) if (ase_awk_getbfn (awk, name, name_len) != ASE_NULL)
{ {
@ -3305,13 +3332,21 @@ static ase_awk_nde_t* parse_hashidx (
} }
/* check if it is an AWK function */ /* check if it is an AWK function */
if (ase_awk_map_get (awk->tree.afns, name, name_len) != ASE_NULL) if (awk->tree.cur_afn.ptr != ASE_NULL)
{
iscur = (ase_strxncmp (
awk->tree.cur_afn.ptr, awk->tree.cur_afn.len,
name, name_len) == 0);
}
if (iscur || ase_awk_map_get (awk->tree.afns, name, name_len) != ASE_NULL)
{ {
/* the function is defined previously */ /* the function is defined previously */
SETERRARG (awk, ASE_AWK_EAFNRED, line, name, name_len); SETERRARG (awk, ASE_AWK_EAFNRED, line, name, name_len);
goto exit_func; goto exit_func;
} }
} }
#endif
nde->type = ASE_AWK_NDE_NAMEDIDX; nde->type = ASE_AWK_NDE_NAMEDIDX;
nde->line = line; nde->line = line;