Commit graph

62 commits

Author SHA1 Message Date
Eric Huss d31787fa3b Merge pull request #373 from mgsloan/allow-empty-table-keys
Allow empty table keys
2021-04-26 13:32:09 -07:00
Alex Tokarev 39dcf1384c Improve error message when parsing unquoted string (#385)
* Improve error message when parsing unquoted string

* Remove conversion to lowercase in parse_keylike()

Converting keys to lowercase goes against
TOML specification for floats.

* Change error message for unquoted string
2020-10-11 12:30:55 -05:00
pyfisch af05f537d8 Allow delimiter quotes at the end of multiline strings (#393)
TOML allows (unlike many other formats) up to 2
additonal quotes that are part of the string:

basic = """2 extra quotes -->"""""
literal = '''here too ''''

Changed in TOML v1.0.0-rc.1

See also #392
2020-05-28 10:39:55 -05:00
Michael Sloan 6de25e7cc8 Allow empty table keys
Quoting 68076ffc6d (user-content-keys)

> A bare key must be non-empty, but an empty quoted key is allowed (though discouraged).

See also the discussion in https://github.com/toml-lang/toml/issues/432
2020-01-31 00:17:55 -07:00
Michael Sloan cd96581730 Fix roundtripping of \u001f and \u007f in toml string literals (#372) 2020-01-30 08:55:36 +01:00
daubaris c822128a02 Mixed type arrays (#358)
* Added support of mixed-type arrays

* Add tests cases

* Replaced &'static str type for type_ and created a new enum instead

* Restored ArrayMixedType
2019-11-22 10:28:29 -06:00
est31 e22c19436c Replace the test added by #349 with a bench (#351)
CI environments can be noisy and while the test worked great
locally on my machine, it didn't on the CI environment.
This replaces the test with a (manually tracked) benchmark.
As per https://github.com/alexcrichton/toml-rs/pull/349#issuecomment-546998173
2019-10-29 09:10:15 -05:00
est31 34ef67bee2 Decrease deserialization complexity from quadratic to linear (#349)
* Speed up array code

* Speed up map code too

Also add regression test

* Use more obvious closure notation

* Document the builder functions
2019-10-28 10:05:13 -05:00
est31 52586279ce Support for dotted table spans (#340)
* "Support" spans for maps

In toml you can declare maps via {} and via [name].
We can't obtain spans for [] maps but at least we
can emit fake spans to make SpannedValue work.

We also add a regression test.

* Don't regress the inline table case

* Also support arrays
2019-10-28 09:01:23 -05:00
est31 e89d255cbf Spanned: impl PartialEq, Eq, Hash, PartialOrd, Ord in terms of the value (#344)
* Spanned: impl PartialEq, Eq, Hash, PartialOrd, Ord in terms of the value

This is because we want to be able to index into HashMap<Spanned<String>, T>
with a dummy span and get results where only the content has to match.

* Add Borrow impl

* Add tests
2019-10-25 14:05:31 -05:00
est31 12db6aa93f Support deserializing spanned keys (#333)
* Store key spans in the deserializer

* Support deserializing spanned keys

* Store key spans of the table header as well

* Support nested table key spans as well
2019-09-16 16:32:45 -05:00
est31 5fef3914cf Suppport deserialization of Spanned<> at the top level (#328) 2019-09-05 08:38:54 -05:00
Alex Crichton 37e8b2274c Work around a rustfmt bug 2019-08-28 08:02:08 -07:00
Alex Crichton ee8839034b wut 2019-08-28 08:01:07 -07:00
Alex Crichton ccc659b254 More rustfmt 2019-08-28 07:59:44 -07:00
Alex Crichton d8309379ed Run rustfmt 2019-08-28 07:58:15 -07:00
Eric Huss f822f4661b Allow zero-prefixed float exponents. (#322) 2019-08-23 09:55:15 -07:00
Eric Huss 514b8ca8f2 Fix error line/column when using CRLF line endings. 2019-08-13 13:48:54 -07:00
Alex Crichton fd39bc7412 Run cargo fmt 2019-08-12 13:50:59 -07:00
Andres Suarez b09bb78352 Add line and column to all Errors 2019-07-30 13:35:08 -04:00
Andres Suarez 7875d03eeb Add tests covering custom deserializers 2019-07-30 13:16:59 -04:00
Andres Suarez 8c1b49f66f Show "column" in Error messages 2019-07-28 13:41:17 -04:00
Andres Suarez 8820659431 Fully expand error messages in tests 2019-07-28 12:58:26 -04:00
Alex Crichton e769341003 Merge pull request #308 from ehuss/edition-2018
Migrate to 2018 edition
2019-05-09 06:49:11 -07:00
Eric Huss 8f115c98d3 cargo fmt 2019-05-08 17:45:39 -07:00
Eric Huss 1b062a9bac Remove rustc version checking.
This is no longer necessary, as <1.20 is no longer supported.
2019-05-08 17:39:18 -07:00
Eric Huss 68fd59c78d Migrate to 2018 edition. 2019-05-08 12:12:14 -07:00
Alex Crichton b9fbd5b6f7 Merge pull request #298 from ehuss/missing-tests
Add some missing tests, and sort some entries.
2019-04-08 09:09:27 -05:00
Eric Huss 816b457c84 Fix float with invalid suffix. 2019-04-05 13:51:28 -07:00
Eric Huss 902e98cda1 Add some missing tests, and sort some entries. 2019-04-05 13:49:57 -07:00
Erich Gubler d34e734b39 Fix warnings for deprecated usages of trim_{left,right}_matches. 2019-04-02 09:35:28 -06:00
Eric Huss b7493c9bef Fix case sensitivity with T, Z, and E. 2019-02-19 10:59:42 -08:00
Alex Crichton 7c969432ad Merge pull request #278 from Kerollmops/master
Add the preserve_order feature (rebased version)
2019-01-08 15:24:40 -08:00
Alex Crichton 184d16b4a3 Fix disallowing duplicate table headers
This commit fixes #279 where a case of duplicate table headers slipped
through the cracks. This also adds an option to disable this new
validation to allow Cargo to preserve backwards compatibility.
2019-01-07 09:06:04 -08:00
Clément Renault b66f6108d3 Update the serde test-suite map! macro 2018-12-28 15:39:48 +01:00
Vincent Prouillet 8621ab27ae Add the preserve_order feature 2018-12-28 14:42:55 +01:00
Eric Huss b21dd8cf05 Fix trailing space after date.
The space between date and time was being eagerly skipped when it shouldn't.
2018-11-21 09:35:50 -08:00
Alex Crichton 14f8934bef Merge pull request #268 from jmhain/allow-ws-after-bs
Allow whitespace after line ending backslash (#162)
2018-10-29 09:47:56 -07:00
hcpl 5636a7430e Support tuple Serde types for Value 2018-10-28 12:36:40 +02:00
Joey Hain a9fb3bf188 Allow whitespace after line ending backslash (#162) 2018-10-27 12:49:17 -07:00
Matti Niemenmaa dce343e926 Avoid panic on pretty string ending in single quote
Fixes #262.
2018-10-01 11:58:57 +03:00
rhysd 935d95ce4f Fix multi-line strings are not allowed for key
In spec https://github.com/toml-lang/toml#keys

Quoted keys are clarified as

> he exact same rules as either basic strings or literal strings

TOML clearly distinguishes basic string and multi-line basic string
(literal string is also).

https://github.com/toml-lang/toml#string

So table key and quoted key should not allow multi-line basic string
and multi-line literal string.

ABNF definition also describes that.

https://github.com/toml-lang/toml/blob/master/toml.abnf

```
string = ml-basic-string / basic-string / ml-literal-string / literal-string

quoted-key = basic-string / literal-string
```

`string` contains `ml-*` but `quoted-key` doesn't.
2018-09-25 16:33:52 +09:00
Alex Crichton 48daf82e1a Merge pull request #255 from kornelski/master
Support deserializing from other integer types
2018-08-06 10:17:30 -05:00
Kornel 14338b8556 Test serde_json interoperability 2018-08-06 15:23:32 +01:00
Eric Huss 36a5318feb Support the new 0.5 syntax in the toml! macro.
- Space in datetime.
- +- inf, nan, 0.0
- Dotted keys.
2018-08-05 14:26:46 -07:00
Eric Huss fad5f4690e Don't allow intermixing inline tables and dotted key tables. 2018-07-27 11:49:30 -07:00
Eric Huss 6d76b19b58 0.5: Support dotted keys.
cc #224
2018-07-16 09:10:38 -07:00
Eric Huss c8919e8ed1 0.5: Support hex/oct/bin integers.
cc #224
2018-07-11 09:21:29 -07:00
Alex Crichton 625d2a18bb Merge pull request #251 from ehuss/datetime-space
0.5: Support space separator in datetime.
2018-07-11 09:05:26 -05:00
Alex Crichton 4971310a96 Merge pull request #250 from ehuss/reject-del
0.5: Reject 0x7f (DEL) in strings.
2018-07-11 09:04:29 -05:00