*** empty log message ***

This commit is contained in:
hyung-hwan 2006-01-13 11:25:52 +00:00
parent 5fc64d4b13
commit 7d46ae8684
2 changed files with 24 additions and 27 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: parse.c,v 1.16 2006-01-12 14:20:17 bacon Exp $ * $Id: parse.c,v 1.17 2006-01-13 11:25:52 bacon Exp $
*/ */
#include <xp/awk/awk.h> #include <xp/awk/awk.h>
@ -616,6 +616,7 @@ static xp_awk_node_t* __parse_primary (xp_awk_t* awk)
} }
else if (MATCH(awk,TOKEN_STRING)) { else if (MATCH(awk,TOKEN_STRING)) {
xp_awk_node_term_t* node; xp_awk_node_term_t* node;
node = (xp_awk_node_term_t*)xp_malloc(xp_sizeof(xp_awk_node_term_t)); node = (xp_awk_node_term_t*)xp_malloc(xp_sizeof(xp_awk_node_term_t));
if (node == XP_NULL) PANIC (awk, XP_AWK_ENOMEM); if (node == XP_NULL) PANIC (awk, XP_AWK_ENOMEM);
@ -639,7 +640,15 @@ static xp_awk_node_t* __parse_primary (xp_awk_t* awk)
CONSUME (awk); // error handling... replace it by get_token... CONSUME (awk); // error handling... replace it by get_token...
if (MATCH(awk,TOKEN_LPAREN)) { if (MATCH(awk,TOKEN_LPAREN)) {
/* function call */ /* function call */
// TODO: CONSUME (awk);
if (MATCH(awk,TOKEN_RPAREN)) {
/* function call of 0 arguments */
}
else {
tmp = __parse_expr (awk);
if (tmp == XP_NULL) {
}
}
} }
else { else {
xp_awk_node_term_t* node; xp_awk_node_term_t* node;
@ -654,34 +663,21 @@ static xp_awk_node_t* __parse_primary (xp_awk_t* awk)
return (xp_awk_node_t*)node; return (xp_awk_node_t*)node;
} }
} }
/*
else if (MATCH(awk,TOKEN_LPAREN)) { else if (MATCH(awk,TOKEN_LPAREN)) {
xp_awk_node_t* tmp; xp_awk_node_t* node;
xp_awk_node_term_t* node; -> use different type
CONSUME (awk); CONSUME (awk);
tmp = __parse_expr (awk); node = __parse_expr (awk);
if (tmp == XP_NULL) return XP_NULL; if (node == XP_NULL) return XP_NULL;
if (!MATCH(awk,TOKEN_RPAREN)) { if (!MATCH(awk,TOKEN_RPAREN)) {
// TODO: free tmp... // TODO: free tmp...
PANIC (awk, XP_AWK_RPAREN); PANIC (awk, XP_AWK_ERPAREN);
} }
CONSUME (awk); CONSUME (awk);
node = (xp_awk_node_term_t*)xp_malloc(xp_sizeof(xp_awk_node_term_t));
if (node == XP_NULL) {
// TODO: free tmp...
PANIC (awk, XP_AWK_ENOMEM);
}
node->type = XP_AWK_NODE_EXPR;
node->next = XP_NULL;
node->value = tmp;
return node; return node;
} }
*/
/* valid expression introducer is expected */ /* valid expression introducer is expected */
PANIC (awk, XP_AWK_EEXPR); PANIC (awk, XP_AWK_EEXPR);

View File

@ -1,5 +1,5 @@
/* /*
* $Id: tree.h,v 1.5 2006-01-12 14:20:17 bacon Exp $ * $Id: tree.h,v 1.6 2006-01-13 11:25:52 bacon Exp $
*/ */
#ifndef _XP_AWK_TREE_H_ #ifndef _XP_AWK_TREE_H_
@ -16,6 +16,7 @@ enum
XP_AWK_NODE_STR, XP_AWK_NODE_STR,
XP_AWK_NODE_NUM, XP_AWK_NODE_NUM,
XP_AWK_NODE_VAR, XP_AWK_NODE_VAR,
XP_AWK_NODE_CALL
}; };
typedef struct xp_awk_node_t xp_awk_node_t; typedef struct xp_awk_node_t xp_awk_node_t;
@ -36,13 +37,6 @@ struct xp_awk_node_t
XP_AWK_NODE_HDR; XP_AWK_NODE_HDR;
}; };
/*
struct xp_awk_node_plain_t
{
XP_AWK_NODE_HDR;
};
*/
struct xp_awk_node_block_t struct xp_awk_node_block_t
{ {
XP_AWK_NODE_HDR; XP_AWK_NODE_HDR;
@ -70,6 +64,13 @@ struct xp_awk_node_term_t
xp_char_t* value; xp_char_t* value;
}; };
struct xp_awk_node_call_t
{
XP_AWK_NODE_HDR;
xp_size_t nargs;
xp_char_t* value;
};
struct xp_awk_node_if_t struct xp_awk_node_if_t
{ {
XP_AWK_NODE_HDR; XP_AWK_NODE_HDR;