lex_file* lex_open(const char *file)
{
lex_file *lex;
- FILE *in = fopen(file, "rb");
+ FILE *in = util_fopen(file, "rb");
if (!in) {
lexerror(NULL, "open failed: '%s'\n", file);
case '[':
case ']':
- case '.':
-
case '#':
return (lex->tok->ttype = ch);
case '^':
case '~':
case ',':
- return ch;
+ case '.':
+ return (lex->tok->ttype = ch);
default:
break;
}
}
- if (ch == ',') {
+ if (ch == ',' || ch == '.') {
if (!lex_tokench(lex, ch) ||
!lex_endtoken(lex))
{
!strcmp(v, "if") ||
!strcmp(v, "else") ||
!strcmp(v, "var") ||
+ !strcmp(v, "local") ||
!strcmp(v, "return") ||
!strcmp(v, "const"))
lex->tok->ttype = TOKEN_KEYWORD;
return (lex->tok->ttype = TOKEN_FATAL);
/* It's a vector if we can successfully scan 3 floats */
- if (sscanf(lex->tok->value, " %f %f %f ", &lex->tok->constval.v.x, &lex->tok->constval.v.y, &lex->tok->constval.v.z) == 3)
+#ifdef WIN32
+ if (sscanf_s(lex->tok->value, " %f %f %f ",
+ &lex->tok->constval.v.x, &lex->tok->constval.v.y, &lex->tok->constval.v.z) == 3)
+#else
+ if (sscanf(lex->tok->value, " %f %f %f ",
+ &lex->tok->constval.v.x, &lex->tok->constval.v.y, &lex->tok->constval.v.z) == 3)
+#endif
{
lex->tok->ttype = TOKEN_VECTORCONST;
}