Browse Source

some bug fixes, there are still more to do.

master
Georg Hopp 19 years ago
parent
commit
5d97b20639
  1. 2
      include/variable.h
  2. 14
      src/tepal_pars.y
  3. 4
      src/variable.c

2
include/variable.h

@ -5,7 +5,7 @@
#include <expValue.h> #include <expValue.h>
#include <block.h> #include <block.h>
s_ident * getVariable (s_block *, char *);
s_ident * getVariable (s_identList *, char *);
s_ident * getArray (s_ident *, s_expVal *); s_ident * getArray (s_ident *, s_expVal *);
#endif /* _VARIABLE_H_ */ #endif /* _VARIABLE_H_ */

14
src/tepal_pars.y

@ -58,9 +58,13 @@ inline
enqGlobId (s_stmtQueue * sQueue, char * id) enqGlobId (s_stmtQueue * sQueue, char * id)
{ {
s_stmtQueue * ret = (sQueue == NULL) ? stmtQueueNew () : sQueue; 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; return ret;
} }
@ -363,7 +367,7 @@ genCastStringStmt (s_stmt * stmt)
%} %}
%token STMT_END ';' REPEAT COUNT FOREACH AS IF ELSE BLOCK_END UNSET %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 <cPtr> IDENT %token <cPtr> IDENT
%token <cPtr> HTML %token <cPtr> HTML
%token <iVal> INT %token <iVal> INT
@ -399,7 +403,6 @@ genCastStringStmt (s_stmt * stmt)
%type <stmt> expr; %type <stmt> expr;
%type <stmt> html; %type <stmt> html;
%type <stmt> block_stmt; %type <stmt> block_stmt;
%type <stmt> gdecl_block;
%type <stmt> simple_stmt; %type <stmt> simple_stmt;
%type <stmt> if_stmt; %type <stmt> if_stmt;
%type <stmt> rep_stmt; %type <stmt> rep_stmt;
@ -408,6 +411,7 @@ genCastStringStmt (s_stmt * stmt)
%type <sQue> stmt_queue; %type <sQue> stmt_queue;
%type <sQue> block_queue; %type <sQue> block_queue;
%type <sQue> glob_decl; %type <sQue> glob_decl;
%type <sQue> gdecl_block;
%expect 1 %expect 1
@ -459,7 +463,7 @@ block_queue : stmt_queue { $$ = genBlockQue (NULL, $1); }
* ------ * ------
*/ */
gdecl_block : GLOBAL ':' glob_decl BLOCK_END gdecl_block : GLOBAL ':' glob_decl BLOCK_END
{ $$ = $3); }
{ $$ = $3; }
; ;
glob_decl : IDENT { $$ = enqGlobId (NULL, $1); } glob_decl : IDENT { $$ = enqGlobId (NULL, $1); }

4
src/variable.c

@ -8,7 +8,7 @@
s_ident * s_ident *
getVariable (identList * iList, char * id)
getVariable (s_identList * iList, char * id)
{ {
return identListSeekKey (iList, 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 */ /* generate new idl if ident isn't, discard prev val */
if (identGetType (var) != ID_TYP_IDL) if (identGetType (var) != ID_TYP_IDL)
identSetIdl (var, identListNew (NULL));
identSetIdl (var, identListNew ());
/* now seek or generate the actual ident */ /* now seek or generate the actual ident */
switch (expValueGetType (eVal)) switch (expValueGetType (eVal))

Loading…
Cancel
Save