Extend MiniYaml parser with new features:

- Add support for escaping '#' inside values
- Add support for escaping leading and trailing whitespace

And when discardCommentsAndWhitespace is set to false:
- Add proper support for comments
- Persist empty lines

Whitespace and comment support requires an explicit opt-in because
they produce MiniYamlNodes with null keys.  Supporting these through
the entire game engine would require changing all yaml enumerations
to explicitly check and account for these keys with no benefit.

Comments and whitespace are now treated as real nodes during parsing,
which means that the yaml parser will throw errors if they have
incorrect indentation, even if these nodes will be discarded.
This commit is contained in:
Paul Chote
2018-05-07 17:49:21 +00:00
committed by reaperrr
parent 7a41b3aa89
commit df31690332
5 changed files with 222 additions and 98 deletions

View File

@@ -375,6 +375,10 @@ namespace OpenRA
var key = keySelector(item);
var element = elementSelector(item);
// Discard elements with null keys
if (!typeof(TKey).IsValueType && key == null)
continue;
// Check for a key conflict:
if (d.ContainsKey(key))
{