diff --git a/include/variable.h b/include/variable.h index c5ef74a..fd43a7f 100644 --- a/include/variable.h +++ b/include/variable.h @@ -5,7 +5,7 @@ #include #include -s_ident * getVariable (s_block *, char *); +s_ident * getVariable (s_identList *, char *); s_ident * getArray (s_ident *, s_expVal *); #endif /* _VARIABLE_H_ */ diff --git a/src/tepal_pars.y b/src/tepal_pars.y index b60534a..7afcacd 100644 --- a/src/tepal_pars.y +++ b/src/tepal_pars.y @@ -58,9 +58,13 @@ inline enqGlobId (s_stmtQueue * sQueue, char * id) { s_stmtQueue * ret = (sQueue == NULL) ? stmtQueueNew () : sQueue; - s_stmt * val = stmtNew (STMT_CONST, NULL, STYP_EVAL, (u_stmtType) id); + s_stmt * val = stmtNew ( + STMT_CONST, + NULL, + STYP_EVAL, + (u_stmtType) expValueStringNew (id)); - stmtQueueEnqueue (ret, id); + stmtQueueEnqueue (ret, val); return ret; } @@ -363,7 +367,7 @@ genCastStringStmt (s_stmt * stmt) %} %token STMT_END ';' REPEAT COUNT FOREACH AS IF ELSE BLOCK_END UNSET -%token ICAST FCAST SCAST GLOBAL /* for explicit casts */ +%token ICAST FCAST SCAST GLOBAL PARENT /* for explicit casts */ %token IDENT %token HTML %token INT @@ -399,7 +403,6 @@ genCastStringStmt (s_stmt * stmt) %type expr; %type html; %type block_stmt; -%type gdecl_block; %type simple_stmt; %type if_stmt; %type rep_stmt; @@ -408,6 +411,7 @@ genCastStringStmt (s_stmt * stmt) %type stmt_queue; %type block_queue; %type glob_decl; +%type gdecl_block; %expect 1 @@ -459,7 +463,7 @@ block_queue : stmt_queue { $$ = genBlockQue (NULL, $1); } * ------ */ gdecl_block : GLOBAL ':' glob_decl BLOCK_END - { $$ = $3); } + { $$ = $3; } ; glob_decl : IDENT { $$ = enqGlobId (NULL, $1); } diff --git a/src/variable.c b/src/variable.c index f09e1c2..a339eb1 100644 --- a/src/variable.c +++ b/src/variable.c @@ -8,7 +8,7 @@ s_ident * -getVariable (identList * iList, char * id) +getVariable (s_identList * iList, char * id) { return identListSeekKey (iList, id); } @@ -20,7 +20,7 @@ getArray (s_ident * var, s_expVal * eVal) /* generate new idl if ident isn't, discard prev val */ if (identGetType (var) != ID_TYP_IDL) - identSetIdl (var, identListNew (NULL)); + identSetIdl (var, identListNew ()); /* now seek or generate the actual ident */ switch (expValueGetType (eVal))