Commit graph

21 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
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
Kyle Clemens b517e36d8f feat: support tabs in basic strings (#343)
Close #310.
2019-10-15 08:45:17 -05:00
Nick Hackman 8b88c96cfc Removed all warnings besides two
Majority of warnings removed via RustFix
Two remain one being a long return type and another being a name
suggestion from Clippy `to_owned` for MaybeString
2019-08-14 23:05:30 -04:00
Eric Huss 0737f0b27a 2018 edition idioms. 2019-05-08 17:37:38 -07: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
Alex Crichton cbfc4e18f8 Run cargo fmt 2018-12-17 17:45:35 -08:00
Joey Hain a9fb3bf188 Allow whitespace after line ending backslash (#162) 2018-10-27 12:49:17 -07: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
Eric Huss 86d9dd21d8 0.5: Reject 0x7f (DEL) in strings.
cc #224
2018-07-10 18:13:06 -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 09c8957ae7 Adjust spans for more complex types 2018-05-07 04:28:00 +02:00
John-John Tedro 6d7c89169b Make Tokenizer emit spans 2018-05-01 13:53:52 +02:00
Kornel 6cf0d5de33 Replace try!() with ? 2018-04-16 02:12:39 +01:00
Daniel Lockyer 469e9f6bd2 Remove lifetimes 2017-04-12 09:29:00 +01:00
Daniel Lockyer 3034a7cf52 Simplify if-statements 2017-04-12 09:28:56 +01:00
Daniel Lockyer de940a3373 Remove unneeded return statements 2017-04-12 09:24:16 +01:00
Alex Crichton b6178aed2a Relax assertions in substr_offset slightly
Closes #152
2017-02-21 20:27:43 -08:00
Alex Crichton e256931e9b Rewrite crate with serde support from ground up
This commit completely rewrites this crate from the ground up,
supporting serde at the lowest levels as I believe serde support was
intended to do. This is a major change from the previous versions of
this crate, with a summary of changes being:

* Serialization directly to TOML is now supported without going through
  a `Value` first.

* Deserialization directly from TOML is now supported without going
  through a `Value`. Note that due to the TOML format some values still
  are buffered in intermediate memory, but overall this should be at a
  minimum now.

* The API of `Value` was overhauled to match the API of
  `serde_json::Value`. The changes here were to:

  * Add `is_*` accessors
  * Add `get` and `get_mut` for one-field lookups.
  * Implement panicking lookups through `Index`

  The old `index` methods are now gone in favor of `get` and `Index`
  implementations.

* A `Datetime` type has been added to represent a TOML datetime in a
  first-class fashion. Currently this type provides no accessors other
  than a `Display` implementation, but the idea is that this will grow
  support over time for decomposing the date.

* Support for the `rustc-serialize` crate has been dropped, that'll stay
  on the 0.2 and 0.1 release trains.

* This crate no longer supports the detection of unused fields, for that though
  you can use the `serde_ignored` crate on crates.io
2017-02-08 21:21:18 -08:00