1
0
mirror of https://github.com/lua/lua.git synced 2025-01-28 06:03:00 +08:00

comments. (More explanation about kinds of expressions.)

This commit is contained in:
Roberto Ierusalimschy 2015-12-17 13:44:50 -02:00
parent a01eba657e
commit 19770b03a9

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lparser.h,v 1.73 2014/06/19 18:27:20 roberto Exp roberto $ ** $Id: lparser.h,v 1.74 2014/10/25 11:50:46 roberto Exp roberto $
** Lua Parser ** Lua Parser
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -13,25 +13,35 @@
/* /*
** Expression descriptor ** Expression descriptor.
** Code generation for expressions can be delayed to allow
** optimizations; An 'expdesc' structure describes a
** potentially-delayed expression.
*/ */
/* kinds of expressions */
typedef enum { typedef enum {
VVOID, /* no value */ VVOID, /* expression has no value */
VNIL, VNIL, /* constant nil */
VTRUE, VTRUE, /* constant true */
VFALSE, VFALSE, /* constant false */
VK, /* info = index of constant in 'k' */ VK, /* constant in 'k'; info = index of constant in 'k' */
VKFLT, /* nval = numerical float value */ VKFLT, /* floating constant; nval = numerical float value */
VKINT, /* nval = numerical integer value */ VKINT, /* integer constant; nval = numerical integer value */
VNONRELOC, /* info = result register */ VNONRELOC, /* expression has its value in a fixed register;
VLOCAL, /* info = local register */ info = result register */
VUPVAL, /* info = index of upvalue in 'upvalues' */ VLOCAL, /* local variable; info = local register */
VINDEXED, /* t = table register/upvalue; idx = index R/K */ VUPVAL, /* upvalue; info = index of upvalue in 'upvalues' */
VJMP, /* info = instruction pc */ VINDEXED, /* indexed expression;
VRELOCABLE, /* info = instruction pc */ ind.vt = whether 't' is register or upvalue;
VCALL, /* info = instruction pc */ ind.t = table register or upvalue;
VVARARG /* info = instruction pc */ ind.idx = index as R/K */
VJMP, /* expression is a test/comparison;
info = pc of corresponding jump instruction */
VRELOCABLE, /* expression can put result in any register;
info = instruction pc */
VCALL, /* expression is a function call; info = instruction pc */
VVARARG /* vararg expression; info = instruction pc */
} expkind; } expkind;