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

Go to the source code of this file.

Data Structures

union  SemInfo
 
struct  Token
 
struct  LexState
 

Macros

#define FIRST_RESERVED   257
 
#define LUA_ENV   "_ENV"
 
#define NUM_RESERVED   (cast(int, TK_WHILE-FIRST_RESERVED+1))
 

Typedefs

typedef struct Token Token
 
typedef struct LexState LexState
 

Enumerations

enum  RESERVED {
  TK_AND = FIRST_RESERVED , TK_BREAK , TK_DO , TK_ELSE ,
  TK_ELSEIF , TK_END , TK_FALSE , TK_FOR ,
  TK_FUNCTION , TK_GOTO , TK_IF , TK_IN ,
  TK_LOCAL , TK_NIL , TK_NOT , TK_OR ,
  TK_REPEAT , TK_RETURN , TK_THEN , TK_TRUE ,
  TK_UNTIL , TK_WHILE , TK_IDIV , TK_CONCAT ,
  TK_DOTS , TK_EQ , TK_GE , TK_LE ,
  TK_NE , TK_SHL , TK_SHR , TK_DBCOLON ,
  TK_EOS , TK_FLT , TK_INT , TK_NAME ,
  TK_STRING
}
 

Functions

LUAI_FUNC void luaX_init (lua_State *L)
 
LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source, int firstchar)
 
LUAI_FUNC TStringluaX_newstring (LexState *ls, const char *str, size_t l)
 
LUAI_FUNC void luaX_next (LexState *ls)
 
LUAI_FUNC int luaX_lookahead (LexState *ls)
 
LUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s)
 
LUAI_FUNC const char * luaX_token2str (LexState *ls, int token)
 

Macro Definition Documentation

◆ FIRST_RESERVED

#define FIRST_RESERVED   257

Definition at line 14 of file lua-5.3.6/src/llex.h.

◆ LUA_ENV

#define LUA_ENV   "_ENV"

Definition at line 18 of file lua-5.3.6/src/llex.h.

◆ NUM_RESERVED

#define NUM_RESERVED   (cast(int, TK_WHILE-FIRST_RESERVED+1))

Definition at line 40 of file lua-5.3.6/src/llex.h.

Typedef Documentation

◆ LexState

typedef struct LexState LexState

◆ Token

typedef struct Token Token

Enumeration Type Documentation

◆ RESERVED

enum RESERVED
Enumerator
TK_AND 
TK_BREAK 
TK_DO 
TK_ELSE 
TK_ELSEIF 
TK_END 
TK_FALSE 
TK_FOR 
TK_FUNCTION 
TK_GOTO 
TK_IF 
TK_IN 
TK_LOCAL 
TK_NIL 
TK_NOT 
TK_OR 
TK_REPEAT 
TK_RETURN 
TK_THEN 
TK_TRUE 
TK_UNTIL 
TK_WHILE 
TK_IDIV 
TK_CONCAT 
TK_DOTS 
TK_EQ 
TK_GE 
TK_LE 
TK_NE 
TK_SHL 
TK_SHR 
TK_DBCOLON 
TK_EOS 
TK_FLT 
TK_INT 
TK_NAME 
TK_STRING 

Definition at line 26 of file lua-5.3.6/src/llex.h.

26 {
27 /* terminal symbols denoted by reserved words */
32 /* other terminal symbols */
37};
#define FIRST_RESERVED
@ TK_FALSE
@ TK_STRING
@ TK_BREAK
@ TK_DBCOLON
@ TK_ELSE
@ TK_DOTS
@ TK_WHILE
@ TK_LOCAL
@ TK_TRUE
@ TK_THEN
@ TK_IDIV
@ TK_CONCAT
@ TK_NAME
@ TK_REPEAT
@ TK_FUNCTION
@ TK_UNTIL
@ TK_RETURN
@ TK_GOTO
@ TK_ELSEIF

Function Documentation

◆ luaX_init()

LUAI_FUNC void luaX_init ( lua_State * L)

Definition at line 21 of file noparser.c.

21 {
22 UNUSED(L);
23}
#define UNUSED(x)

◆ luaX_lookahead()

LUAI_FUNC int luaX_lookahead ( LexState * ls)

Definition at line 459 of file lua-5.1.5/src/llex.c.

459 {
461 ls->lookahead.token = llex(ls, &ls->lookahead.seminfo);
462}
static int llex(LexState *ls, SemInfo *seminfo)
#define lua_assert(c)
SemInfo seminfo

◆ luaX_newstring()

LUAI_FUNC TString * luaX_newstring ( LexState * ls,
const char * str,
size_t l )

Definition at line 117 of file lua-5.1.5/src/llex.c.

117 {
118 lua_State *L = ls->L;
119 TString *ts = luaS_newlstr(L, str, l);
120 TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */
121 if (ttisnil(o)) {
122 setbvalue(o, 1); /* make sure `str' will not be collected */
123 luaC_checkGC(L);
124 }
125 return ts;
126}
#define luaC_checkGC(L)
#define setbvalue(obj, x)
#define ttisnil(o)
TString * luaS_newlstr(lua_State *L, const char *str, size_t l)
TValue * luaH_setstr(lua_State *L, Table *t, TString *key)
struct lua_State * L
struct FuncState * fs

◆ luaX_next()

LUAI_FUNC void luaX_next ( LexState * ls)

Definition at line 448 of file lua-5.1.5/src/llex.c.

448 {
449 ls->lastline = ls->linenumber;
450 if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */
451 ls->t = ls->lookahead; /* use this one */
452 ls->lookahead.token = TK_EOS; /* and discharge it */
453 }
454 else
455 ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */
456}

◆ luaX_setinput()

LUAI_FUNC void luaX_setinput ( lua_State * L,
LexState * ls,
ZIO * z,
TString * source,
int firstchar )

Definition at line 159 of file lua-5.2.4/src/llex.c.

160 {
161 ls->decpoint = '.';
162 ls->L = L;
163 ls->current = firstchar;
164 ls->lookahead.token = TK_EOS; /* no look-ahead token */
165 ls->z = z;
166 ls->fs = NULL;
167 ls->linenumber = 1;
168 ls->lastline = 1;
169 ls->source = source;
170 ls->envn = luaS_new(L, LUA_ENV); /* create env name */
171 luaS_fix(ls->envn); /* never collect this name */
172 luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */
173}
#define NULL
Definition gmacros.h:924
#define LUA_MINBUFFER
#define luaS_new(L, s)
#define luaS_fix(s)
#define luaZ_resizebuffer(L, buff, size)
#define LUA_ENV
TString * source
Mbuffer * buff
TString * envn

◆ luaX_syntaxerror()

LUAI_FUNC l_noret luaX_syntaxerror ( LexState * ls,
const char * s )

Definition at line 112 of file lua-5.1.5/src/llex.c.

112 {
113 luaX_lexerror(ls, msg, ls->t.token);
114}
void luaX_lexerror(LexState *ls, const char *msg, int token)

◆ luaX_token2str()

LUAI_FUNC const char * luaX_token2str ( LexState * ls,
int token )

Definition at line 78 of file lua-5.1.5/src/llex.c.

78 {
79 if (token < FIRST_RESERVED) {
80 lua_assert(token == cast(unsigned char, token));
81 return (iscntrl(token)) ? luaO_pushfstring(ls->L, "char(%d)", token) :
82 luaO_pushfstring(ls->L, "%c", token);
83 }
84 else
85 return luaX_tokens[token-FIRST_RESERVED];
86}
const char *const luaX_tokens[]
#define FIRST_RESERVED
#define cast(t, exp)
const char * luaO_pushfstring(lua_State *L, const char *fmt,...)