Commit graph

309 commits

Author SHA1 Message Date
Erich Gubler a6071c7aac Make importing toml_internal macro unnecessary when using the toml macro 2019-04-02 09:32:51 -06:00
Tomasz Miąsko a5046008e5 Fix parsing of repeated delimiters inside multi-line strings
The previous implementation of `read_string`, when looking for
delimiters ending the multi-line string and failing to find exactly
three in succession, always put a single delimiter back. This is
incorrect when exactly two delimiters are present.

Put back the correct number of delimiters depending on how many have
been already consumed from input.

The issue could be triggered only with `Owned` representation of
`MaybeString`, since otherwise `push` operation is no-op.
2019-03-20 17:58:14 +01:00
Abid Omar 861a7be7d4 Add PartialEq to Toml::de
Add PartialEq trait to Error, ErrorInner and ErrorKind.

Relevant issue: https://github.com/alexcrichton/toml-rs/issues/291
2019-03-11 18:38:50 +01: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
Vincent Prouillet 8621ab27ae Add the preserve_order feature 2018-12-28 14:42:55 +01:00
Alex Crichton cbfc4e18f8 Run cargo fmt 2018-12-17 17:45:35 -08:00
Alex Crichton 7845df9ff9 Merge pull request #264 from azriel91/feature/225/externally-tagged-enums
Issue 255: Externally tagged enum deserialization
2018-11-28 09:50:38 -06:00
Alex Crichton 88be3b70a7 Merge pull request #276 from ehuss/fix-version
Indicate this is now supporting version 0.5 of TOML.
2018-11-21 11:55:29 -06:00
Eric Huss 57e78ee3bc Indicate this is now supporting version 0.5 of TOML. 2018-11-21 09:41:57 -08: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
Azriel Hoh cd6373a9ab Maintain backward compatibility with Rust 1.15, take 3. 2018-11-17 14:19:14 +13:00
Azriel Hoh 752bf0d4a1 Only validate table keys against fields when deserializing enum.
Issue #225
2018-11-17 13:37:24 +13:00
Azriel Hoh 5bcf6f7cb6 Maintain compatibility with Rust 1.15
Issue #225
2018-11-17 13:36:38 +13:00
Azriel Hoh 1656e2e51d Error when deserializing struct if encountering unknown fields.
Issue #225
2018-11-12 10:09:30 +13:00
Azriel Hoh a0295b3308 Maintain compatibility with Rust 1.15
Issue #225
2018-11-10 11:10:34 +13:00
Azriel Hoh a4928a47a8 Implemented deserialization for external enums.
Issue #225
2018-11-10 11:10:31 +13:00
Azriel Hoh 7777c1452f Better error handling when parsing tuples.
Issue #225
2018-11-10 11:07:26 +13:00
Azriel Hoh 4f28c2f639 Implemented enum tuple deserialization.
Issue #225
2018-11-10 11:07:23 +13:00
Azriel Hoh f5d14af5a6 Implement deserialization for unit and struct variants.
Issue #225
2018-11-10 11:06:34 +13:00
Alex Crichton 80d2cf081d Merge pull request #271 from spease/allow-newtype-key
Allow newtype key
2018-10-29 09:57:55 -07: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
Steven Pease d75c9ccd00 Allow newtype key 2018-10-27 18:28:18 -07: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 985e21003f Support deserializing from other integer types 2018-08-05 23:25:06 +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 e0a820be2f Support older rustc. 2018-07-16 09:10:38 -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
Eric Huss 16d8b14fcf 0.5: Support floats nan, inf, and +/-0.0.
cc #224
2018-07-11 00:50:04 -07:00
Eric Huss 86d9dd21d8 0.5: Reject 0x7f (DEL) in strings.
cc #224
2018-07-10 18:13:06 -07:00
Eric Huss 5204d8b50a 0.5: Support space separate in datetime.
cc #224
2018-07-10 17:14:16 -07:00
Alex Crichton 2a15817c47 Support fixed-length arrays
Turns out these are deserialized/serialized as tuples! While we're at it add
support for tuple variants and tuple structs through the same paths.

Closes #244
2018-05-24 07:25:42 -07:00
Alex Crichton 98d997c1fd Merge pull request #239 from udoprog/spans
Support spans when deserializing serde structures
2018-05-09 16:48:58 -05:00
Claudio Bley 96ca73e130 Treat unicode hex digits case-insensitively
In Rust >= 1.24.0 we could have used `char::is_ascii_hexdigit`, but to keep
compatiblity with older versions, `char::is_digit(16)` is used.

Fixes #240.
2018-05-09 22:18:14 +02:00
John-John Tedro 0616d3562c Make spanned module private and hide internals 2018-05-09 21:54:22 +02:00
John-John Tedro 407845d620 Fix incorrectly reported spans for Datetime 2018-05-07 05:36:41 +02:00
John-John Tedro 8a9ae07de5 Use BorrowedStrDeserializer instead of generated key deserializers 2018-05-07 04:57:16 +02:00
John-John Tedro 09c8957ae7 Adjust spans for more complex types 2018-05-07 04:28:00 +02:00
John-John Tedro 6b919f8833 Use custom struct/field naming to deserialize spans 2018-05-07 04:28:00 +02:00
David Tolnay 6db43965f9 Proof of concept: reporting span information to a Spanned<T> type 2018-05-06 11:06:00 +02:00
John-John Tedro 6d7c89169b Make Tokenizer emit spans 2018-05-01 13:53:52 +02:00