# lparser.c File Reference

`#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"`

## Classes
struct | BlockCnt
struct | ConsControl
struct | LHS_assign
## Defines
#define | lparser_c
#define | LUA_CORE
#define | hasmultret(k) ((k) == VCALL || (k) == VVARARG)
#define | getlocvar(fs, i) ((fs)->f->locvars[(fs)->actvar[i]])
#define | luaY_checklimit(fs, v, l, m) if ((v)>(l)) errorlimit(fs,l,m)
#define | check_condition(ls, c, msg) { if (!(c)) luaX_syntaxerror(ls, msg); }
#define | new_localvarliteral(ls, v, n) new_localvar(ls, luaX_newstring(ls, "" v, (sizeof(v)/sizeof(char))-1), n)
#define | leavelevel(ls) ((ls)->L->nCcalls--)
#define | UNARY_PRIORITY 8
## Functions
static void | chunk (LexState *ls)
static void | expr (LexState *ls, expdesc *v)
static void | anchor_token (LexState *ls)
static void | error_expected (LexState *ls, int token)
static void | errorlimit (FuncState *fs, int limit, 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 TString * | str_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 | 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 int | indexupvalue (FuncState *fs, TString *name, expdesc *v)
static int | searchvar (FuncState *fs, TString *n)
static void | markupval (FuncState *fs, int level)
static int | 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 void | enterlevel (LexState *ls)
static void | enterblock (FuncState *fs, BlockCnt *bl, lu_byte 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)
Proto * | luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name)
static void | field (LexState *ls, expdesc *v)
static void | yindex (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, unsigned 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 int | cond (LexState *ls)
static void | breakstat (LexState *ls)
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 int | test_then_block (LexState *ls)
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 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); }

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

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

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

#define lparser_c

#define LUA_CORE

#define luaY_checklimit | ( | fs,
|  | v,
|  | l,
|  | m |  | ) | if ((v)>(l)) errorlimit(fs,l,m)

#define new_localvarliteral | ( | ls,
|  | v,
|  | n |  | ) | new_localvar(ls, luaX_newstring(ls, "" v, (sizeof(v)/sizeof(char))-1), n)

#define UNARY_PRIORITY 8

## Function Documentation

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

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

static void anchor_token | ( | LexState * | ls | ) | `[static]`

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

static void block | ( | LexState * | ls | ) | `[static]`

static int block_follow | ( | int | token | ) | `[static]`

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

static void breakstat | ( | LexState * | ls | ) | `[static]`

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

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

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

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

static void checknext | ( | LexState * | ls,
|  | int | c |
| ) |  |  | `[static]`

static void chunk | ( | LexState * | ls | ) | `[static]`

static void close_func | ( | LexState * | ls | ) | `[static]`

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

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

static int cond | ( | LexState * | ls | ) | `[static]`

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

static void enterblock | ( | FuncState * | fs,
|  | BlockCnt * | bl,
|  | lu_byte | isbreakable |
| ) |  |  | `[static]`

static void enterlevel | ( | LexState * | ls | ) | `[static]`

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

static void errorlimit | ( | FuncState * | fs,
|  | int | limit,
|  | const char * | what |
| ) |  |  | `[static]`

static int exp1 | ( | LexState * | ls | ) | `[static]`

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

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

static void exprstat | ( | LexState * | ls | ) | `[static]`

static void field | ( | LexState * | ls,
|  | expdesc * | v |
| ) |  |  | `[static]`

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

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

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

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

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

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

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

static BinOpr getbinopr | ( | int | op | ) | `[static]`

static UnOpr getunopr | ( | int | op | ) | `[static]`

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

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

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

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

static void leaveblock | ( | FuncState * | fs | ) | `[static]`

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

static void localfunc | ( | LexState * | ls | ) | `[static]`

static void localstat | ( | LexState * | ls | ) | `[static]`

Proto* luaY_parser | ( | lua_State * | L,
|  | ZIO * | z,
|  | Mbuffer * | buff,
|  | const char * | name |
| ) |  |  |

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

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

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

static void parlist | ( | LexState * | ls | ) | `[static]`

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

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

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

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

static int registerlocalvar | ( | LexState * | ls,
|  | TString * | varname |
| ) |  |  | `[static]`

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

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

static void retstat | ( | LexState * | ls | ) | `[static]`

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

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

static void singlevar | ( | LexState * | ls,
|  | expdesc * | var |
| ) |  |  | `[static]`

static int singlevaraux | ( | FuncState * | fs,
|  | TString * | n,
|  | expdesc * | var,
|  | int | base |
| ) |  |  | `[static]`

static int statement | ( | LexState * | ls | ) | `[static]`

static TString* str_checkname | ( | LexState * | ls | ) | `[static]`

static BinOpr subexpr | ( | LexState * | ls,
|  | expdesc * | v,
|  | unsigned int | limit |
| ) |  |  | `[static]`

static int test_then_block | ( | LexState * | ls | ) | `[static]`

static int testnext | ( | LexState * | ls,
|  | int | c |
| ) |  |  | `[static]`

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

static void yindex | ( | LexState * | ls,
|  | expdesc * | v |
| ) |  |  | `[static]`

## Variable Documentation

lu_byte left

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

lu_byte right