Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
lparser.h File Reference
#include "llimits.h"
#include "lobject.h"
#include "lzio.h"

Go to the source code of this file.

Data Structures

struct  expdesc
 
union  Vardesc
 
struct  Labeldesc
 
struct  Labellist
 
struct  Dyndata
 
struct  FuncState
 

Macros

#define vkisvar(k)   (VLOCAL <= (k) && (k) <= VINDEXSTR)
 
#define vkisindexed(k)   (VINDEXED <= (k) && (k) <= VINDEXSTR)
 
#define VDKREG   0 /* regular */
 
#define RDKCONST   1 /* constant */
 
#define RDKTOCLOSE   2 /* to-be-closed */
 
#define RDKCTC   3 /* compile-time constant */
 

Typedefs

typedef struct expdesc expdesc
 
typedef union Vardesc Vardesc
 
typedef struct Labeldesc Labeldesc
 
typedef struct Labellist Labellist
 
typedef struct Dyndata Dyndata
 
typedef struct FuncState FuncState
 

Enumerations

enum  expkind {
  VVOID , VNIL , VTRUE , VFALSE ,
  VK , VKFLT , VKINT , VKSTR ,
  VNONRELOC , VLOCAL , VUPVAL , VCONST ,
  VINDEXED , VINDEXUP , VINDEXI , VINDEXSTR ,
  VJMP , VRELOC , VCALL , VVARARG
}
 

Functions

LUAI_FUNC int luaY_nvarstack (FuncState *fs)
 
LUAI_FUNC LClosureluaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, Dyndata *dyd, const char *name, int firstchar)
 

Macro Definition Documentation

◆ RDKCONST

#define RDKCONST   1 /* constant */

Definition at line 91 of file lua-5.4.3/src/lparser.h.

Referenced by getlocalattribute(), and localstat().

◆ RDKCTC

#define RDKCTC   3 /* compile-time constant */

Definition at line 93 of file lua-5.4.3/src/lparser.h.

Referenced by localdebuginfo(), localstat(), reglevel(), and searchvar().

◆ RDKTOCLOSE

#define RDKTOCLOSE   2 /* to-be-closed */

Definition at line 92 of file lua-5.4.3/src/lparser.h.

Referenced by getlocalattribute(), and localstat().

◆ VDKREG

#define VDKREG   0 /* regular */

Definition at line 90 of file lua-5.4.3/src/lparser.h.

Referenced by check_readonly(), getlocalattribute(), mainfunc(), and new_localvar().

◆ vkisindexed

#define vkisindexed ( k)    (VINDEXED <= (k) && (k) <= VINDEXSTR)

Definition at line 65 of file lua-5.4.3/src/lparser.h.

Referenced by check_conflict(), and restassign().

◆ vkisvar

#define vkisvar ( k)    (VLOCAL <= (k) && (k) <= VINDEXSTR)

Definition at line 64 of file lua-5.4.3/src/lparser.h.

Typedef Documentation

◆ Dyndata

typedef struct Dyndata Dyndata

◆ expdesc

typedef struct expdesc expdesc

◆ FuncState

typedef struct FuncState FuncState

◆ Labeldesc

typedef struct Labeldesc Labeldesc

◆ Labellist

typedef struct Labellist Labellist

◆ Vardesc

typedef union Vardesc Vardesc

Enumeration Type Documentation

◆ expkind

enum expkind
Enumerator
VVOID 
VNIL 
VTRUE 
VFALSE 
VK 
VKFLT 
VKINT 
VKSTR 
VNONRELOC 
VLOCAL 
VUPVAL 
VCONST 
VINDEXED 
VINDEXUP 
VINDEXI 
VINDEXSTR 
VJMP 
VRELOC 
VCALL 
VVARARG 

Definition at line 25 of file lua-5.4.3/src/lparser.h.

25 {
26 VVOID, /* when 'expdesc' describes the last expression of a list,
27 this kind means an empty list (so, no expression) */
28 VNIL, /* constant nil */
29 VTRUE, /* constant true */
30 VFALSE, /* constant false */
31 VK, /* constant in 'k'; info = index of constant in 'k' */
32 VKFLT, /* floating constant; nval = numerical float value */
33 VKINT, /* integer constant; ival = numerical integer value */
34 VKSTR, /* string constant; strval = TString address;
35 (string is fixed by the lexer) */
36 VNONRELOC, /* expression has its value in a fixed register;
37 info = result register */
38 VLOCAL, /* local variable; var.ridx = register index;
39 var.vidx = relative index in 'actvar.arr' */
40 VUPVAL, /* upvalue variable; info = index of upvalue in 'upvalues' */
41 VCONST, /* compile-time <const> variable;
42 info = absolute index in 'actvar.arr' */
43 VINDEXED, /* indexed variable;
44 ind.t = table register;
45 ind.idx = key's R index */
46 VINDEXUP, /* indexed upvalue;
47 ind.t = table upvalue;
48 ind.idx = key's K index */
49 VINDEXI, /* indexed variable with constant integer;
50 ind.t = table register;
51 ind.idx = key's value */
52 VINDEXSTR, /* indexed variable with literal string;
53 ind.t = table register;
54 ind.idx = key's K index */
55 VJMP, /* expression is a test/comparison;
56 info = pc of corresponding jump instruction */
57 VRELOC, /* expression can put result in any register;
58 info = instruction pc */
59 VCALL, /* expression is a function call; info = instruction pc */
60 VVARARG /* vararg expression; info = instruction pc */
61} expkind;

Function Documentation

◆ luaY_nvarstack()

LUAI_FUNC int luaY_nvarstack ( FuncState * fs)

Definition at line 243 of file lua-5.4.3/src/lparser.c.

243 {
244 return reglevel(fs, fs->nactvar);
245}
static int reglevel(FuncState *fs, int nvar)

References FuncState::nactvar, and reglevel().

Referenced by adjustlocalvars(), close_func(), createlabel(), enterblock(), freereg(), gotostat(), luaK_exp2anyreg(), retstat(), and statement().

◆ luaY_parser()

LUAI_FUNC LClosure * luaY_parser ( lua_State * L,
ZIO * z,
Mbuffer * buff,
Dyndata * dyd,
const char * name,
int firstchar )

Definition at line 1618 of file lua-5.2.4/src/lparser.c.

1619 {
1620 LexState lexstate;
1621 FuncState funcstate;
1622 Closure *cl = luaF_newLclosure(L, 1); /* create main closure */
1623 /* anchor closure (to avoid being collected) */
1624 setclLvalue(L, L->top, cl);
1625 incr_top(L);
1626 funcstate.f = cl->l.p = luaF_newproto(L);
1627 funcstate.f->source = luaS_new(L, name); /* create and anchor TString */
1628 lexstate.buff = buff;
1629 lexstate.dyd = dyd;
1630 dyd->actvar.n = dyd->gt.n = dyd->label.n = 0;
1631 luaX_setinput(L, &lexstate, z, funcstate.f->source, firstchar);
1632 mainfunc(&lexstate, &funcstate);
1633 lua_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs);
1634 /* all scopes should be correctly finished */
1635 lua_assert(dyd->actvar.n == 0 && dyd->gt.n == 0 && dyd->label.n == 0);
1636 return cl; /* it's on the stack too */
1637}
const char * name
Definition lsqlite3.c:2154
#define incr_top(L)
Proto * luaF_newproto(lua_State *L)
Closure * luaF_newLclosure(lua_State *L, int nelems, Table *e)
void luaX_setinput(lua_State *L, LexState *ls, ZIO *z, TString *source)
#define lua_assert(c)
#define luaS_new(L, s)
#define setclLvalue(L, obj, x)
static void mainfunc(LexState *ls, FuncState *fs)
struct Dyndata::@63 actvar
struct FuncState * prev
struct Proto * p
struct FuncState * fs
struct Dyndata * dyd
Mbuffer * buff
TString * source

References Dyndata::actvar, LexState::buff, LexState::dyd, FuncState::f, LexState::fs, Dyndata::gt, LexState::h, incr_top, iswhite, Closure::l, Dyndata::label, lua_assert, luaC_objbarrier, luaD_inctop(), luaF_newLclosure(), luaF_newproto(), luaH_new(), luaS_new, luaX_setinput(), mainfunc(), mainfunc(), mainfunc(), Labellist::n, Dyndata::n, name, FuncState::nups, LClosure::p, FuncState::prev, setclLvalue, setclLvalue2s, sethvalue, sethvalue2s, Proto::source, and lua_State::top.