mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
Scripts now treat {}()': as single character tokens.
This commit is contained in:
parent
032f16d1b3
commit
ac88c86dd3
4 changed files with 14 additions and 5 deletions
|
@ -157,9 +157,16 @@ Script_GetToken (script_t *script, qboolean crossline)
|
|||
dstring_copysubstr (script->token, token_p, script->p - token_p);
|
||||
script->p++;
|
||||
} else {
|
||||
const char *single = "{}()':";
|
||||
|
||||
token_p = script->p;
|
||||
while (*script->p && !isspace ((unsigned char) *script->p))
|
||||
if (strchr (single, *script->p)) {
|
||||
script->p++;
|
||||
} else {
|
||||
while (*script->p && !isspace ((unsigned char) *script->p)
|
||||
&& !strchr (single, *script->p))
|
||||
script->p++;
|
||||
}
|
||||
dstring_copysubstr (script->token, token_p, script->p - token_p);
|
||||
}
|
||||
|
||||
|
|
|
@ -191,7 +191,8 @@ ParseVerts (int *n_verts)
|
|||
|
||||
if (map_script->token->str[0] != ':')
|
||||
map_error ("parsing brush");
|
||||
*n_verts = atoi (map_script->token->str + 1);
|
||||
Script_GetToken (map_script, false);
|
||||
*n_verts = atoi (map_script->token->str);
|
||||
verts = malloc (sizeof (vec3_t) * *n_verts);
|
||||
|
||||
for (i = 0; i < *n_verts; i++) {
|
||||
|
|
|
@ -834,7 +834,8 @@ progs_src_compile (void)
|
|||
else
|
||||
dsprintf (qc_filename, "%s", script->token->str);
|
||||
if (options.verbosity >= 2)
|
||||
printf ("%s:%d: compiling %s\n", script->file, script->line, qc_filename->str);
|
||||
printf ("%s:%d: compiling %s\n", script->file, script->line,
|
||||
qc_filename->str);
|
||||
|
||||
if (single) {
|
||||
fprintf (single, "$frame_reset\n");
|
||||
|
|
|
@ -186,7 +186,7 @@ LoadEntities (void)
|
|||
// go through all the entities
|
||||
while (Script_GetToken (script, 1)) {
|
||||
// parse the opening brace
|
||||
if (script->token->str[0] != '{')
|
||||
if (!strcmp (script->token->str, "{"))
|
||||
fprintf (stderr, "LoadEntities: found %s when expecting {",
|
||||
script->token->str);
|
||||
|
||||
|
@ -220,7 +220,7 @@ LoadEntities (void)
|
|||
// FIXME shouldn't cross line
|
||||
if (!Script_GetToken (script, 1))
|
||||
fprintf (stderr, "LoadEntities: EOF without closing brace");
|
||||
if (script->token->str[0] == '}')
|
||||
if (!strcmp (script->token->str, "}"))
|
||||
fprintf (stderr, "LoadEntities: closing brace without data");
|
||||
|
||||
epair = calloc (1, sizeof (epair_t));
|
||||
|
|
Loading…
Reference in a new issue