The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Macros | Functions | Variables
llex.cpp File Reference
#include <locale.h>
#include <string.h>
#include "lua.h"
#include "lctype.h"
#include "ldo.h"
#include "llex.h"
#include "lobject.h"
#include "lparser.h"
#include "lstate.h"
#include "lstring.h"
#include "ltable.h"
#include "lzio.h"
Include dependency graph for llex.cpp:

Go to the source code of this file.

Macros

#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 getlocaledecpoint()   (localeconv()->decimal_point[0])
 
#define buff2d(b, e)   luaO_str2d(luaZ_buffer(b), luaZ_bufflen(b) - 1, e)
 

Functions

static l_noret lexerror (LexState *ls, const char *msg, int token)
 
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)
 
l_noret 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, int firstchar)
 
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 escerror (LexState *ls, int *c, int n, const char *msg)
 
static int readhexaesc (LexState *ls)
 
static int readdecesc (LexState *ls)
 
static void read_string (LexState *ls, int del, SemInfo *seminfo)
 
static int llex (LexState *ls, SemInfo *seminfo)
 
void luaX_next (LexState *ls)
 
int luaX_lookahead (LexState *ls)
 

Variables

static const char *const luaX_tokens []
 

Macro Definition Documentation

#define buff2d (   b,
  e 
)    luaO_str2d(luaZ_buffer(b), luaZ_bufflen(b) - 1, e)

Definition at line 208 of file llex.cpp.

Referenced by read_numeral(), and trydecpoint().

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

Definition at line 31 of file llex.cpp.

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

#define getlocaledecpoint ( )    (localeconv()->decimal_point[0])

Definition at line 204 of file llex.cpp.

Referenced by trydecpoint().

#define llex_c

Definition at line 10 of file llex.cpp.

#define LUA_CORE

Definition at line 11 of file llex.cpp.

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

Definition at line 45 of file llex.cpp.

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 195 of file llex.cpp.

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 184 of file llex.cpp.

References LexState::current, and save_and_next.

Referenced by llex(), and read_numeral().

static void escerror ( LexState ls,
int c,
int  n,
const char *  msg 
)
static

Definition at line 304 of file llex.cpp.

References LexState::buff, EOZ, i, lexerror(), luaZ_resetbuffer, save(), and TK_STRING.

Referenced by read_string(), readdecesc(), and readhexaesc().

static void inclinenumber ( LexState ls)
static
static l_noret lexerror ( LexState ls,
const char *  msg,
int  token 
)
static
static int llex ( LexState ls,
SemInfo seminfo 
)
static
void luaX_init ( lua_State L)

Definition at line 64 of file llex.cpp.

References cast_byte, TString::extra, i, luaS_fix, luaS_new(), luaX_tokens, NUM_RESERVED, and TString::tsv.

Referenced by f_luaopen().

int luaX_lookahead ( LexState ls)

Definition at line 524 of file llex.cpp.

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

Referenced by field().

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,
int  firstchar 
)
l_noret luaX_syntaxerror ( LexState ls,
const char *  msg 
)
const char* luaX_token2str ( LexState ls,
int  token 
)
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 int readdecesc ( LexState ls)
static

Definition at line 328 of file llex.cpp.

References LexState::current, escerror(), i, lisdigit, and next.

Referenced by read_string().

static int readhexaesc ( LexState ls)
static

Definition at line 314 of file llex.cpp.

References escerror(), i, lisxdigit, luaO_hexavalue(), and next.

Referenced by read_string().

static void save ( LexState ls,
int  c 
)
static
static int skip_sep ( LexState ls)
static

Definition at line 256 of file llex.cpp.

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

Variable Documentation

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

Definition at line 35 of file llex.cpp.

Referenced by luaX_init(), and luaX_token2str().