aboutsummaryrefslogtreecommitdiff
path: root/lua.stx
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-02-12 15:32:40 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-02-12 15:32:40 -0300
commit41259bff31dbb904edfb8070006ccb15577f8f04 (patch)
tree664bf9cbe6394e9074435ecf2bd710712b4537c3 /lua.stx
parentafaa98a666acd5f596b50f56bb288815838c096e (diff)
downloadlua-41259bff31dbb904edfb8070006ccb15577f8f04.tar.gz
lua-41259bff31dbb904edfb8070006ccb15577f8f04.tar.bz2
lua-41259bff31dbb904edfb8070006ccb15577f8f04.zip
BIG CHANGE: new data structure for constants, strings and globals, using
an array of hash tables for all them.
Diffstat (limited to 'lua.stx')
-rw-r--r--lua.stx14
1 files changed, 7 insertions, 7 deletions
diff --git a/lua.stx b/lua.stx
index b48b7e76..f16630d3 100644
--- a/lua.stx
+++ b/lua.stx
@@ -1,6 +1,6 @@
1%{ 1%{
2 2
3char *rcs_luastx = "$Id: lua.stx,v 3.28 1996/02/05 13:26:01 roberto Exp roberto $"; 3char *rcs_luastx = "$Id: lua.stx,v 3.29 1996/02/07 18:10:27 roberto Exp roberto $";
4 4
5#include <stdio.h> 5#include <stdio.h>
6#include <stdlib.h> 6#include <stdlib.h>
@@ -45,7 +45,7 @@ static Long varbuffer[MAXVAR]; /* variables in an assignment list;
45static int nvarbuffer=0; /* number of variables at a list */ 45static int nvarbuffer=0; /* number of variables at a list */
46 46
47#define MAXLOCALS 32 47#define MAXLOCALS 32
48static TreeNode *localvar[MAXLOCALS]; /* store local variable names */ 48static TaggedString *localvar[MAXLOCALS]; /* store local variable names */
49static int nlocalvar=0; /* number of local variables */ 49static int nlocalvar=0; /* number of local variables */
50 50
51#define MAXFIELDS FIELDS_PER_FLUSH*2 51#define MAXFIELDS FIELDS_PER_FLUSH*2
@@ -151,7 +151,7 @@ static void flush_list (int m, int n)
151 code_byte(n); 151 code_byte(n);
152} 152}
153 153
154static void store_localvar (TreeNode *name, int n) 154static void store_localvar (TaggedString *name, int n)
155{ 155{
156 if (nlocalvar+n < MAXLOCALS) 156 if (nlocalvar+n < MAXLOCALS)
157 localvar[nlocalvar+n] = name; 157 localvar[nlocalvar+n] = name;
@@ -161,7 +161,7 @@ static void store_localvar (TreeNode *name, int n)
161 luaI_registerlocalvar(name, lua_linenumber); 161 luaI_registerlocalvar(name, lua_linenumber);
162} 162}
163 163
164static void add_localvar (TreeNode *name) 164static void add_localvar (TaggedString *name)
165{ 165{
166 store_localvar(name, 0); 166 store_localvar(name, 0);
167 nlocalvar++; 167 nlocalvar++;
@@ -202,7 +202,7 @@ static void code_number (float f)
202/* 202/*
203** Search a local name and if find return its index. If do not find return -1 203** Search a local name and if find return its index. If do not find return -1
204*/ 204*/
205static int lua_localname (TreeNode *n) 205static int lua_localname (TaggedString *n)
206{ 206{
207 int i; 207 int i;
208 for (i=nlocalvar-1; i >= 0; i--) 208 for (i=nlocalvar-1; i >= 0; i--)
@@ -420,7 +420,7 @@ void lua_parse (TFunc *tf)
420 Word vWord; 420 Word vWord;
421 Long vLong; 421 Long vLong;
422 TFunc *pFunc; 422 TFunc *pFunc;
423 TreeNode *pNode; 423 TaggedString *pTStr;
424} 424}
425 425
426%start functionlist 426%start functionlist
@@ -433,7 +433,7 @@ void lua_parse (TFunc *tf)
433%token FUNCTION 433%token FUNCTION
434%token <vFloat> NUMBER 434%token <vFloat> NUMBER
435%token <vWord> STRING 435%token <vWord> STRING
436%token <pNode> NAME 436%token <pTStr> NAME
437%token <vInt> DEBUG 437%token <vInt> DEBUG
438 438
439%type <vLong> PrepJump 439%type <vLong> PrepJump