Archived
1
0

add SkipWhite function

This commit is contained in:
Marrub 2015-06-09 18:43:36 -04:00
parent 0a5ab301d1
commit 244eabbebf
3 changed files with 17 additions and 0 deletions

View File

@ -67,6 +67,7 @@ char *LT_ReadNumber();
char *LT_ReadString(char term); char *LT_ReadString(char term);
char *LT_Escaper(char *str, size_t pos, char escape); char *LT_Escaper(char *str, size_t pos, char escape);
LT_Token LT_GetToken(); LT_Token LT_GetToken();
void LT_SkipWhite();
]]) ]])
local pReturn local pReturn
@ -141,4 +142,8 @@ function tokenizer:setPos(newPos)
tokenizer:checkError() tokenizer:checkError()
end end
function tokenizer:skipWhite()
loveToken.LT_SkipWhite()
end
return tokenizer return tokenizer

View File

@ -878,3 +878,14 @@ LT_Token LT_GetToken()
return tk; return tk;
} }
void LT_SkipWhite()
{
char c = fgetc(parseFile);
while(isspace(c) && c != EOF)
{
c = fgetc(parseFile);
}
ungetc(c, parseFile);
}

View File

@ -125,6 +125,7 @@ char *LT_EXPORT LT_ReadNumber();
char *LT_EXPORT LT_ReadString(char term); char *LT_EXPORT LT_ReadString(char term);
char *LT_EXPORT LT_Escaper(char *str, size_t pos, char escape); char *LT_EXPORT LT_Escaper(char *str, size_t pos, char escape);
LT_Token LT_EXPORT LT_GetToken(); LT_Token LT_EXPORT LT_GetToken();
void LT_EXPORT LT_SkipWhite();
/* /*
* Variables * Variables