Permit control of single character tokens.

This commit is contained in:
Bill Currie 2011-08-11 14:22:27 +09:00
parent 805256ff65
commit ff857a9c71
2 changed files with 6 additions and 0 deletions

View file

@ -45,6 +45,10 @@ typedef struct script_s {
void (*error)(struct script_s *script, const char *msg);
/// if set, multi line quoted tokens will be treated as errors
int no_quote_lines;
/// if set, characters in this string will always be lexed as single
/// character tokens. If not set, defaults to "{}()':". Set to ""
/// (empty string) to disable. Not set by default.
const char *single;
} script_t;
/** Return a new script_t object.

View file

@ -159,6 +159,8 @@ Script_GetToken (script_t *script, qboolean crossline)
} else {
const char *single = "{}()':";
if (script->single)
single = script->single;
token_p = script->p;
if (strchr (single, *script->p)) {
script->p++;