From ff857a9c7145db06306106a2a45f0c3e2a192fe3 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 11 Aug 2011 14:22:27 +0900 Subject: [PATCH] Permit control of single character tokens. --- include/QF/script.h | 4 ++++ libs/util/script.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/include/QF/script.h b/include/QF/script.h index ce8194eab..bc11b0e2a 100644 --- a/include/QF/script.h +++ b/include/QF/script.h @@ -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. diff --git a/libs/util/script.c b/libs/util/script.c index 6f8a65f57..f78f427a1 100644 --- a/libs/util/script.c +++ b/libs/util/script.c @@ -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++;