CHDK_DE Vorschauversion  Trunk Rev. 5163
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
llex.h-Dateireferenz
#include "lobject.h"
#include "lzio.h"
+ Include-Abhängigkeitsdiagramm für llex.h:
+ Dieser Graph zeigt, welche Datei direkt oder indirekt diese Datei enthält:

gehe zum Quellcode dieser Datei

Datenstrukturen

union  SemInfo
 
struct  Token
 
struct  LexState
 

Makrodefinitionen

#define FIRST_RESERVED   257
 
#define TOKEN_LEN   (sizeof("function")/sizeof(char))
 
#define NUM_RESERVED   (cast(int, TK_WHILE-FIRST_RESERVED+1))
 

Typdefinitionen

typedef struct Token Token
 
typedef struct LexState LexState
 

Aufzählungen

enum  RESERVED {
  TK_AND = FIRST_RESERVED, TK_BREAK, TK_DO, TK_ELSE,
  TK_ELSEIF, TK_END, TK_FALSE, TK_FOR,
  TK_FUNCTION, 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_CONCAT, TK_DOTS, TK_EQ,
  TK_GE, TK_LE, TK_NE, TK_NUMBER,
  TK_NAME, TK_STRING, TK_EOS
}
 

Funktionen

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

Variablen

LUAI_DATA const char *const luaX_tokens []
 

Makro-Dokumentation

#define FIRST_RESERVED   257

Definiert in Zeile 14 der Datei llex.h.

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

Definiert in Zeile 36 der Datei llex.h.

#define TOKEN_LEN   (sizeof("function")/sizeof(char))

Definiert in Zeile 17 der Datei llex.h.

Dokumentation der benutzerdefinierten Typen

typedef struct LexState LexState
typedef struct Token Token

Dokumentation der Aufzählungstypen

enum RESERVED
Aufzählungswerte
TK_AND 
TK_BREAK 
TK_DO 
TK_ELSE 
TK_ELSEIF 
TK_END 
TK_FALSE 
TK_FOR 
TK_FUNCTION 
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_CONCAT 
TK_DOTS 
TK_EQ 
TK_GE 
TK_LE 
TK_NE 
TK_NUMBER 
TK_NAME 
TK_STRING 
TK_EOS 

Definiert in Zeile 24 der Datei llex.h.

24  {
25  /* terminal symbols denoted by reserved words */
30  /* other terminal symbols */
33 };

Dokumentation der Funktionen

LUAI_FUNC void luaX_init ( lua_State L)

Definiert in Zeile 64 der Datei llex.c.

64  {
65  int i;
66  for (i=0; i<NUM_RESERVED; i++) {
67  TString *ts = luaS_new(L, luaX_tokens[i]);
68  luaS_fix(ts); /* reserved words are never collected */
70  ts->tsv.reserved = cast_byte(i+1); /* reserved word */
71  }
72 }
LUAI_FUNC void luaX_lexerror ( LexState ls,
const char *  msg,
int  token 
)

Definiert in Zeile 102 der Datei llex.c.

102  {
103  char buff[MAXSRC];
104  luaO_chunkid(buff, getstr(ls->source), MAXSRC);
105  msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg);
106  if (token)
107  luaO_pushfstring(ls->L, "%s near " LUA_QS, msg, txtToken(ls, token));
108  luaD_throw(ls->L, LUA_ERRSYNTAX);
109 }
LUAI_FUNC void luaX_lookahead ( LexState ls)

Definiert in Zeile 463 der Datei llex.c.

463  {
465  ls->lookahead.token = llex(ls, &ls->lookahead.seminfo);
466 }
LUAI_FUNC TString* luaX_newstring ( LexState ls,
const char *  str,
size_t  l 
)

Definiert in Zeile 117 der Datei 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 }
LUAI_FUNC void luaX_next ( LexState ls)

Definiert in Zeile 452 der Datei llex.c.

452  {
453  ls->lastline = ls->linenumber;
454  if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */
455  ls->t = ls->lookahead; /* use this one */
456  ls->lookahead.token = TK_EOS; /* and discharge it */
457  }
458  else
459  ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */
460 }
LUAI_FUNC void luaX_setinput ( lua_State L,
LexState ls,
ZIO z,
TString source 
)

Definiert in Zeile 140 der Datei llex.c.

140  {
141  ls->decpoint = '.';
142  ls->L = L;
143  ls->lookahead.token = TK_EOS; /* no look-ahead token */
144  ls->z = z;
145  ls->fs = NULL;
146  ls->linenumber = 1;
147  ls->lastline = 1;
148  ls->source = source;
149  luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */
150  next(ls); /* read first char */
151 }
LUAI_FUNC void luaX_syntaxerror ( LexState ls,
const char *  s 
)

Definiert in Zeile 112 der Datei llex.c.

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

Definiert in Zeile 78 der Datei 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
86 }

Variablen-Dokumentation

LUAI_DATA const char* const luaX_tokens[]

Definiert in Zeile 40 der Datei llex.h.