lua/llex.c File Reference

#include <ctype.h>
#include <string.h>
#include "lua.h"
#include "ldo.h"
#include "llex.h"
#include "lobject.h"
#include "lparser.h"
#include "lstate.h"
#include "lstring.h"
#include "lzio.h"

Go to the source code of this file.

Defines

#define llex_c
#define next(LS)   (LS->current = zgetc(LS->z))
#define MAXSRC   80
#define EXTRABUFF   32
#define MAXNOCHECK   5
#define checkbuffer(LS, len)
#define save(LS, c, l)   (luaZ_buffer((LS)->buff)[l++] = cast(char, c))
#define save_and_next(LS, l)   (save(LS, LS->current, l), next(LS))

Functions

void luaX_init (lua_State *L)
void luaX_checklimit (LexState *ls, int val, int limit, const char *msg)
void luaX_errorline (LexState *ls, const char *s, const char *token, int line)
static void luaX_error (LexState *ls, const char *s, const char *token)
void luaX_syntaxerror (LexState *ls, const char *msg)
const char * luaX_token2str (LexState *ls, int token)
static void luaX_lexerror (LexState *ls, const char *s, int token)
static void inclinenumber (LexState *LS)
void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source)
static size_t readname (LexState *LS)
static void read_numeral (LexState *LS, int comma, SemInfo *seminfo)
static void read_long_string (LexState *LS, SemInfo *seminfo)
static void read_string (LexState *LS, int del, SemInfo *seminfo)
int luaX_lex (LexState *LS, SemInfo *seminfo)

Variables

static const char *const token2string []


Define Documentation

#define checkbuffer ( LS,
len   ) 

Value:

if (((len)+MAXNOCHECK)*sizeof(char) > luaZ_sizebuffer((LS)->buff)) \
      luaZ_openspace((LS)->L, (LS)->buff, (len)+EXTRABUFF)

Definition at line 159 of file llex.c.

Referenced by read_long_string(), read_numeral(), read_string(), and readname().

#define EXTRABUFF   32

Definition at line 154 of file llex.c.

#define llex_c

Definition at line 11 of file llex.c.

#define MAXNOCHECK   5

Definition at line 157 of file llex.c.

#define MAXSRC   80

Definition at line 52 of file llex.c.

Referenced by luaX_errorline().

#define next ( LS   )     (LS->current = zgetc(LS->z))

#define save ( LS,
c,
 )     (luaZ_buffer((LS)->buff)[l++] = cast(char, c))

#define save_and_next ( LS,
 )     (save(LS, LS->current, l), next(LS))

Definition at line 165 of file llex.c.

Referenced by read_long_string(), read_numeral(), read_string(), and readname().


Function Documentation

static void inclinenumber ( LexState LS  )  [static]

Definition at line 117 of file llex.c.

References LexState::linenumber, luaX_checklimit(), MAX_INT, and next.

Referenced by luaX_lex(), read_long_string(), and read_string().

void luaX_checklimit ( LexState ls,
int  val,
int  limit,
const char *  msg 
)

static void luaX_error ( LexState ls,
const char *  s,
const char *  token 
) [static]

Definition at line 72 of file llex.c.

References LexState::linenumber, and luaX_errorline().

Referenced by luaX_lex(), luaX_lexerror(), and luaX_syntaxerror().

void luaX_errorline ( LexState ls,
const char *  s,
const char *  token,
int  line 
)

Definition at line 63 of file llex.c.

References getstr, LexState::L, luaD_throw(), luaO_chunkid(), luaO_pushfstring(), MAXSRC, and LexState::source.

Referenced by luaX_error(), and prefixexp().

void luaX_init ( lua_State L  ) 

Definition at line 41 of file llex.c.

References cast, lua_assert, luaS_fix, luaS_new, NUM_RESERVED, TString::reserved, token2string, TOKEN_LEN, and TString::tsv.

Referenced by f_luaopen().

int luaX_lex ( LexState LS,
SemInfo seminfo 
)

static void luaX_lexerror ( LexState ls,
const char *  s,
int  token 
) [static]

Definition at line 107 of file llex.c.

References LexState::buff, luaX_error(), luaX_token2str(), luaZ_buffer, and TK_EOS.

Referenced by read_long_string(), read_numeral(), and read_string().

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 
)

static void read_long_string ( LexState LS,
SemInfo seminfo 
) [static]

static void read_numeral ( LexState LS,
int  comma,
SemInfo seminfo 
) [static]

static void read_string ( LexState LS,
int  del,
SemInfo seminfo 
) [static]

static size_t readname ( LexState LS  )  [static]

Definition at line 168 of file llex.c.

References checkbuffer, LexState::current, save, and save_and_next.

Referenced by luaX_lex().


Variable Documentation

const char* const token2string[] [static]

Initial value:

 {
    "and", "break", "do", "else", "elseif",
    "end", "false", "for", "function", "if",
    "in", "local", "nil", "not", "or", "repeat",
    "return", "then", "true", "until", "while", "*name",
    "..", "...", "==", ">=", "<=", "~=",
    "*number", "*string", "<eof>"
}

Definition at line 31 of file llex.c.

Referenced by luaX_init(), and luaX_token2str().


Generated on Fri Dec 12 13:02:11 2008 for rpm by  doxygen 1.5.6