mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
- let WildMidi tokenizer handle quoted strings.
This commit is contained in:
parent
7fa289109b
commit
0634205d7f
1 changed files with 8 additions and 3 deletions
|
@ -573,13 +573,15 @@ static inline int wm_isdigit(int c) {
|
|||
}
|
||||
|
||||
#define TOKEN_CNT_INC 8
|
||||
static char** WM_LC_Tokenize_Line(char *line_data) {
|
||||
static char** WM_LC_Tokenize_Line(char *line_data)
|
||||
{
|
||||
int line_length = strlen(line_data);
|
||||
int token_data_length = 0;
|
||||
int line_ofs = 0;
|
||||
int token_start = 0;
|
||||
char **token_data = NULL;
|
||||
int token_count = 0;
|
||||
bool in_quotes = false;
|
||||
|
||||
if (line_length == 0)
|
||||
return NULL;
|
||||
|
@ -589,8 +591,11 @@ static char** WM_LC_Tokenize_Line(char *line_data) {
|
|||
if (line_data[line_ofs] == '#') {
|
||||
break;
|
||||
}
|
||||
|
||||
if ((line_data[line_ofs] == ' ') || (line_data[line_ofs] == '\t')) {
|
||||
if (line_data[line_ofs] == '"')
|
||||
{
|
||||
in_quotes = !in_quotes;
|
||||
}
|
||||
else if (!in_quotes && ((line_data[line_ofs] == ' ') || (line_data[line_ofs] == '\t'))) {
|
||||
/* whitespace means we aren't in a token */
|
||||
if (token_start) {
|
||||
token_start = 0;
|
||||
|
|
Loading…
Reference in a new issue