Thomas Pelletier
bbaae540ce
Decoder: check timezones start with +,-,z,Z ( #688 )
...
Also simplifies local time seconds scanning.
Fixes #686
2021-11-30 13:01:15 -05:00
Thomas Pelletier
ede6445608
Decoder: flag bad \r in literal multiline strings ( #687 )
...
Fixes #685
2021-11-30 10:44:48 -05:00
Thomas Pelletier
b226db6a29
Decoder: show struct field in type mismatch errors ( #684 )
...
The goal is to provide some context as to why the type were mismatched. This
change only works for that case, on structs. This is the same a encoding/json. A
more general solution would be great, but this would require a broader change in
the decoder, which I don't think is necessary at the moment.
Fixes #628
2021-11-24 20:43:56 -05:00
Thomas Pelletier
d8997efb5a
Mention "-" to prevent encoding field in doc ( #683 )
2021-11-24 19:52:23 -05:00
Thomas Pelletier
79e78b234c
Decoder: fix panic on table array behind a pointer ( #682 )
...
Fixes #677
2021-11-24 18:50:04 -05:00
Thomas Pelletier
1b5a25c0ef
Decoder: fail on unescaped \r not followed by \n ( #681 )
...
Fixes #674
2021-11-24 18:11:36 -05:00
Thomas Pelletier
8eae15b2ee
Decoder: validate bounds of day and month in dates ( #680 )
...
Fixes #676
2021-11-24 17:42:01 -05:00
Thomas Pelletier
2b3de620e8
Encoder: try to use pointer type TextMarshaler ( #679 )
...
If a type does not implement the encoding.TextMarshaler interface but
its pointer type does, use it if possible.
Fixes #678
2021-11-24 14:43:49 -05:00
Cameron Moore
8645d6376b
Decoder: flag invalid carriage returns in literal strings ( #673 )
2021-11-23 22:41:59 -05:00
Thomas Pelletier
64fe47161f
API: Encoder and Decoder options are chainable ( #670 )
...
Fixes #583
2021-11-13 19:04:53 -05:00
Thomas Pelletier
4dff8eaa4d
Decoder: prevent duplicates of inline tables ( #667 )
...
* seen: prevent duplicates of inline tables
* Provide clearer error message for redefined keys
For example:
``
toml: key b is already defined
```
2021-11-10 10:04:43 -05:00
Cameron Moore
2dbd29a565
parser: Fix missing check for upper exponent ( #665 )
2021-11-09 21:15:23 -05:00
Thomas Pelletier
f27a07d31a
seen: verify arrays ( #663 )
...
Fixes #662
2021-11-09 20:26:30 -05:00
Thomas Pelletier
644515958c
Update TOML test suite ( #661 )
...
Ref #658
2021-11-08 22:35:35 -05:00
Thomas Pelletier
8683be35f6
seen: check inline tables ( #660 )
...
Fixes #658
2021-11-08 21:53:02 -05:00
Thomas Pelletier
dc1740d473
Decode: code cleanup for struct cache ( #659 )
2021-11-07 18:35:30 -05:00
Thomas Pelletier
11f789ef11
Decode: prevent comments that look like dates to be accepted ( #657 )
...
* parser: fix date detection
When the parser has to decide between parsing and integer or a date, it should
check that all characters are actually acceptable (digits, or date/time
elements).
Fixes #655
2021-11-04 22:06:12 -04:00
Thomas Pelletier
74d21b367f
scanner: handle carriage return in comments ( #656 )
...
Fixes #653
2021-11-04 21:40:16 -04:00
Thomas Pelletier
6617e7e73d
utf8: use lookup table to validate ASCII ( #654 )
2021-11-04 16:05:36 -04:00
Thomas Pelletier
3dbca20bc9
Decoder: flag invalid carriage returns in strings ( #652 )
...
Fixes #651
2021-11-02 10:02:25 -04:00
Thomas Pelletier
85c0658984
Decode: add missing checks for LocalTime ( #650 )
2021-10-29 22:13:08 -04:00
Thomas Pelletier
772d169b52
testsuite: return error when can't encode tag ( #648 )
2021-10-29 21:51:50 -04:00
Cameron Moore
b4ec220f7e
Update tomltestgen and regenerate tests ( #645 )
...
Remove testsuite build tag from generated tests file
Co-authored-by: Thomas Pelletier <thomas@pelletier.codes >
2021-10-28 20:46:08 -04:00
Thomas Pelletier
3694ae88f6
decode: error on _ before exponent in floats ( #647 )
...
Fixes #646
2021-10-28 20:41:10 -04:00
Thomas Pelletier
19751e8a51
Missing performance section
v2.0.0-beta.4
2021-10-28 19:10:43 -04:00
Thomas Pelletier
925f214125
Add GitHub release configuration ( #644 )
2021-10-28 19:06:14 -04:00
Thomas Pelletier
39f893ad99
Multiline strings fixes ( #643 )
...
* scanner: allow multiline strings to end with "" or ''
* parser: trim all whitespaces after \ in multiline
2021-10-28 18:26:34 -04:00
Thomas Pelletier
c871a61015
unmarshal: use UnmarshalText for any type ( #642 )
...
Not only structs can implement TextUnmarshaler.
Fixes #564
2021-10-28 17:02:47 -04:00
Thomas Pelletier
d0d001625c
unmarshal: don't panic when storing table in slice ( #641 )
...
New error message:
```
toml: cannot store a table in a slice
1| [things]
| ~~~~~~ cannot store a table in a slice
2| foo = "bar"
```
Fixes #623
2021-10-25 16:47:10 -04:00
Thomas Pelletier
64941b99e2
unmarshal: empty document results in map ( #640 )
...
Fixes #602
2021-10-25 15:55:54 -04:00
Thomas Pelletier
ed02a1f192
seen: check for explicit tables on dotted keys ( #639 )
...
The TOML spec is being clarified to say that dotted keys "define" their
intermediate tables. Therefore the seen tracker needs to verify that none of
them reference an explicit table.
Also added a missing seen expression check for key-values parsed as part of a
table section.
See https://github.com/toml-lang/toml/issues/846
2021-10-22 23:25:28 -04:00
Thomas Pelletier
4d7c9ddac7
Floats and integers parsing fixes ( #638 )
...
* parser: fix scan of float with exp but no decimal
* decoder: validate leading zeros for decimals
2021-10-22 22:25:56 -04:00
Thomas Pelletier
feb1830dcc
tomltest: enable TestTOMLTest_Valid_Comment_Tricky
2021-10-21 22:30:58 -04:00
Thomas Pelletier
1c33d6ce20
tomltest: custom comparison functions ( #637 )
2021-10-21 22:29:04 -04:00
Thomas Pelletier
3000471a12
parser: improve floats validation ( #636 )
2021-10-20 08:49:28 -04:00
Thomas Pelletier
1f33a6a476
tomltest: enable Valid_Datetime_LocalTime
2021-10-19 21:20:45 -04:00
Thomas Pelletier
2700aad5d2
tomltest: run UTF8 tests ( #634 )
2021-10-19 16:00:56 -04:00
Thomas Pelletier
7ccaa2744e
tomltest: unmarshal JSONs for tests ( #633 )
...
Comparing the output and the expected results byte-wise means we get false
negative when order doesn't matter (for example the ValidTableKeyword test).
2021-10-19 15:29:49 -04:00
Johanan Idicula
df4bb061f8
time: follow RFC3339 spec for datetime ( #632 )
2021-10-18 09:56:07 -04:00
Thomas Pelletier
9e81ce1c33
Create SECURITY.md
2021-10-17 20:57:34 -04:00
Cameron Moore
a23850f29b
decode: preserve nanosecond precision when decoding time ( #626 )
...
Co-authored-by: Thomas Pelletier <thomas@pelletier.codes >
2021-10-17 20:43:29 -04:00
Johanan Idicula
76f53c857b
unmarshal: validate date ( #622 )
2021-10-17 20:18:20 -04:00
Thomas Pelletier
85f5d567e4
parser: validate invalid ASCII control characters
2021-10-16 07:41:12 -04:00
Thomas Pelletier
bd5cba0b0b
Update benchmarks readme ( #630 )
...
* Fix ci.sh for new benchmarks
Nice + taskset are more stable on my machine. We want to excude non high-level
benchmarks. BurntSushi/toml now supports canada.toml.
* Update latest benchmarks in README
2021-10-15 19:53:40 -04:00
Thomas Pelletier
cd54472d03
Validate UTF-8 ( #629 )
2021-10-15 19:13:21 -04:00
Thomas Pelletier
cc0d1a90ff
testgen: skip currently failing tests ( #627 )
2021-10-14 11:14:44 -04:00
Sterling Hanenkamp
4984dcb5e9
encode: ensure floats have decimal point ( #615 )
...
Fixes #571
Co-authored-by: Sterling Hanenkamp <sterling@ziprecruiter.com >
2021-10-14 08:34:54 -04:00
jidicula
86632bc190
parser: fail when missing array separator ( #616 )
...
Co-authored-by: Thomas Pelletier <thomas@pelletier.codes >
2021-10-14 08:26:29 -04:00
Cameron Moore
d25eec183f
gotoml-test-decoder: add toml-test decoder command ( #619 )
2021-10-14 08:14:34 -04:00
Riya John
e96746311c
decoder: fix panic date time should have a timezone ( #614 )
...
Fixes #596
Co-authored-by: Thomas Pelletier <thomas@pelletier.codes >
2021-10-06 21:24:25 -04:00