llex.c File Reference

Go to the source code of this file.

Defines

#define llex_c
#define LUA_CORE
#define next(ls)   (ls->current = zgetc(ls->z))
#define currIsNewline(ls)   (ls->current == '\n' || ls->current == '\r')
#define save_and_next(ls)   (save(ls, ls->current), next(ls))
#define MAXSRC   80

Functions

static void save (LexState *ls, int c)
void luaX_init (lua_State *L)
const char * luaX_token2str (LexState *ls, int token)
static const char * txtToken (LexState *ls, int token)
void luaX_lexerror (LexState *ls, const char *msg, int token)
void luaX_syntaxerror (LexState *ls, const char *msg)
TStringluaX_newstring (LexState *ls, const char *str, size_t l)
static void inclinenumber (LexState *ls)
void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source)
static int check_next (LexState *ls, const char *set)
static void buffreplace (LexState *ls, char from, char to)
static void trydecpoint (LexState *ls, SemInfo *seminfo)
static void read_numeral (LexState *ls, SemInfo *seminfo)
static int skip_sep (LexState *ls)
static void read_long_string (LexState *ls, SemInfo *seminfo, int sep)
static void read_string (LexState *ls, int del, SemInfo *seminfo)
static int llex (LexState *ls, SemInfo *seminfo)
void luaX_next (LexState *ls)
void luaX_lookahead (LexState *ls)

Variables

const char *const luaX_tokens []

Define Documentation

#define currIsNewline ( ls   )     (ls->current == '\n' || ls->current == '\r')

Definition at line 33 of file llex.c.

Referenced by inclinenumber(), llex(), and read_long_string().

#define llex_c

Definition at line 12 of file llex.c.

#define LUA_CORE

Definition at line 13 of file llex.c.

#define MAXSRC   80

Definition at line 75 of file llex.c.

Referenced by luaX_lexerror().

#define next ( ls   )     (ls->current = zgetc(ls->z))
#define save_and_next ( ls   )     (save(ls, ls->current), next(ls))

Definition at line 48 of file llex.c.

Referenced by check_next(), llex(), read_long_string(), read_numeral(), read_string(), and skip_sep().


Function Documentation

static void buffreplace ( LexState ls,
char  from,
char  to 
) [static]

Definition at line 169 of file llex.c.

References LexState::buff, luaZ_buffer, and luaZ_bufflen.

Referenced by read_numeral(), and trydecpoint().

static int check_next ( LexState ls,
const char *  set 
) [static]

Definition at line 161 of file llex.c.

References LexState::current, and save_and_next.

Referenced by llex(), and read_numeral().

static void inclinenumber ( LexState ls  )  [static]
static int llex ( LexState ls,
SemInfo seminfo 
) [static]
void luaX_init ( lua_State L  ) 

Definition at line 64 of file llex.c.

References cast_byte, lua_assert, luaS_fix, luaS_new, luaX_tokens, NUM_RESERVED, TString::reserved, TOKEN_LEN, and TString::tsv.

Referenced by f_luaopen().

void luaX_lexerror ( LexState ls,
const char *  msg,
int  token 
)
void luaX_lookahead ( LexState ls  ) 

Definition at line 457 of file llex.c.

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

Referenced by constructor().

TString* luaX_newstring ( LexState ls,
const char *  str,
size_t  l 
)
void luaX_next ( LexState ls  ) 
void luaX_setinput ( lua_State L,
LexState ls,
ZIO z,
TString source 
)
void luaX_syntaxerror ( LexState ls,
const char *  msg 
)
const char* luaX_token2str ( LexState ls,
int  token 
)

Definition at line 78 of file llex.c.

References cast, FIRST_RESERVED, LexState::L, lua_assert, luaO_pushfstring(), and luaX_tokens.

Referenced by check_match(), error_expected(), and txtToken().

static void read_long_string ( LexState ls,
SemInfo seminfo,
int  sep 
) [static]
static void read_numeral ( LexState ls,
SemInfo seminfo 
) [static]
static void read_string ( LexState ls,
int  del,
SemInfo seminfo 
) [static]
static void save ( LexState ls,
int  c 
) [static]
static int skip_sep ( LexState ls  )  [static]

Definition at line 208 of file llex.c.

References LexState::current, lua_assert, and save_and_next.

Referenced by llex(), and read_long_string().

static void trydecpoint ( LexState ls,
SemInfo seminfo 
) [static]
static const char* txtToken ( LexState ls,
int  token 
) [static]

Definition at line 89 of file llex.c.

References LexState::buff, luaX_token2str(), luaZ_buffer, save(), TK_NAME, TK_NUMBER, and TK_STRING.

Referenced by luaX_lexerror().


Variable Documentation

const char* const luaX_tokens[]
Initial value:
 {
    "and", "break", "do", "else", "elseif",
    "end", "false", "for", "function", "if",
    "in", "local", "nil", "not", "or", "repeat",
    "return", "then", "true", "until", "while",
    "..", "...", "==", ">=", "<=", "~=",
    "<number>", "<name>", "<string>", "<eof>",
    NULL
}

Definition at line 37 of file llex.c.

Referenced by luaX_init(), and luaX_token2str().


ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:50:00 2011 by Doxygen 1.6.1