mirror of https://github.com/rusefi/lua.git
more comments + reordeing of union inside 'expdesc' to allow
static initialization of a VKINT value
This commit is contained in:
parent
c0836dda74
commit
07cf8415e3
29
lparser.h
29
lparser.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lparser.h,v 1.74 2014/10/25 11:50:46 roberto Exp roberto $
|
||||
** $Id: lparser.h,v 1.75 2015/12/17 15:44:50 roberto Exp roberto $
|
||||
** Lua Parser
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -13,15 +13,18 @@
|
|||
|
||||
|
||||
/*
|
||||
** Expression descriptor.
|
||||
** Code generation for expressions can be delayed to allow
|
||||
** optimizations; An 'expdesc' structure describes a
|
||||
** potentially-delayed expression.
|
||||
** Expression and variable descriptor.
|
||||
** Code generation for variables and expressions can be delayed to allow
|
||||
** optimizations; An 'expdesc' structure describes a potentially-delayed
|
||||
** variable/expression. It has a description of its "main" value plus a
|
||||
** list of conditional jumps that can also produce its value (generated
|
||||
** by short-circuit operators 'and'/'or').
|
||||
*/
|
||||
|
||||
/* kinds of expressions */
|
||||
/* kinds of variables/expressions */
|
||||
typedef enum {
|
||||
VVOID, /* expression has no value */
|
||||
VVOID, /* when 'expdesc' describes the last expression a list,
|
||||
this kind means an empty list (so, no expression) */
|
||||
VNIL, /* constant nil */
|
||||
VTRUE, /* constant true */
|
||||
VFALSE, /* constant false */
|
||||
|
@ -31,11 +34,11 @@ typedef enum {
|
|||
VNONRELOC, /* expression has its value in a fixed register;
|
||||
info = result register */
|
||||
VLOCAL, /* local variable; info = local register */
|
||||
VUPVAL, /* upvalue; info = index of upvalue in 'upvalues' */
|
||||
VINDEXED, /* indexed expression;
|
||||
VUPVAL, /* upvalue variable; info = index of upvalue in 'upvalues' */
|
||||
VINDEXED, /* indexed variable;
|
||||
ind.vt = whether 't' is register or upvalue;
|
||||
ind.t = table register or upvalue;
|
||||
ind.idx = index as R/K */
|
||||
ind.idx = key's R/K index */
|
||||
VJMP, /* expression is a test/comparison;
|
||||
info = pc of corresponding jump instruction */
|
||||
VRELOCABLE, /* expression can put result in any register;
|
||||
|
@ -51,14 +54,14 @@ typedef enum {
|
|||
typedef struct expdesc {
|
||||
expkind k;
|
||||
union {
|
||||
lua_Integer ival; /* for VKINT */
|
||||
lua_Number nval; /* for VKFLT */
|
||||
int info; /* for generic use */
|
||||
struct { /* for indexed variables (VINDEXED) */
|
||||
short idx; /* index (R/K) */
|
||||
lu_byte t; /* table (register or upvalue) */
|
||||
lu_byte vt; /* whether 't' is register (VLOCAL) or upvalue (VUPVAL) */
|
||||
} ind;
|
||||
int info; /* for generic use */
|
||||
lua_Number nval; /* for VKFLT */
|
||||
lua_Integer ival; /* for VKINT */
|
||||
} u;
|
||||
int t; /* patch list of 'exit when true' */
|
||||
int f; /* patch list of 'exit when false' */
|
||||
|
|
Loading…
Reference in New Issue