first implementation of unrestricted static scoping
This commit is contained in:
20
lparser.h
20
lparser.h
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lparser.h,v 1.33 2001/08/10 20:53:03 roberto Exp roberto $
|
||||
** $Id: lparser.h,v 1.34 2001/08/27 15:16:28 roberto Exp $
|
||||
** Lua Parser
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -7,11 +7,24 @@
|
||||
#ifndef lparser_h
|
||||
#define lparser_h
|
||||
|
||||
#include "llimits.h"
|
||||
#include "lobject.h"
|
||||
#include "ltable.h"
|
||||
#include "lzio.h"
|
||||
|
||||
|
||||
|
||||
/* small implementation of bit arrays */
|
||||
|
||||
#define BPW (CHAR_BIT*sizeof(unsigned int)) /* bits per word */
|
||||
|
||||
#define words2bits(b) (((b)-1)/BPW + 1)
|
||||
|
||||
#define setbit(a, b) ((a)[(b)/BPW] |= (1 << (b)%BPW))
|
||||
#define resetbit(a, b) ((a)[(b)/BPW] &= ~((1 << (b)%BPW)))
|
||||
#define testbit(a, b) ((a)[(b)/BPW] & (1 << (b)%BPW))
|
||||
|
||||
|
||||
/*
|
||||
** Expression descriptor
|
||||
*/
|
||||
@@ -21,8 +34,9 @@ typedef enum {
|
||||
VNIL,
|
||||
VNUMBER, /* n = value */
|
||||
VK, /* info = index of constant in `k' */
|
||||
VGLOBAL, /* info = index of global name in `k' */
|
||||
VLOCAL, /* info = local register */
|
||||
VUPVAL, /* info = index of upvalue in `upvalues' */
|
||||
VGLOBAL, /* info = index of global name in `k' */
|
||||
VINDEXED, /* info = table register; aux = index register (or `k') */
|
||||
VRELOCABLE, /* info = instruction pc */
|
||||
VNONRELOC, /* info = result register */
|
||||
@@ -63,6 +77,8 @@ typedef struct FuncState {
|
||||
struct Breaklabel *bl; /* chain of breakable blocks */
|
||||
expdesc upvalues[MAXUPVALUES]; /* upvalues */
|
||||
int actloc[MAXLOCALS]; /* local-variable stack (indices to locvars) */
|
||||
unsigned int wasup[words2bits(MAXLOCALS)]; /* bit array to mark whether a
|
||||
local variable was used as upvalue at some level */
|
||||
} FuncState;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user