*** empty log message ***

This commit is contained in:
hyung-hwan 2006-04-25 15:20:10 +00:00
parent 06562c78f4
commit fdfcbe168a
6 changed files with 50 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: parse.c,v 1.91 2006-04-24 15:34:52 bacon Exp $
* $Id: parse.c,v 1.92 2006-04-25 15:20:09 bacon Exp $
*/
#include <xp/awk/awk_i.h>
@ -47,6 +47,7 @@ enum
TOKEN_TILDE, /* used for unary bitwise-not and regex match */
TOKEN_RSHIFT,
TOKEN_LSHIFT,
TOKEN_IN,
TOKEN_EXP,
TOKEN_LPAREN,
@ -88,8 +89,6 @@ enum
TOKEN_LOCAL,
TOKEN_GLOBAL,
TOKEN_IN,
__TOKEN_COUNT__
};
@ -125,6 +124,7 @@ static xp_awk_nde_t* __parse_binary_expr (
static xp_awk_nde_t* __parse_logical_or (xp_awk_t* awk);
static xp_awk_nde_t* __parse_logical_and (xp_awk_t* awk);
static xp_awk_nde_t* __parse_in (xp_awk_t* awk);
static xp_awk_nde_t* __parse_regex_match (xp_awk_t* awk);
static xp_awk_nde_t* __parse_bitwise_or (xp_awk_t* awk);
static xp_awk_nde_t* __parse_bitwise_xor (xp_awk_t* awk);
@ -1060,6 +1060,8 @@ static xp_awk_nde_t* __parse_statement_nb (xp_awk_t* awk)
static xp_awk_nde_t* __parse_expression (xp_awk_t* awk)
{
return __parse_assignment (awk);
#if 0
xp_awk_nde_t* nde, * tmp;
do
@ -1069,13 +1071,19 @@ static xp_awk_nde_t* __parse_expression (xp_awk_t* awk)
nde = tmp; break; /* TODO */
if (!match(awk, TOKEN_COMMA)) break;
if (!MATCH(awk, TOKEN_COMMA)) break;
if (__get_token(awk) == -1) return XP_NULL;
}
while (1);
/*
if (!match(awk, TOKEN_IN))
{
}
*/
/* TODO: XP_AWK_NDE_GRP -> should i support i this way??? */
return nde;
#endif
}
static xp_awk_nde_t* __parse_assignment (xp_awk_t* awk)
@ -1319,6 +1327,17 @@ static xp_awk_nde_t* __parse_logical_and (xp_awk_t* awk)
{ TOKEN_EOF, 0 }
};
return __parse_binary_expr (awk, map, __parse_in);
}
static xp_awk_nde_t* __parse_in (xp_awk_t* awk)
{
__binmap_t map[] =
{
{ TOKEN_IN, XP_AWK_BINOP_IN },
{ TOKEN_EOF, 0 }
};
return __parse_binary_expr (awk, map, __parse_regex_match);
}
@ -2859,7 +2878,9 @@ static int __get_string (xp_awk_t* awk)
static int __get_regex (xp_awk_t* awk)
{
/* do proper regular expression parsing */
/* TODO: do proper regular expression parsing */
/* TODO: think if the new line should be allowed to
* be included in to a regular expression */
xp_cint_t c;
xp_bool_t escaped = xp_false;

View File

@ -1,5 +1,5 @@
/*
* $Id: run.c,v 1.74 2006-04-24 15:36:08 bacon Exp $
* $Id: run.c,v 1.75 2006-04-25 15:20:09 bacon Exp $
*/
#include <xp/awk/awk_i.h>
@ -71,6 +71,8 @@ static xp_awk_val_t* __eval_binop_lor (
xp_awk_run_t* run, xp_awk_val_t* left, xp_awk_val_t* right);
static xp_awk_val_t* __eval_binop_land (
xp_awk_run_t* run, xp_awk_val_t* left, xp_awk_val_t* right);
static xp_awk_val_t* __eval_binop_in (
xp_awk_run_t* run, xp_awk_val_t* left, xp_awk_val_t* right);
static xp_awk_val_t* __eval_binop_bor (
xp_awk_run_t* run, xp_awk_val_t* left, xp_awk_val_t* right);
static xp_awk_val_t* __eval_binop_bxor (
@ -856,15 +858,15 @@ static xp_awk_val_t* __eval_expression (xp_awk_run_t* run, xp_awk_nde_t* nde)
__eval_pos
};
xp_assert (nde->type >= XP_AWK_NDE_ASS &&
(nde->type - XP_AWK_NDE_ASS) < xp_countof(__eval_func));
return __eval_func[nde->type-XP_AWK_NDE_ASS] (run, nde);
xp_assert (nde->type >= XP_AWK_NDE_GRP &&
(nde->type - XP_AWK_NDE_GRP) < xp_countof(__eval_func));
return __eval_func[nde->type-XP_AWK_NDE_GRP] (run, nde);
}
static xp_awk_val_t* __eval_group (xp_awk_run_t* run, xp_awk_nde_t* nde)
{
/* NOT INIMPELMETED YET */
xp_printf (XP_TEXT("eval_group not implemented\n"));
xp_printf (XP_TEXT("***** eval_group not implemented\n"));
PANIC (run, XP_AWK_EINTERNAL);
return XP_NULL;
}
@ -1132,6 +1134,7 @@ static xp_awk_val_t* __eval_binary (xp_awk_run_t* run, xp_awk_nde_t* nde)
{
__eval_binop_lor,
__eval_binop_land,
__eval_binop_in,
__eval_binop_bor,
__eval_binop_bxor,
__eval_binop_band,
@ -1210,6 +1213,16 @@ static xp_awk_val_t* __eval_binop_land (
return res;
}
static xp_awk_val_t* __eval_binop_in (
xp_awk_run_t* run, xp_awk_val_t* left, xp_awk_val_t* right)
{
/* TODO: */
xp_printf (XP_TEXT("***** __eval_binop_in not implemented yet\n"));
PANIC (run, XP_AWK_EINTERNAL);
return XP_NULL;
}
static xp_awk_val_t* __eval_binop_bor (
xp_awk_run_t* run, xp_awk_val_t* left, xp_awk_val_t* right)
{

View File

@ -1,5 +1,5 @@
/*
* $Id: run.h,v 1.10 2006-04-22 13:54:52 bacon Exp $
* $Id: run.h,v 1.11 2006-04-25 15:20:09 bacon Exp $
*/
#ifndef _XP_AWK_RUN_H_
@ -27,6 +27,7 @@ enum
* __binop_str in tree.c and __binop_func in run.c accordingly. */
XP_AWK_BINOP_LOR,
XP_AWK_BINOP_LAND,
XP_AWK_BINOP_IN,
XP_AWK_BINOP_BOR,
XP_AWK_BINOP_BXOR,
XP_AWK_BINOP_BAND,

View File

@ -13,7 +13,7 @@ function sum(i, k, y)
}
BEGIN {
//s = sum(10000000);
/*s = sum(10000000);*/
s = sum (100);
}

View File

@ -17,7 +17,8 @@ function sum (i)
BEGIN
{
//x = sum (10000000);
/*x = sum (10000000);
*/
x = sum (100);
s = x;
ss = z;

View File

@ -1,4 +1,4 @@
//global x, j;
/*global x, j;*/
func func1 (x)
{