28 Zio(
const char *input,
size_t nSize):p(input), n(nSize){};
51 static const int EOZ = -1;
52 static const int MAX_INT = 65530;
53 static const int FIRST_RESERVED = 257;
56 static const int MAXNOCHECK = 5;
58 static const int EXTRABUFF = 32;
61 static const int TOKEN_LEN = (
sizeof(
"function")/
sizeof(
char));
65 TK_AND = FIRST_RESERVED, TK_BREAK,
66 TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION,
67 TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
68 TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
70 TK_NAME, TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER,
74 static const int NUM_RESERVED = (int)TK_WHILE-FIRST_RESERVED+1;
87 LexState * SetInput(
const char* input,
int nLen);
89 LexState * GetState(){
return &m_lexState;};
91 static const char* FormatString(
const char * zFormat,...);
92 static void luaX_errorline (
LexState *ls,
const char *s,
const char *token,
int line);
93 static void luaX_error (
LexState *ls,
const char *s,
const char *token);
94 static void luaX_syntaxerror (
LexState *ls,
const char *msg);
95 static void luaX_checklimit (
LexState *ls,
int val,
int limit,
const char *msg);
96 static void luaX_lexerror (
LexState *ls,
const char *s,
int token);
97 static const char *luaX_token2str (
LexState *ls,
int token);
104 static inline int next(
LexState *LS)
106 return LS->current = ((LS->z)->n--)>0 ? (int)((
unsigned char)(*(LS->z)->p++)) : EOZ;
109 static void checkbuffer(
LexState *LS,
int len)
111 if (((len)+MAXNOCHECK)*
sizeof(
char) > LS->buff.size())
114 LS->buff.resize(len+EXTRABUFF);
118 LS->buff.resize(len*2);
122 static void save(
LexState *LS,
char c,
int& l)
124 LS->buff[l++] = (char)c;
126 static void save_and_next(
LexState *LS,
int& l)
128 save(LS, LS->current, l);
132 static void ThrowError(
LexState *ls,
const char* errorMsg);
134 static void inclinenumber (
LexState *LS);
158 static const int LUA_MAXPARSERLEVEL = 200;
168 static bool IsMsgData(
const char* input,
int nLen);
171 static bool IsPureData(
const char* input,
int nLen);
174 static bool IsPureTable(
const char* input,
int nLen);
177 static bool CheckPureDataBlock(
LexState *ls);
184 static bool IsIdentifier(
const char* str,
int nLength);
186 static void enterlevel(
LexState *ls)
188 if (++(ls)->nestlevel > LUA_MAXPARSERLEVEL)
189 NPLLex::luaX_syntaxerror(ls,
"too many syntax levels");
192 static void leavelevel(
LexState *ls)
198 static void lookahead (
LexState *ls);
199 static void error_expected (
LexState *ls,
int token);
200 static int testnext (
LexState *ls,
int c);
201 static void check (
LexState *ls,
int c);
202 static void check_condition(
LexState *ls,
void* c,
const char* msg);
203 static void check_match (
LexState *ls,
int what,
int who,
int where);
define this to enable debugging of NPL code in visual studio
Definition: INPL.h:9
lex state
Definition: NPLParser.h:32
for lexer for NPL files
Definition: NPLParser.h:47
Definition: NPLParser.h:23
parser for NPL files.
Definition: NPLParser.h:147
bool bSucceed
true if no error
Definition: NPLParser.h:43
Definition: NPLParser.h:17
Definition: NPLParser.h:10