lua/lparser.c File Reference

#include <string.h>
#include "lua.h"
#include "lcode.h"
#include "ldebug.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"

Go to the source code of this file.

Data Structures

struct  BlockCnt
struct  ConsControl
struct  LHS_assign

Defines

#define lparser_c
#define getlocvar(fs, i)   ((fs)->f->locvars[(fs)->actvar[i]])
#define enterlevel(ls)
#define leavelevel(ls)   ((ls)->nestlevel--)
#define check_condition(ls, c, msg)   { if (!(c)) luaX_syntaxerror(ls, msg); }
#define UNARY_PRIORITY   8
#define MAXEXPWHILE   100
#define EXTRAEXP   5

Functions

static void chunk (LexState *ls)
static void expr (LexState *ls, expdesc *v)
static void next (LexState *ls)
static void lookahead (LexState *ls)
static void error_expected (LexState *ls, int token)
static int testnext (LexState *ls, int c)
static void check (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 (LexState *ls, expdesc *e, TString *s)
static void checkname (LexState *ls, expdesc *e)
static int luaI_registerlocalvar (LexState *ls, TString *varname)
static void new_localvar (LexState *ls, TString *name, int n)
static void adjustlocalvars (LexState *ls, int nvars)
static void removevars (LexState *ls, int tolevel)
static void new_localvarstr (LexState *ls, const char *name, int n)
static void create_local (LexState *ls, const char *name)
static int indexupvalue (FuncState *fs, TString *name, expdesc *v)
static int searchvar (FuncState *fs, TString *n)
static void markupval (FuncState *fs, int level)
static void singlevaraux (FuncState *fs, TString *n, expdesc *var, int base)
static TStringsinglevar (LexState *ls, expdesc *var, int base)
static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e)
static void code_params (LexState *ls, int nparams, int dots)
static void enterblock (FuncState *fs, BlockCnt *bl, int isbreakable)
static void leaveblock (FuncState *fs)
static void pushclosure (LexState *ls, FuncState *func, expdesc *v)
static void open_func (LexState *ls, FuncState *fs)
static void close_func (LexState *ls)
ProtoluaY_parser (lua_State *L, ZIO *z, Mbuffer *buff)
static void luaY_field (LexState *ls, expdesc *v)
static void luaY_index (LexState *ls, expdesc *v)
static void recfield (LexState *ls, struct ConsControl *cc)
static void closelistfield (FuncState *fs, struct ConsControl *cc)
static void lastlistfield (FuncState *fs, struct ConsControl *cc)
static void listfield (LexState *ls, struct ConsControl *cc)
static void constructor (LexState *ls, expdesc *t)
static void parlist (LexState *ls)
static void body (LexState *ls, expdesc *e, int needself, int line)
static int explist1 (LexState *ls, expdesc *v)
static void funcargs (LexState *ls, expdesc *f)
static void prefixexp (LexState *ls, expdesc *v)
static void primaryexp (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 int block_follow (int token)
static void block (LexState *ls)
static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v)
static void assignment (LexState *ls, struct LHS_assign *lh, int nvars)
static void cond (LexState *ls, expdesc *v)
static void whilestat (LexState *ls, int line)
static void repeatstat (LexState *ls, int line)
static int exp1 (LexState *ls)
static void forbody (LexState *ls, int base, int line, int nvars, int isnum)
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, expdesc *v)
static void ifstat (LexState *ls, int line)
static void localfunc (LexState *ls)
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 breakstat (LexState *ls)
static int statement (LexState *ls)

Variables

struct {
   lu_byte   left
   lu_byte   right
priority []


Define Documentation

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

Definition at line 108 of file lparser.c.

Referenced by assignment(), luaY_parser(), and str_checkname().

#define enterlevel ( ls   ) 

Value:

if (++(ls)->nestlevel > LUA_MAXPARSERLEVEL) \
                luaX_syntaxerror(ls, "too many syntax levels");

Definition at line 31 of file lparser.c.

Referenced by chunk(), and subexpr().

#define EXTRAEXP   5

Definition at line 1067 of file lparser.c.

Referenced by whilestat().

#define getlocvar ( fs,
 )     ((fs)->f->locvars[(fs)->actvar[i]])

Definition at line 28 of file lparser.c.

Referenced by adjustlocalvars(), localfunc(), removevars(), and searchvar().

#define leavelevel ( ls   )     ((ls)->nestlevel--)

Definition at line 33 of file lparser.c.

Referenced by chunk(), and subexpr().

#define lparser_c

Definition at line 10 of file lparser.c.

#define MAXEXPWHILE   100

Definition at line 1060 of file lparser.c.

Referenced by whilestat().

#define UNARY_PRIORITY   8

Definition at line 886 of file lparser.c.

Referenced by subexpr().


Function Documentation

static void adjust_assign ( LexState ls,
int  nvars,
int  nexps,
expdesc e 
) [static]

Definition at line 295 of file lparser.c.

References LexState::fs, expdesc::k, luaK_exp2nextreg(), luaK_nil(), luaK_reserveregs(), luaK_setcallreturns(), VCALL, and VVOID.

Referenced by assignment(), forlist(), and localstat().

static void adjustlocalvars ( LexState ls,
int  nvars 
) [static]

Definition at line 182 of file lparser.c.

References LexState::fs, getlocvar, FuncState::nactvar, and FuncState::pc.

Referenced by code_params(), create_local(), forbody(), localfunc(), and localstat().

static void assignment ( LexState ls,
struct LHS_assign lh,
int  nvars 
) [static]

Definition at line 1006 of file lparser.c.

References adjust_assign(), check, check_condition, check_conflict(), explist1(), FuncState::freereg, LexState::fs, init_exp(), expdesc::k, luaK_setcallreturns(), luaK_storevar(), LHS_assign::prev, primaryexp(), testnext(), LHS_assign::v, VINDEXED, VLOCAL, and VNONRELOC.

Referenced by exprstat().

static void block ( LexState ls  )  [static]

Definition at line 952 of file lparser.c.

References BlockCnt::breaklist, chunk(), enterblock(), LexState::fs, leaveblock(), lua_assert, and NO_JUMP.

Referenced by forbody(), ifstat(), mallocstate(), repeatstat(), rpmReadHeader(), rpmReadSignature(), statement(), test_then_block(), and whilestat().

static int block_follow ( int  token  )  [static]

Definition at line 940 of file lparser.c.

References TK_ELSE, TK_ELSEIF, TK_END, TK_EOS, and TK_UNTIL.

Referenced by chunk(), and retstat().

static void body ( LexState ls,
expdesc e,
int  needself,
int  line 
) [static]

Definition at line 622 of file lparser.c.

References check, check_match(), chunk(), close_func(), create_local(), FuncState::f, Proto::lineDefined, open_func(), parlist(), pushclosure(), TK_END, and TK_FUNCTION.

Referenced by addSource(), funcstat(), localfunc(), setPathDefault(), and simpleexp().

static void breakstat ( LexState ls  )  [static]

Definition at line 1387 of file lparser.c.

References FuncState::bl, BlockCnt::breaklist, LexState::fs, BlockCnt::isbreakable, luaK_codeABC(), luaK_concat(), luaK_jump(), luaX_syntaxerror(), BlockCnt::nactvar, next, OP_CLOSE, BlockCnt::previous, and BlockCnt::upval.

Referenced by statement().

static void check ( LexState ls,
int  c 
) [static]

Definition at line 100 of file lparser.c.

References error_expected(), and testnext().

static void check_conflict ( LexState ls,
struct LHS_assign lh,
expdesc v 
) [static]

Definition at line 981 of file lparser.c.

References expdesc::aux, FuncState::freereg, LexState::fs, expdesc::info, expdesc::k, LHS_assign::prev, LHS_assign::v, and VINDEXED.

Referenced by assignment().

static void check_match ( LexState ls,
int  what,
int  who,
int  where 
) [static]

Definition at line 112 of file lparser.c.

References error_expected(), LexState::L, LexState::linenumber, luaO_pushfstring(), luaX_syntaxerror(), luaX_token2str(), and testnext().

Referenced by body(), constructor(), forstat(), funcargs(), ifstat(), prefixexp(), repeatstat(), statement(), and whilestat().

static void checkname ( LexState ls,
expdesc e 
) [static]

Definition at line 154 of file lparser.c.

References codestring(), and str_checkname().

Referenced by luaY_field(), primaryexp(), and recfield().

static void chunk ( LexState ls  )  [static]

Definition at line 1462 of file lparser.c.

References block_follow(), enterlevel, FuncState::freereg, LexState::fs, leavelevel, lua_assert, FuncState::nactvar, statement(), LexState::t, testnext(), and Token::token.

Referenced by block(), body(), and luaY_parser().

static void close_func ( LexState ls  )  [static]

Definition at line 401 of file lparser.c.

References FuncState::bl, Proto::code, FuncState::f, LexState::fs, Proto::k, LexState::L, Proto::lineinfo, Proto::locvars, lua_assert, luaG_checkcode(), luaK_codeABC(), luaM_reallocvector, FuncState::nk, FuncState::nlocvars, FuncState::np, Proto::nups, OP_RETURN, Proto::p, FuncState::pc, FuncState::prev, removevars(), Proto::sizecode, Proto::sizek, Proto::sizelineinfo, Proto::sizelocvars, Proto::sizep, Proto::sizeupvalues, and Proto::upvalues.

Referenced by body(), and luaY_parser().

static void closelistfield ( FuncState fs,
struct ConsControl cc 
) [static]

Definition at line 514 of file lparser.c.

References expdesc::info, expdesc::k, LFIELDS_PER_FLUSH, luaK_codeABx(), luaK_exp2nextreg(), ConsControl::na, OP_SETLIST, ConsControl::t, ConsControl::tostore, ConsControl::v, and VVOID.

Referenced by constructor().

static void code_params ( LexState ls,
int  nparams,
int  dots 
) [static]

Definition at line 317 of file lparser.c.

References adjustlocalvars(), cast, create_local(), FuncState::f, LexState::fs, Proto::is_vararg, luaK_reserveregs(), luaX_checklimit(), MAXPARAMS, FuncState::nactvar, and Proto::numparams.

Referenced by parlist().

static void codestring ( LexState ls,
expdesc e,
TString s 
) [static]

Definition at line 147 of file lparser.c.

References LexState::fs, init_exp(), luaK_stringK(), and VK.

Referenced by checkname(), funcargs(), and simpleexp().

static void cond ( LexState ls,
expdesc v 
) [static]

Definition at line 1040 of file lparser.c.

References expr(), LexState::fs, expdesc::k, luaK_goiftrue(), luaK_patchtohere(), expdesc::t, LHS_assign::v, VFALSE, and VNIL.

Referenced by codebinop(), repeatstat(), and test_then_block().

static void constructor ( LexState ls,
expdesc t 
) [static]

Definition at line 555 of file lparser.c.

References check, check_match(), closelistfield(), Proto::code, FuncState::f, LexState::fs, init_exp(), expdesc::k, lastlistfield(), LexState::linenumber, listfield(), LexState::lookahead, lookahead(), lua_assert, luaK_codeABC(), luaK_exp2nextreg(), luaO_int2fb(), luaO_log2(), ConsControl::na, ConsControl::nh, OP_NEWTABLE, recfield(), SETARG_B, SETARG_C, LexState::t, ConsControl::t, testnext(), TK_NAME, Token::token, ConsControl::tostore, ConsControl::v, VRELOCABLE, and VVOID.

Referenced by funcargs(), and simpleexp().

static void create_local ( LexState ls,
const char *  name 
) [static]

Definition at line 209 of file lparser.c.

References adjustlocalvars(), and new_localvarstr().

Referenced by body(), and code_params().

static void enterblock ( FuncState fs,
BlockCnt bl,
int  isbreakable 
) [static]

Definition at line 331 of file lparser.c.

References FuncState::bl, BlockCnt::breaklist, FuncState::freereg, BlockCnt::isbreakable, lua_assert, FuncState::nactvar, BlockCnt::nactvar, NO_JUMP, BlockCnt::previous, and BlockCnt::upval.

Referenced by block(), forbody(), forstat(), repeatstat(), and whilestat().

static void error_expected ( LexState ls,
int  token 
) [static]

Definition at line 81 of file lparser.c.

References LexState::L, luaO_pushfstring(), luaX_syntaxerror(), and luaX_token2str().

Referenced by check(), and check_match().

static int exp1 ( LexState ls  )  [static]

Definition at line 1131 of file lparser.c.

References expr(), LexState::fs, expdesc::k, and luaK_exp2nextreg().

Referenced by fornum().

static int explist1 ( LexState ls,
expdesc v 
) [static]

Definition at line 641 of file lparser.c.

References expr(), LexState::fs, luaK_exp2nextreg(), testnext(), and ConsControl::v.

Referenced by assignment(), forlist(), funcargs(), localstat(), and retstat().

static void expr ( LexState ls,
expdesc v 
) [static]

Definition at line 923 of file lparser.c.

References subexpr().

Referenced by cond(), exp1(), explist1(), listfield(), luaY_index(), prefixexp(), recfield(), and whilestat().

static void exprstat ( LexState ls  )  [static]

Definition at line 1335 of file lparser.c.

References assignment(), LexState::fs, expdesc::k, luaK_setcallreturns(), primaryexp(), LHS_assign::v, and VCALL.

Referenced by statement().

static void forbody ( LexState ls,
int  base,
int  line,
int  nvars,
int  isnum 
) [static]

Definition at line 1143 of file lparser.c.

References adjustlocalvars(), block(), check, enterblock(), LexState::fs, leaveblock(), luaK_codeABC(), luaK_codeAsBx, luaK_fixline(), luaK_getlabel(), luaK_jump(), luaK_patchlist(), luaK_patchtohere(), NO_JUMP, OP_FORLOOP, OP_TFORLOOP, and TK_DO.

Referenced by forlist(), and fornum().

static void forlist ( LexState ls,
TString indexname 
) [static]

Definition at line 1188 of file lparser.c.

References adjust_assign(), check, explist1(), forbody(), FuncState::freereg, LexState::fs, LexState::linenumber, luaK_checkstack(), luaK_codeAsBx, new_localvar(), new_localvarstr(), NO_JUMP, OP_TFORPREP, str_checkname(), testnext(), and TK_IN.

Referenced by forstat().

static void fornum ( LexState ls,
TString varname,
int  line 
) [static]

Definition at line 1163 of file lparser.c.

References check, exp1(), forbody(), FuncState::freereg, LexState::fs, luaK_codeABC(), luaK_codeABx(), luaK_jump(), luaK_numberK(), luaK_reserveregs(), new_localvar(), new_localvarstr(), OP_LOADK, OP_SUB, and testnext().

Referenced by forstat().

static void forstat ( LexState ls,
int  line 
) [static]

Definition at line 1211 of file lparser.c.

References check_match(), enterblock(), forlist(), fornum(), LexState::fs, leaveblock(), luaX_syntaxerror(), next, str_checkname(), LexState::t, TK_END, TK_FOR, TK_IN, and Token::token.

Referenced by statement().

static void funcargs ( LexState ls,
expdesc f 
) [static]

Definition at line 656 of file lparser.c.

References check_match(), codestring(), constructor(), explist1(), FuncState::freereg, LexState::fs, expdesc::info, init_exp(), expdesc::k, LexState::lastline, LexState::linenumber, lua_assert, luaK_codeABC(), luaK_exp2nextreg(), luaK_fixline(), luaK_setcallreturns(), luaX_syntaxerror(), next, OP_CALL, Token::seminfo, LexState::t, TK_STRING, Token::token, SemInfo::ts, VCALL, VNONRELOC, and VVOID.

Referenced by primaryexp().

static int funcname ( LexState ls,
expdesc v 
) [static]

Definition at line 1305 of file lparser.c.

References luaY_field(), singlevar(), LexState::t, Token::token, and LHS_assign::v.

Referenced by funcstat().

static void funcstat ( LexState ls,
int  line 
) [static]

Definition at line 1321 of file lparser.c.

References body(), LexState::fs, funcname(), luaK_fixline(), luaK_storevar(), next, and LHS_assign::v.

Referenced by statement().

static BinOpr getbinopr ( int  op  )  [static]

Definition at line 851 of file lparser.c.

References OPR_ADD, OPR_AND, OPR_CONCAT, OPR_DIV, OPR_EQ, OPR_GE, OPR_GT, OPR_LE, OPR_LT, OPR_MULT, OPR_NE, OPR_NOBINOPR, OPR_OR, OPR_POW, OPR_SUB, TK_AND, TK_CONCAT, TK_EQ, TK_GE, TK_LE, TK_NE, and TK_OR.

Referenced by subexpr().

static UnOpr getunopr ( int  op  )  [static]

Definition at line 840 of file lparser.c.

References OPR_MINUS, OPR_NOT, OPR_NOUNOPR, and TK_NOT.

Referenced by subexpr().

static void ifstat ( LexState ls,
int  line 
) [static]

Definition at line 1242 of file lparser.c.

References block(), check_match(), expdesc::f, LexState::fs, luaK_concat(), luaK_jump(), luaK_patchtohere(), next, NO_JUMP, LexState::t, test_then_block(), TK_ELSE, TK_ELSEIF, TK_END, TK_IF, Token::token, and LHS_assign::v.

Referenced by statement().

static int indexupvalue ( FuncState fs,
TString name,
expdesc v 
) [static]

Definition at line 217 of file lparser.c.

References FuncState::f, expdesc::info, expdesc::k, lua_assert, name, Proto::nups, Proto::upvalues, and FuncState::upvalues.

Referenced by singlevaraux().

static void init_exp ( expdesc e,
expkind  k,
int  i 
) [static]

Definition at line 138 of file lparser.c.

References expdesc::f, expdesc::info, expdesc::k, NO_JUMP, and expdesc::t.

Referenced by assignment(), codestring(), constructor(), funcargs(), localfunc(), pushclosure(), simpleexp(), and singlevaraux().

static void lastlistfield ( FuncState fs,
struct ConsControl cc 
) [static]

Definition at line 528 of file lparser.c.

References FuncState::freereg, expdesc::info, expdesc::k, luaK_codeABx(), luaK_exp2nextreg(), luaK_setcallreturns(), ConsControl::na, OP_SETLIST, OP_SETLISTO, ConsControl::t, ConsControl::tostore, ConsControl::v, VCALL, and VVOID.

Referenced by constructor().

static void leaveblock ( FuncState fs  )  [static]

Definition at line 344 of file lparser.c.

References FuncState::bl, BlockCnt::breaklist, FuncState::freereg, FuncState::ls, lua_assert, luaK_codeABC(), luaK_patchtohere(), FuncState::nactvar, BlockCnt::nactvar, OP_CLOSE, BlockCnt::previous, removevars(), and BlockCnt::upval.

Referenced by block(), forbody(), forstat(), repeatstat(), and whilestat().

static void listfield ( LexState ls,
struct ConsControl cc 
) [static]

Definition at line 545 of file lparser.c.

References expr(), luaX_checklimit(), MAXARG_Bx, ConsControl::na, ConsControl::tostore, and ConsControl::v.

Referenced by constructor().

static void localfunc ( LexState ls  )  [static]

Definition at line 1268 of file lparser.c.

References adjustlocalvars(), body(), FuncState::freereg, LexState::fs, getlocvar, init_exp(), LexState::linenumber, luaK_reserveregs(), luaK_storevar(), FuncState::nactvar, new_localvar(), FuncState::pc, str_checkname(), LHS_assign::v, and VLOCAL.

Referenced by statement().

static void localstat ( LexState ls  )  [static]

Definition at line 1284 of file lparser.c.

References adjust_assign(), adjustlocalvars(), explist1(), expdesc::k, new_localvar(), str_checkname(), testnext(), and VVOID.

Referenced by statement().

static void lookahead ( LexState ls  )  [static]

Definition at line 73 of file lparser.c.

References LexState::lookahead, lua_assert, luaX_lex(), Token::seminfo, TK_EOS, and Token::token.

Referenced by constructor().

static int luaI_registerlocalvar ( LexState ls,
TString varname 
) [static]

Definition at line 161 of file lparser.c.

References FuncState::f, LexState::fs, LexState::L, Proto::locvars, luaM_growvector, MAX_INT, FuncState::nlocvars, Proto::sizelocvars, and LocVar::varname.

Referenced by new_localvar().

static void luaY_field ( LexState ls,
expdesc v 
) [static]

Definition at line 451 of file lparser.c.

References checkname(), LexState::fs, FuncState::ls, luaK_exp2anyreg(), luaK_indexed(), and next.

Referenced by funcname(), and primaryexp().

static void luaY_index ( LexState ls,
expdesc v 
) [static]

Definition at line 464 of file lparser.c.

References check, expr(), LexState::fs, FuncState::ls, luaK_exp2val(), and next.

Referenced by primaryexp(), and recfield().

Proto* luaY_parser ( lua_State L,
ZIO z,
Mbuffer buff 
)

Definition at line 427 of file lparser.c.

References LexState::buff, check_condition, chunk(), close_func(), FuncState::f, FuncState::L, lua_assert, luaS_new, luaX_setinput(), LexState::nestlevel, next, Proto::nups, open_func(), FuncState::prev, LexState::t, TK_EOS, Token::token, and zname.

Referenced by f_parser().

static void markupval ( FuncState fs,
int  level 
) [static]

Definition at line 250 of file lparser.c.

References FuncState::bl, BlockCnt::nactvar, BlockCnt::previous, and BlockCnt::upval.

Referenced by singlevaraux().

static void new_localvar ( LexState ls,
TString name,
int  n 
) [static]

Definition at line 173 of file lparser.c.

References FuncState::actvar, LexState::fs, luaI_registerlocalvar(), luaX_checklimit(), MAXVARS, FuncState::nactvar, and name.

Referenced by forlist(), fornum(), localfunc(), localstat(), new_localvarstr(), and parlist().

static void new_localvarstr ( LexState ls,
const char *  name,
int  n 
) [static]

Definition at line 202 of file lparser.c.

References LexState::L, luaS_new, and new_localvar().

Referenced by create_local(), forlist(), and fornum().

static void next ( LexState ls  )  [static]

Definition at line 60 of file lparser.c.

References LexState::lastline, LexState::linenumber, LexState::lookahead, luaX_lex(), Token::seminfo, LexState::t, TK_EOS, and Token::token.

static void open_func ( LexState ls,
FuncState fs 
) [static]

Definition at line 377 of file lparser.c.

References FuncState::bl, FuncState::f, FuncState::freereg, LexState::fs, FuncState::h, FuncState::jpc, FuncState::L, LexState::L, FuncState::lasttarget, FuncState::ls, luaF_newproto(), luaH_new(), Proto::maxstacksize, FuncState::nactvar, FuncState::nk, FuncState::nlocvars, NO_JUMP, FuncState::np, FuncState::pc, FuncState::prev, LexState::source, and Proto::source.

Referenced by body(), and luaY_parser().

static void parlist ( LexState ls  )  [static]

Definition at line 603 of file lparser.c.

References code_params(), luaX_syntaxerror(), new_localvar(), next, str_checkname(), LexState::t, testnext(), TK_DOTS, TK_NAME, and Token::token.

Referenced by body().

static void prefixexp ( LexState ls,
expdesc v 
) [static]

Definition at line 716 of file lparser.c.

References check_match(), expr(), LexState::fs, getstr, expdesc::k, LexState::linenumber, luaK_dischargevars(), luaX_errorline(), luaX_syntaxerror(), next, singlevar(), LexState::t, TK_NAME, Token::token, ConsControl::v, and VUPVAL.

Referenced by primaryexp().

static void primaryexp ( LexState ls,
expdesc v 
) [static]

Definition at line 753 of file lparser.c.

References checkname(), LexState::fs, funcargs(), luaK_exp2anyreg(), luaK_exp2nextreg(), luaK_indexed(), luaK_self(), luaY_field(), luaY_index(), next, prefixexp(), LexState::t, TK_STRING, Token::token, and ConsControl::v.

Referenced by assignment(), exprstat(), and simpleexp().

static void pushclosure ( LexState ls,
FuncState func,
expdesc v 
) [static]

Definition at line 358 of file lparser.c.

References FuncState::f, LexState::fs, expdesc::info, init_exp(), expdesc::k, LexState::L, luaK_codeABC(), luaK_codeABx(), luaM_growvector, MAXARG_Bx, FuncState::np, Proto::nups, OP_CLOSURE, OP_GETUPVAL, OP_MOVE, Proto::p, Proto::sizep, FuncState::upvalues, VLOCAL, and VRELOCABLE.

Referenced by body().

static void recfield ( LexState ls,
struct ConsControl cc 
) [static]

Definition at line 491 of file lparser.c.

References check, checkname(), expr(), FuncState::freereg, LexState::fs, expdesc::info, luaK_codeABC(), luaK_exp2RK(), luaX_checklimit(), luaY_index(), MAX_INT, ConsControl::nh, OP_SETTABLE, ConsControl::t, LexState::t, TK_NAME, and Token::token.

Referenced by constructor().

static void removevars ( LexState ls,
int  tolevel 
) [static]

Definition at line 193 of file lparser.c.

References LexState::fs, getlocvar, and FuncState::nactvar.

Referenced by close_func(), and leaveblock().

static void repeatstat ( LexState ls,
int  line 
) [static]

Definition at line 1113 of file lparser.c.

References block(), check_match(), cond(), enterblock(), expdesc::f, LexState::fs, leaveblock(), luaK_getlabel(), luaK_patchlist(), next, TK_REPEAT, TK_UNTIL, and LHS_assign::v.

Referenced by statement().

static void retstat ( LexState ls  )  [static]

Definition at line 1352 of file lparser.c.

References block_follow(), explist1(), FuncState::freereg, LexState::fs, GETARG_A, getcode, expdesc::k, lua_assert, luaK_codeABC(), luaK_exp2anyreg(), luaK_exp2nextreg(), luaK_setcallreturns(), FuncState::nactvar, next, OP_RETURN, OP_TAILCALL, SET_OPCODE, LexState::t, Token::token, and VCALL.

Referenced by statement().

static int searchvar ( FuncState fs,
TString n 
) [static]

Definition at line 238 of file lparser.c.

References getlocvar, and FuncState::nactvar.

Referenced by singlevaraux().

static void simpleexp ( LexState ls,
expdesc v 
) [static]

Definition at line 792 of file lparser.c.

References body(), codestring(), constructor(), LexState::fs, init_exp(), LexState::linenumber, luaK_numberK(), next, primaryexp(), SemInfo::r, Token::seminfo, LexState::t, TK_FALSE, TK_FUNCTION, TK_NIL, TK_NUMBER, TK_STRING, TK_TRUE, Token::token, SemInfo::ts, ConsControl::v, VFALSE, VK, VNIL, and VTRUE.

Referenced by subexpr().

static TString* singlevar ( LexState ls,
expdesc var,
int  base 
) [static]

Definition at line 286 of file lparser.c.

References LexState::fs, singlevaraux(), and str_checkname().

Referenced by funcname(), and prefixexp().

static void singlevaraux ( FuncState fs,
TString n,
expdesc var,
int  base 
) [static]

Definition at line 259 of file lparser.c.

References indexupvalue(), init_exp(), luaK_stringK(), markupval(), NO_REG, FuncState::prev, searchvar(), VGLOBAL, VLOCAL, and VUPVAL.

Referenced by singlevar().

static int statement ( LexState ls  )  [static]

Definition at line 1407 of file lparser.c.

References block(), breakstat(), check_match(), exprstat(), forstat(), funcstat(), ifstat(), LexState::linenumber, localfunc(), localstat(), next, repeatstat(), retstat(), LexState::t, testnext(), TK_BREAK, TK_DO, TK_END, TK_FOR, TK_FUNCTION, TK_IF, TK_LOCAL, TK_REPEAT, TK_RETURN, TK_WHILE, Token::token, and whilestat().

Referenced by chunk().

static TString* str_checkname ( LexState ls  )  [static]

Definition at line 127 of file lparser.c.

References check_condition, next, Token::seminfo, LexState::t, TK_NAME, Token::token, and SemInfo::ts.

Referenced by checkname(), forlist(), forstat(), localfunc(), localstat(), parlist(), and singlevar().

static BinOpr subexpr ( LexState ls,
expdesc v,
int  limit 
) [static]

Definition at line 893 of file lparser.c.

References cast, enterlevel, LexState::fs, getbinopr(), getunopr(), leavelevel, left, luaK_infix(), luaK_posfix(), luaK_prefix(), next, OPR_NOBINOPR, OPR_NOUNOPR, priority, right, simpleexp(), LexState::t, Token::token, and UNARY_PRIORITY.

Referenced by expr().

static void test_then_block ( LexState ls,
expdesc v 
) [static]

Definition at line 1231 of file lparser.c.

References block(), check, cond(), next, TK_THEN, and LHS_assign::v.

Referenced by ifstat().

static int testnext ( LexState ls,
int  c 
) [static]

Definition at line 89 of file lparser.c.

References next, LexState::t, and Token::token.

Referenced by assignment(), check(), check_match(), chunk(), constructor(), explist1(), forlist(), fornum(), localstat(), parlist(), and statement().

static void whilestat ( LexState ls,
int  line 
) [static]

Definition at line 1069 of file lparser.c.

References block(), check, check_match(), Proto::code, enterblock(), expr(), EXTRAEXP, FuncState::f, expdesc::f, LexState::fs, FuncState::jpc, expdesc::k, leaveblock(), LexState::linenumber, luaK_code(), luaK_concat(), luaK_getlabel(), luaK_goiffalse(), luaK_jump(), luaK_patchlist(), luaK_patchtohere(), luaX_syntaxerror(), MAXEXPWHILE, next, NO_JUMP, FuncState::pc, expdesc::t, TK_DO, TK_END, TK_WHILE, LHS_assign::v, VK, and VTRUE.

Referenced by statement().


Variable Documentation

lu_byte left

Definition at line 876 of file lparser.c.

Referenced by expandRegular(), fsmStage(), subexpr(), and writeFile().

struct { ... } priority[] [static]

Referenced by subexpr().

lu_byte right

Definition at line 877 of file lparser.c.

Referenced by subexpr().


Generated on Fri Oct 12 08:44:56 2007 for rpm by  doxygen 1.5.2