mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-29 13:33:18 +00:00
Changed meaning of spaces in WML.
They are no longer significant, unless they are quoted or between two words.
This commit is contained in:
parent
4ecf20cf9d
commit
26b393eaed
@ -234,7 +234,7 @@ void parser::parse_variable()
|
||||
|
||||
std::vector<std::string>::const_iterator curvar = variables.begin();
|
||||
|
||||
bool ignore_next_newlines = false;
|
||||
bool ignore_next_newlines = false, previous_string = false;
|
||||
while(1) {
|
||||
tok_->next_token();
|
||||
assert(curvar != variables.end());
|
||||
@ -248,7 +248,6 @@ void parser::parse_variable()
|
||||
cfg[*curvar] = buffer.value();
|
||||
buffer = t_string_base();
|
||||
++curvar;
|
||||
continue;
|
||||
} else {
|
||||
buffer += ",";
|
||||
}
|
||||
@ -268,14 +267,18 @@ void parser::parse_variable()
|
||||
break;
|
||||
case token::END:
|
||||
case token::LF:
|
||||
buffer += "_";
|
||||
goto finish;
|
||||
}
|
||||
break;
|
||||
case '+':
|
||||
ignore_next_newlines = true;
|
||||
continue;
|
||||
case token::STRING:
|
||||
if (previous_string) buffer += " ";
|
||||
//nobreak
|
||||
default:
|
||||
buffer += tok_->current_token().leading_spaces + tok_->current_token().value;
|
||||
buffer += tok_->current_token().value;
|
||||
break;
|
||||
case token::QSTRING:
|
||||
buffer += tok_->current_token().value;
|
||||
@ -290,6 +293,7 @@ void parser::parse_variable()
|
||||
goto finish;
|
||||
}
|
||||
|
||||
previous_string = tok_->current_token().type == token::STRING;
|
||||
ignore_next_newlines = false;
|
||||
}
|
||||
|
||||
|
@ -57,13 +57,12 @@ const token &tokenizer::next_token()
|
||||
#if DEBUG
|
||||
previous_token_ = token_;
|
||||
#endif
|
||||
token_.reset();
|
||||
token_.value.clear();
|
||||
|
||||
// Dump spaces and inlined comments
|
||||
for(;;)
|
||||
{
|
||||
while (is_space(current_)) {
|
||||
token_.leading_spaces += current_;
|
||||
next_char_fast();
|
||||
}
|
||||
if (current_ != 254)
|
||||
|
@ -29,7 +29,6 @@ struct token
|
||||
{
|
||||
token() :
|
||||
type(END),
|
||||
leading_spaces(),
|
||||
value()
|
||||
{}
|
||||
|
||||
@ -52,14 +51,6 @@ struct token
|
||||
};
|
||||
|
||||
token_type type;
|
||||
|
||||
void reset()
|
||||
{
|
||||
value.clear();
|
||||
leading_spaces.clear();
|
||||
}
|
||||
|
||||
std::string leading_spaces;
|
||||
std::string value;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user