Commit Graph

61 Commits

Author SHA1 Message Date
abcdefg30
6a31b1f9f3 Update the copyright header year 2022-05-28 00:35:10 -05:00
Eduardo Cáceres
aa998a46d9 Simplify collection initialization 2022-05-18 11:42:36 -05:00
Eduardo Cáceres
79f321cb44 .Any(), .Count() -> .Count or .Length 2022-05-18 11:42:36 -05:00
RoosterDragon
f5d1fe4bc4 Use more efficient search in MergeIntoResolved
Switch Enumerable.FirstOrDefault to List.Find. The latter can avoid some allocations because the concrete collection type is known.
2022-02-11 14:01:16 +01:00
Matthias Mailänder
9d905d8291 Remove unused parameters and variables. 2021-12-06 13:19:28 +01:00
RoosterDragon
1d23c23d06 Adjust span comparisons for clarity and add some test cases. 2021-11-15 13:20:34 +01:00
RoosterDragon
5416910249 Remove unused method in MiniYaml 2021-11-15 13:20:34 +01:00
RoosterDragon
73547c31ec Remove MiniYamlNodes alias in MiniYaml. 2021-11-15 13:20:34 +01:00
RoosterDragon
2db312a792 In MiniYaml, presize some collections and trim lists during parsing. 2021-11-15 13:20:34 +01:00
RoosterDragon
0f01df5474 Avoid string allocations in MiniYaml parsing.
- Stream lines in as memory rather than needing to realise a string for each line, via a new method in StreamExts.
- Use span to avoid string allocations during parsing until we want to realise the node itself, in MiniYaml.FromLines.
- Change several callsites to use the streaming extension method rather than string method where possible.
2021-11-15 13:20:34 +01:00
Andre Mohren
6810469634 Updated copyright years. 2021-06-29 18:33:21 -05:00
teinarss
10676be377 Replace F extension with string interpolation 2021-05-08 22:20:59 +02:00
Paul Chote
d52ba83f96 Replace terniary null checks with coalescing. 2021-03-08 18:11:25 +01:00
RoosterDragon
4f34d3edb3 Improvements in MiniYaml allocation
- Clone method will use the node count to create the correct capacity.
- ResolveInherits will use the node count as the suggested initial capacity.
- FromStream will now stream lines, rather than reading the whole file into memory and then splitting into lines.
2020-10-20 22:53:32 +02:00
RoosterDragon
8fb65fd9bf Use string pooling in MiniYaml to de-duplicate strings in memory.
These config files often contain many repeated strings which result in different string references in memory. By using a pool, we can detect when the strings are equal and reuse an existing reference as strings are immutable.

The FromLines will now use a pool to de-duplicate strings for a single call. By allowing a pool to be provided as a parameter, we can reuse even more strings. The MapCache defines such a pool so that strings are reused across all maps in the cache for even more savings.
2020-10-12 21:57:08 +02:00
RoosterDragon
9072d645fd Use TrimExcess to shrink lists used by MiniYaml after loading 2020-10-12 21:57:08 +02:00
teinarss
27f1a7ab27 Use out var syntax 2020-08-19 18:11:07 +01:00
abcdefg30
23b3c237b7 Update the year numbers in all license headers to 2020 2020-01-05 17:00:34 +00:00
Paul Chote
0b8a367867 Fix MiniYaml parsing of empty comments 2019-12-28 19:15:36 +01:00
Paul Chote
674155a8dd Move ctor initializers to their own line. 2019-06-08 18:44:50 +02:00
Paul Chote
ebd36891dc Switch other struct types to default(T). 2019-06-08 13:19:57 +02:00
Paul Chote
2a085945df Add terminating newline to yaml strings. 2019-05-02 13:40:22 +02:00
abcdefg30
cadbd0d9ab Change the year number in all cs headers from 2018 to 2019 2019-01-26 23:15:21 +01:00
Paul Chote
df31690332 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.
2018-05-12 16:42:54 +02:00
Arular101
8a60918841 Update copyright notice year to 2018 2018-01-17 00:47:34 +01:00
Paul Chote
d170262e09 Fix yaml merging of nodes that define their own overrides. 2017-10-06 17:54:11 +02:00
Paul Chote
0ddc4360fe Remove unused MiniYaml DictFromFile. 2017-05-26 23:02:25 -05:00
Paul Chote
2be8cedddf Add StringComparison arguments to StartsWith. 2017-01-23 20:22:46 +00:00
Taryn Hill
43317e0f5d Update copyright notice year to 2017 2016-12-31 23:46:13 -06:00
Paul Chote
77e00e4587 Allow sequence blocks to remove inherited node Defaults. 2016-07-13 22:22:13 +01:00
Taryn Hill
ec40623052 Do not remove empty entries in MiniYaml.FromString 2016-06-17 10:38:06 -05:00
Paul Chote
b4d1517d0d Set yaml filename when loading from FileSystem. 2016-06-04 15:23:44 +01:00
Paul Chote
20e8bc249d Restore support for inline map rules. 2016-03-10 19:27:50 +00:00
Paul Chote
e71225496b Clarify GPL version. 2016-02-21 16:30:48 +00:00
Paul Chote
b396965fd9 Update licence header year. 2016-02-21 16:27:31 +00:00
Paul Chote
ab921682c4 Rewrite yaml merger. 2016-01-30 15:03:56 +00:00
Taryn Hill
2974af83c6 Remove unused MiniYaml methods From(Dictionary|List) 2015-12-27 07:56:41 -06:00
Pavel Penev
1b88d24cfa Unstatic GlobalFileSystem and rename it to FileSystem
Add a ModFiles field on ModData and move all access to the file system to go through that.
2015-12-14 03:42:22 +02:00
Paul Chote
c7249e6fa6 Move yaml removals to the end of the merge. 2015-11-28 17:20:32 +01:00
Paul Chote
a074bb1d4b Rename MiniYaml MergeLiberal -> MergePartial, MergeStrict -> Merge. 2015-11-28 17:20:21 +01:00
Taryn Hill
a8600ffbe7 Replace instance of 4 spaces with a single tab in MiniYaml.cs 2015-11-11 13:03:22 -06:00
Taryn Hill
44e03c094b Add newlines in MiniYaml.cs for readability 2015-11-11 12:47:30 -06:00
Taryn Hill
9b568f53a1 Rename some variables in MiniYaml.cs for readability 2015-11-11 12:44:04 -06:00
Paul Chote
0a43b3da72 Rewrite yaml merging block removal.
Fixes #2922, #6818.
2015-04-22 19:58:10 +12:00
Matthias Mailänder
24deec2a7b fix CodeLineMustNotEndWithWhitespace 2015-01-25 18:41:29 +01:00
RoosterDragon
c39ff6894c Reassert some changes lost in rebasing in MiniYaml.cs. 2015-01-20 20:52:02 +00:00
Oliver Brakmann
7267a3afdb Merge pull request #6984 from DeadlySurprise/yamlFix
Fixed yaml bug with leading spaces
2015-01-20 21:42:22 +01:00
abcdefg30
8ca61aa917 Updated all year numbers 2015-01-09 21:18:05 +01:00
DeadlySurprise
fbe6ab7f4e Fixed yaml bug with leading spaces 2015-01-07 22:16:15 +01:00
RoosterDragon
a6cda967c2 Formatted all files.
Automatically formatted all files via VS. This generally corrects indentation, removes trailing whitespace and corrects misplaced tabs or spaces. Manually tweaked a few files where required.
2015-01-06 21:28:50 +00:00