From f7840a3e0bc07813246b2bad6bf4579848187908 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 3 Mar 2000 09:33:59 -0300 Subject: new algorithm to parse expressions + distribution of code between lparser and lcode. --- lparser.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'lparser.h') diff --git a/lparser.h b/lparser.h index aa47d0fd..2414a14c 100644 --- a/lparser.h +++ b/lparser.h @@ -1,5 +1,5 @@ /* -** $Id: lparser.h,v 1.5 1999/11/22 13:12:07 roberto Exp roberto $ +** $Id: lparser.h,v 1.6 2000/02/22 13:30:11 roberto Exp roberto $ ** LL(1) Parser and code generator for Lua ** See Copyright Notice in lua.h */ @@ -50,21 +50,19 @@ /* -** Variable descriptor: -** must include an `exp' option because LL(1) cannot distinguish -** between variables, upvalues and function calls on first sight. +** Expression descriptor */ typedef enum { VGLOBAL, /* info is constant index of global name */ VLOCAL, /* info is stack index */ VINDEXED, /* no info (table and index are on the stack) */ - VEXP /* info is pc index of a call (or 0 if exp is closed) */ -} varkind; + VEXP /* info is pc index of exp main operator */ +} expkind; -typedef struct vardesc { - varkind k; +typedef struct expdesc { + expkind k; int info; -} vardesc; +} expdesc; /* state needed to generate code for a given function */ @@ -78,7 +76,7 @@ typedef struct FuncState { int nupvalues; /* number of upvalues */ int nvars; /* number of entries in f->locvars (-1 if no debug information) */ int lastsetline; /* line where last SETLINE was issued */ - vardesc upvalues[MAXUPVALUES]; /* upvalues */ + expdesc upvalues[MAXUPVALUES]; /* upvalues */ TaggedString *localvar[MAXLOCALS]; /* store local variable names */ } FuncState; -- cgit v1.2.3-55-g6feb