forked from NeoFlock/noom
get owned
This commit is contained in:
15
src/lexer.c
15
src/lexer.c
@@ -403,15 +403,9 @@ noom_uint_t noomL_getstring(const char* s, noomL_ErrorType* error, noom_LuaVersi
|
||||
noom_uint_t order = 0;
|
||||
int succ = 0;
|
||||
|
||||
while (s[len] == '=') {
|
||||
order++;
|
||||
len++;
|
||||
}
|
||||
while (s[len] == '=') order++, len++;
|
||||
|
||||
if (s[len] == '[') {
|
||||
len++;
|
||||
succ = 1;
|
||||
}
|
||||
if (s[len] == '[') len++, succ = 1;
|
||||
|
||||
if (succ) { // it is a multi-line string.
|
||||
while (1) {
|
||||
@@ -420,10 +414,7 @@ noom_uint_t noomL_getstring(const char* s, noomL_ErrorType* error, noom_LuaVersi
|
||||
noom_uint_t order2 = 0;
|
||||
noom_uint_t startp = len; // intentionally after the `]`
|
||||
|
||||
while (s[len] == '=') {
|
||||
order2++;
|
||||
len++;
|
||||
}
|
||||
while (s[len] == '=') order2++, len++;
|
||||
|
||||
if (s[len] == ']' && order == order2) { // holy shit it's real
|
||||
len++;
|
||||
|
||||
@@ -35,7 +35,6 @@ typedef struct noomL_Token {
|
||||
noom_uint_t length;
|
||||
} noomL_Token;
|
||||
|
||||
|
||||
int noomL_isalpha(char c);
|
||||
int noomL_isnumber(char c);
|
||||
int noomL_isalphanum(char c);
|
||||
@@ -51,4 +50,3 @@ const char *noomL_formatTokenType(noomL_TokenType token_type);
|
||||
noomL_ErrorType noomL_lex(const char* s, noom_uint_t start, noomL_Token* token, noom_LuaVersion version); // TODO: add more error data
|
||||
// UB if syntax error
|
||||
noom_uint_t noomL_tokenlen(const char* s, noom_uint_t start, noom_LuaVersion version);
|
||||
|
||||
|
||||
@@ -168,4 +168,3 @@ noomP_Node* noomP_parseStatement(noomP_Parser* parser);
|
||||
int noomP_parse(const char* code, const char* filename, noom_LuaVersion version, noomP_Node** outpointer, noomP_Parser* parser);
|
||||
|
||||
int noomP_initParser(noomP_Parser* parser, const char* code, const char* filename, noom_LuaVersion version);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user