[Commits] [wesnoth/wesnoth] 13a482: Fixed WML parser not properly handling unquoted ke...

GitHub noreply at github.com
Thu Feb 8 19:21:36 UTC 2018


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 13a4822d77d8cb32b219b7c647fc9710309a2735
      https://github.com/wesnoth/wesnoth/commit/13a4822d77d8cb32b219b7c647fc9710309a2735
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2018-02-09 (Fri, 09 Feb 2018)

  Changed paths:
    M src/serialization/tokenizer.cpp

  Log Message:
  -----------
  Fixed WML parser not properly handling unquoted keys with variables (fixes #1236)

In cases such as `name=turn $var`, the key value would get parsed and serialized as
`turn$var`. The reason for this was that that string was broken down into 3 tokens:
"turn", "$", and "var". parser::parse_variable() handled these tokens, and the issue
was that "$" was considered a "misc" token instead of a string one. In cases where
two string tokens were added consecutively, a space would be added between them
(manually added spacing was not preserved). Since "$" did not count as a string, the
space was not added, which resulted in "turn$var". To fix that, I made the tokenizer
consider "$" a string token, so the spacing is correctly preserved.

For the record, despite what the bug report above says, wrapping the value in quotes
did work in lieu of this fix.





More information about the Commits mailing list