lua5.4
| 宏定义 | 类型定义 | 函数 | 变量
lparser.c 文件参考
#include "lprefix.h"
#include <limits.h>
#include <string.h>
#include "lua.h"
#include "lcode.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "llex.h"
#include "lmem.h"
#include "lobject.h"
#include "lopcodes.h"
#include "lparser.h"
#include "lstate.h"
#include "lstring.h"
#include "ltable.h"
lparser.c 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

struct  BlockCnt
 
struct  ConsControl
 
struct  LHS_assign
 

宏定义

#define lparser_c
 
#define LUA_CORE
 
#define MAXVARS   200
 
#define hasmultret(k)   ((k) == VCALL || (k) == VVARARG)
 
#define eqstr(a, b)   ((a) == (b))
 
#define check_condition(ls, c, msg)   { if (!(c)) luaX_syntaxerror(ls, msg); }
 
#define new_localvarliteral(ls, v)
 
#define enterlevel(ls)   luaE_incCstack(ls->L)
 
#define leavelevel(ls)   ((ls)->L->nCcalls--)
 
#define UNARY_PRIORITY   12 /* priority for unary operators */
 

类型定义

typedef struct BlockCnt BlockCnt
 
typedef struct ConsControl ConsControl
 

函数

static void statement (LexState *ls)
 
static void expr (LexState *ls, expdesc *v)
 
static l_noret error_expected (LexState *ls, int token)
 
static l_noret errorlimit (FuncState *fs, int limit, const char *what)
 
static void checklimit (FuncState *fs, int v, int l, const char *what)
 
static int testnext (LexState *ls, int c)
 
static void check (LexState *ls, int c)
 
static void checknext (LexState *ls, int c)
 
static void check_match (LexState *ls, int what, int who, int where)
 
static TStringstr_checkname (LexState *ls)
 
static void init_exp (expdesc *e, expkind k, int i)
 
static void codestring (expdesc *e, TString *s)
 
static void codename (LexState *ls, expdesc *e)
 
static int registerlocalvar (LexState *ls, FuncState *fs, TString *varname)
 
static int new_localvar (LexState *ls, TString *name)
 
static Vardescgetlocalvardesc (FuncState *fs, int vidx)
 
static int reglevel (FuncState *fs, int nvar)
 
int luaY_nvarstack (FuncState *fs)
 
static LocVarlocaldebuginfo (FuncState *fs, int vidx)
 
static void init_var (FuncState *fs, expdesc *e, int vidx)
 
static void check_readonly (LexState *ls, expdesc *e)
 
static void adjustlocalvars (LexState *ls, int nvars)
 
static void removevars (FuncState *fs, int tolevel)
 
static int searchupvalue (FuncState *fs, TString *name)
 
static Upvaldescallocupvalue (FuncState *fs)
 
static int newupvalue (FuncState *fs, TString *name, expdesc *v)
 
static int searchvar (FuncState *fs, TString *n, expdesc *var)
 
static void markupval (FuncState *fs, int level)
 
static void singlevaraux (FuncState *fs, TString *n, expdesc *var, int base)
 
static void singlevar (LexState *ls, expdesc *var)
 
static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e)
 
static l_noret jumpscopeerror (LexState *ls, Labeldesc *gt)
 
static void solvegoto (LexState *ls, int g, Labeldesc *label)
 
static Labeldescfindlabel (LexState *ls, TString *name)
 
static int newlabelentry (LexState *ls, Labellist *l, TString *name, int line, int pc)
 
static int newgotoentry (LexState *ls, TString *name, int line, int pc)
 
static int solvegotos (LexState *ls, Labeldesc *lb)
 
static int createlabel (LexState *ls, TString *name, int line, int last)
 
static void movegotosout (FuncState *fs, BlockCnt *bl)
 
static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isloop)
 
static l_noret undefgoto (LexState *ls, Labeldesc *gt)
 
static void leaveblock (FuncState *fs)
 
static Protoaddprototype (LexState *ls)
 
static void codeclosure (LexState *ls, expdesc *v)
 
static void open_func (LexState *ls, FuncState *fs, BlockCnt *bl)
 
static void close_func (LexState *ls)
 
static int block_follow (LexState *ls, int withuntil)
 
static void statlist (LexState *ls)
 
static void fieldsel (LexState *ls, expdesc *v)
 
static void yindex (LexState *ls, expdesc *v)
 
static void recfield (LexState *ls, ConsControl *cc)
 
static void closelistfield (FuncState *fs, ConsControl *cc)
 
static void lastlistfield (FuncState *fs, ConsControl *cc)
 
static void listfield (LexState *ls, ConsControl *cc)
 
static void field (LexState *ls, ConsControl *cc)
 
static void constructor (LexState *ls, expdesc *t)
 
static void setvararg (FuncState *fs, int nparams)
 
static void parlist (LexState *ls)
 
static void body (LexState *ls, expdesc *e, int ismethod, int line)
 
static int explist (LexState *ls, expdesc *v)
 
static void funcargs (LexState *ls, expdesc *f, int line)
 
static void primaryexp (LexState *ls, expdesc *v)
 
static void suffixedexp (LexState *ls, expdesc *v)
 
static void simpleexp (LexState *ls, expdesc *v)
 
static UnOpr getunopr (int op)
 
static BinOpr getbinopr (int op)
 
static BinOpr subexpr (LexState *ls, expdesc *v, int limit)
 
static void block (LexState *ls)
 
static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v)
 
static void restassign (LexState *ls, struct LHS_assign *lh, int nvars)
 
static int cond (LexState *ls)
 
static void gotostat (LexState *ls)
 
static void breakstat (LexState *ls)
 
static void checkrepeated (LexState *ls, TString *name)
 
static void labelstat (LexState *ls, TString *name, int line)
 
static void whilestat (LexState *ls, int line)
 
static void repeatstat (LexState *ls, int line)
 
static void exp1 (LexState *ls)
 
static void fixforjump (FuncState *fs, int pc, int dest, int back)
 
static void forbody (LexState *ls, int base, int line, int nvars, int isgen)
 
static void fornum (LexState *ls, TString *varname, int line)
 
static void forlist (LexState *ls, TString *indexname)
 
static void forstat (LexState *ls, int line)
 
static void test_then_block (LexState *ls, int *escapelist)
 
static void ifstat (LexState *ls, int line)
 
static void localfunc (LexState *ls)
 
static int getlocalattribute (LexState *ls)
 
static void checktoclose (LexState *ls, int level)
 
static void localstat (LexState *ls)
 
static int funcname (LexState *ls, expdesc *v)
 
static void funcstat (LexState *ls, int line)
 
static void exprstat (LexState *ls)
 
static void retstat (LexState *ls)
 
static void mainfunc (LexState *ls, FuncState *fs)
 
LClosureluaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, Dyndata *dyd, const char *name, int firstchar)
 

变量

struct {
   lu_byte   left
 
   lu_byte   right
 
priority []
 

宏定义说明

◆ check_condition

#define check_condition (   ls,
  c,
  msg 
)    { if (!(c)) luaX_syntaxerror(ls, msg); }

◆ enterlevel

#define enterlevel (   ls)    luaE_incCstack(ls->L)

◆ eqstr

#define eqstr (   a,
 
)    ((a) == (b))

◆ hasmultret

#define hasmultret (   k)    ((k) == VCALL || (k) == VVARARG)

◆ leavelevel

#define leavelevel (   ls)    ((ls)->L->nCcalls--)

◆ lparser_c

#define lparser_c

◆ LUA_CORE

#define LUA_CORE

◆ MAXVARS

#define MAXVARS   200

◆ new_localvarliteral

#define new_localvarliteral (   ls,
 
)
值:
luaX_newstring(ls, "" v, (sizeof(v)/sizeof(char)) - 1));

◆ UNARY_PRIORITY

#define UNARY_PRIORITY   12 /* priority for unary operators */

类型定义说明

◆ BlockCnt

typedef struct BlockCnt BlockCnt

◆ ConsControl

typedef struct ConsControl ConsControl

函数说明

◆ addprototype()

static Proto* addprototype ( LexState ls)
static
函数调用图:
这是这个函数的调用关系图:

◆ adjust_assign()

static void adjust_assign ( LexState ls,
int  nvars,
int  nexps,
expdesc e 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ adjustlocalvars()

static void adjustlocalvars ( LexState ls,
int  nvars 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ allocupvalue()

static Upvaldesc* allocupvalue ( FuncState fs)
static
函数调用图:
这是这个函数的调用关系图:

◆ block()

static void block ( LexState ls)
static
函数调用图:
这是这个函数的调用关系图:

◆ block_follow()

static int block_follow ( LexState ls,
int  withuntil 
)
static
这是这个函数的调用关系图:

◆ body()

static void body ( LexState ls,
expdesc e,
int  ismethod,
int  line 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ breakstat()

static void breakstat ( LexState ls)
static
函数调用图:
这是这个函数的调用关系图:

◆ check()

static void check ( LexState ls,
int  c 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ check_conflict()

static void check_conflict ( LexState ls,
struct LHS_assign lh,
expdesc v 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ check_match()

static void check_match ( LexState ls,
int  what,
int  who,
int  where 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ check_readonly()

static void check_readonly ( LexState ls,
expdesc e 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ checklimit()

static void checklimit ( FuncState fs,
int  v,
int  l,
const char *  what 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ checknext()

static void checknext ( LexState ls,
int  c 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ checkrepeated()

static void checkrepeated ( LexState ls,
TString name 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ checktoclose()

static void checktoclose ( LexState ls,
int  level 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ close_func()

static void close_func ( LexState ls)
static
函数调用图:
这是这个函数的调用关系图:

◆ closelistfield()

static void closelistfield ( FuncState fs,
ConsControl cc 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ codeclosure()

static void codeclosure ( LexState ls,
expdesc v 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ codename()

static void codename ( LexState ls,
expdesc e 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ codestring()

static void codestring ( expdesc e,
TString s 
)
static
这是这个函数的调用关系图:

◆ cond()

static int cond ( LexState ls)
static
函数调用图:
这是这个函数的调用关系图:

◆ constructor()

static void constructor ( LexState ls,
expdesc t 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ createlabel()

static int createlabel ( LexState ls,
TString name,
int  line,
int  last 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ enterblock()

static void enterblock ( FuncState fs,
BlockCnt bl,
lu_byte  isloop 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ error_expected()

static l_noret error_expected ( LexState ls,
int  token 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ errorlimit()

static l_noret errorlimit ( FuncState fs,
int  limit,
const char *  what 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ exp1()

static void exp1 ( LexState ls)
static
函数调用图:
这是这个函数的调用关系图:

◆ explist()

static int explist ( LexState ls,
expdesc v 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ expr()

static void expr ( LexState ls,
expdesc v 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ exprstat()

static void exprstat ( LexState ls)
static
函数调用图:
这是这个函数的调用关系图:

◆ field()

static void field ( LexState ls,
ConsControl cc 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ fieldsel()

static void fieldsel ( LexState ls,
expdesc v 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ findlabel()

static Labeldesc* findlabel ( LexState ls,
TString name 
)
static
这是这个函数的调用关系图:

◆ fixforjump()

static void fixforjump ( FuncState fs,
int  pc,
int  dest,
int  back 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ forbody()

static void forbody ( LexState ls,
int  base,
int  line,
int  nvars,
int  isgen 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ forlist()

static void forlist ( LexState ls,
TString indexname 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ fornum()

static void fornum ( LexState ls,
TString varname,
int  line 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ forstat()

static void forstat ( LexState ls,
int  line 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ funcargs()

static void funcargs ( LexState ls,
expdesc f,
int  line 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ funcname()

static int funcname ( LexState ls,
expdesc v 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ funcstat()

static void funcstat ( LexState ls,
int  line 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ getbinopr()

static BinOpr getbinopr ( int  op)
static
这是这个函数的调用关系图:

◆ getlocalattribute()

static int getlocalattribute ( LexState ls)
static
函数调用图:
这是这个函数的调用关系图:

◆ getlocalvardesc()

static Vardesc* getlocalvardesc ( FuncState fs,
int  vidx 
)
static
这是这个函数的调用关系图:

◆ getunopr()

static UnOpr getunopr ( int  op)
static
这是这个函数的调用关系图:

◆ gotostat()

static void gotostat ( LexState ls)
static
函数调用图:
这是这个函数的调用关系图:

◆ ifstat()

static void ifstat ( LexState ls,
int  line 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ init_exp()

static void init_exp ( expdesc e,
expkind  k,
int  i 
)
static
这是这个函数的调用关系图:

◆ init_var()

static void init_var ( FuncState fs,
expdesc e,
int  vidx 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ jumpscopeerror()

static l_noret jumpscopeerror ( LexState ls,
Labeldesc gt 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ labelstat()

static void labelstat ( LexState ls,
TString name,
int  line 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ lastlistfield()

static void lastlistfield ( FuncState fs,
ConsControl cc 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ leaveblock()

static void leaveblock ( FuncState fs)
static
函数调用图:
这是这个函数的调用关系图:

◆ listfield()

static void listfield ( LexState ls,
ConsControl cc 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ localdebuginfo()

static LocVar* localdebuginfo ( FuncState fs,
int  vidx 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ localfunc()

static void localfunc ( LexState ls)
static
函数调用图:
这是这个函数的调用关系图:

◆ localstat()

static void localstat ( LexState ls)
static
函数调用图:
这是这个函数的调用关系图:

◆ luaY_nvarstack()

int luaY_nvarstack ( FuncState fs)
函数调用图:
这是这个函数的调用关系图:

◆ luaY_parser()

LClosure* luaY_parser ( lua_State L,
ZIO z,
Mbuffer buff,
Dyndata dyd,
const char *  name,
int  firstchar 
)
函数调用图:
这是这个函数的调用关系图:

◆ mainfunc()

static void mainfunc ( LexState ls,
FuncState fs 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ markupval()

static void markupval ( FuncState fs,
int  level 
)
static
这是这个函数的调用关系图:

◆ movegotosout()

static void movegotosout ( FuncState fs,
BlockCnt bl 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ new_localvar()

static int new_localvar ( LexState ls,
TString name 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ newgotoentry()

static int newgotoentry ( LexState ls,
TString name,
int  line,
int  pc 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ newlabelentry()

static int newlabelentry ( LexState ls,
Labellist l,
TString name,
int  line,
int  pc 
)
static
这是这个函数的调用关系图:

◆ newupvalue()

static int newupvalue ( FuncState fs,
TString name,
expdesc v 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ open_func()

static void open_func ( LexState ls,
FuncState fs,
BlockCnt bl 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ parlist()

static void parlist ( LexState ls)
static
函数调用图:
这是这个函数的调用关系图:

◆ primaryexp()

static void primaryexp ( LexState ls,
expdesc v 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ recfield()

static void recfield ( LexState ls,
ConsControl cc 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ registerlocalvar()

static int registerlocalvar ( LexState ls,
FuncState fs,
TString varname 
)
static
这是这个函数的调用关系图:

◆ reglevel()

static int reglevel ( FuncState fs,
int  nvar 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ removevars()

static void removevars ( FuncState fs,
int  tolevel 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ repeatstat()

static void repeatstat ( LexState ls,
int  line 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ restassign()

static void restassign ( LexState ls,
struct LHS_assign lh,
int  nvars 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ retstat()

static void retstat ( LexState ls)
static
函数调用图:
这是这个函数的调用关系图:

◆ searchupvalue()

static int searchupvalue ( FuncState fs,
TString name 
)
static
这是这个函数的调用关系图:

◆ searchvar()

static int searchvar ( FuncState fs,
TString n,
expdesc var 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ setvararg()

static void setvararg ( FuncState fs,
int  nparams 
)
static
这是这个函数的调用关系图:

◆ simpleexp()

static void simpleexp ( LexState ls,
expdesc v 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ singlevar()

static void singlevar ( LexState ls,
expdesc var 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ singlevaraux()

static void singlevaraux ( FuncState fs,
TString n,
expdesc var,
int  base 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ solvegoto()

static void solvegoto ( LexState ls,
int  g,
Labeldesc label 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ solvegotos()

static int solvegotos ( LexState ls,
Labeldesc lb 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ statement()

static void statement ( LexState ls)
static
函数调用图:
这是这个函数的调用关系图:

◆ statlist()

static void statlist ( LexState ls)
static
函数调用图:
这是这个函数的调用关系图:

◆ str_checkname()

static TString* str_checkname ( LexState ls)
static
函数调用图:
这是这个函数的调用关系图:

◆ subexpr()

static BinOpr subexpr ( LexState ls,
expdesc v,
int  limit 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ suffixedexp()

static void suffixedexp ( LexState ls,
expdesc v 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ test_then_block()

static void test_then_block ( LexState ls,
int *  escapelist 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ testnext()

static int testnext ( LexState ls,
int  c 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ undefgoto()

static l_noret undefgoto ( LexState ls,
Labeldesc gt 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ whilestat()

static void whilestat ( LexState ls,
int  line 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ yindex()

static void yindex ( LexState ls,
expdesc v 
)
static
函数调用图:
这是这个函数的调用关系图:

变量说明

◆ left

lu_byte left

◆ priority

const { ... } priority[]
初始值:
= {
{10, 10}, {10, 10},
{11, 11}, {11, 11},
{14, 13},
{11, 11}, {11, 11},
{6, 6}, {4, 4}, {5, 5},
{7, 7}, {7, 7},
{9, 8},
{3, 3}, {3, 3}, {3, 3},
{3, 3}, {3, 3}, {3, 3},
{2, 2}, {1, 1}
}

◆ right

lu_byte right
luaX_newstring
TString * luaX_newstring(LexState *ls, const char *str, size_t l)
Definition: llex.c:134
new_localvar
static int new_localvar(LexState *ls, TString *name)
Definition: lparser.c:193