Commit graph

364 commits

Author SHA1 Message Date
James Sanderson dd7e31ea53 Refactor checking for EOF into method 2016-05-19 01:12:58 +01:00
James Sanderson 112adaaa3f Accept empty table on last line 2016-05-19 01:09:33 +01:00
James Sanderson 6450da87ba Failing test for empty table on last line 2016-05-19 00:54:54 +01:00
Alex Crichton b9280519cc Fix accepting comments after table definitions 2016-05-16 10:17:51 -07:00
Alex Crichton c777001598 Accept fractional seconds and timezones in datetime parsing
Closes #96
2016-05-12 14:07:34 -07:00
Alex Crichton 1ed6801137 Add option to enable old behavior
Cargo will use this in the interim.
2016-05-12 11:28:32 -07:00
James Sanderson 848227c605 Require a newline after table definition 2016-04-17 22:51:43 +01:00
Tae-il Lim 6426b02d3d Use different method to ensure unicode escape code is ASCII of expected length 2016-04-05 11:13:36 +09:00
Bourgond Aries 644dc88c04 Add a bunch of negative and positive tests 2016-03-28 06:35:39 +02:00
Bourgond Aries 33c49d0357 Leverage fn array_index to fn integer 2016-03-28 06:24:25 +02:00
Bourgond Aries 568dd2ef4b Fix the indentation to be consistent with the repository 2016-03-27 21:19:03 +02:00
Bourgond Aries 442f663c2d Add advanced lookup for table names 2016-03-27 20:55:49 +02:00
Bourgond Aries 770052a9a7 Add a test for lookup_mut_advanced 2016-03-27 20:50:25 +02:00
Bourgond Aries 0e3e0654ba Implement advanced key lookup for lookup_mut 2016-03-27 20:48:23 +02:00
Bourgond Aries 3517215eab Implement a more advanced algorithm for lookup
The new algorithm allows the explicit usage of "" and '' to denote key
names. This is useful for accessing tables or keys that are named in a
non-conventional manner.
2016-03-27 20:46:19 +02:00
Bourgond Aries b171205c57 Add a test to see if the table's contents have changed 2016-03-25 17:43:32 +01:00
Bourgond Aries 32969ca891 Implement the non-recursive lookup_mut
Also include some tests simply by copying and modifying
the other tests for lookup.
2016-03-25 17:33:46 +01:00
Bourgond Aries 9b1dc843fc Add lookup_mut method for mutable access
Mutable access may sometimes be desired in order to change values
in the toml table. This can be used for dynamic configurations which
will be easy to modify and store.

lookup_mut requires a recursive method due to the borrow checker
not allowing to have more than one mutable reference in the same
scope.
2016-03-24 14:18:00 +01:00
Alex Crichton 511c235d7d Fix last tests 2016-03-11 09:20:32 -08:00
Alex Crichton 3345fea319 Fix an error message test, simlify some serde code 2016-03-11 01:32:16 -08:00
Alex Crichton d02e622330 WIP 2016-03-07 23:48:01 -08:00
Alex Crichton 6b0a1362a1 Support literal strings in table names
Closes #85
2016-01-24 10:50:39 -08:00
Corey Farwell 7be39d725d Address issues found by rust-clippy 2016-01-21 08:38:09 -05:00
Jake Goulding 67107034fc Minor documentation grammar fix 2016-01-01 17:57:01 -05:00
Alex Crichton 39d77b6d79 When decoding maps, leave fields that weren't processed
Fixes an XXX
2015-12-18 16:29:07 -08:00
Cameron Silvestrini caa4615536 Fixed bug: floats always end up in Decoder.toml, even when they have
been successfully decoded.
2015-12-15 22:43:24 +11:00
osboxes.org dea8646b8b Allow BOM (Byte order mark) in toml 2015-10-07 11:35:49 +02:00
Guillaume Gomez db75e532e5 Add Clone derive on ParserError 2015-09-30 00:00:17 +02:00
Kerhong 547e202c15 Implement Value::lookup for empty path to return self 2015-09-25 19:26:47 +03:00
mseri dc0aa5f6c4 Fixed typo 2015-08-29 12:47:21 +01:00
Alex Gulyás 64ae43a386 Fix the arithmetic overflow in Parser::to_linecol
This also changes the calculated line and column numbers. Without this
patch, if an error occurs at the end of a line, the returned line and
column numbers will point at the start of the next line.

After this patch, the line and column numbers will correctly point at
the end of the line where the actual parse error happened.
2015-08-14 14:54:32 +02:00
Alex Crichton 7ec4821bd7 Touch up some style in the decoder 2015-08-13 09:47:40 -07:00
Erick Tryzelaar 85cd6f3e6e Rewrite the MapVisitor to add errors for a specific field 2015-08-13 08:25:56 -07:00
Erick Tryzelaar 8c33064c2c Override the numeric hints to not deserialize ints into floats, and vice versa 2015-08-13 08:25:56 -07:00
Erick Tryzelaar e5efc8801d Add a Deserialize::visit_enum that tries to deserialize into each variant
This could be more efficiently done if serde communicated the
number of arguments in each variant in this function.
2015-08-13 08:25:56 -07:00
Erick Tryzelaar b7b31bf9da Implement Serialize::visit_newtype_{struct,variant}
These functions allow a serializer to not wrap a newtyped value
inside of a tuple or struct.
2015-08-13 07:42:06 -07:00
Erick Tryzelaar bbc167cde9 Get serde feature compiling again 2015-08-12 23:01:49 -07:00
Erick Tryzelaar 4e0172a9a5 Merge remote-tracking branch 'remotes/origin/master' into serde 2015-08-12 22:15:58 -07:00
Alex Crichton b70f6e53b2 Don't need to qualify String 2015-08-11 09:18:52 -07:00
Ben Navetta 8a2282fecd it helps to actually build with serde enabled 2015-08-06 23:33:39 -04:00
Ben Navetta 00337d088e implement serde::Deserialize for Value 2015-08-06 23:30:08 -04:00
Alex Crichton 89332806c5 Improve the error message in failing enums 2015-06-23 17:45:48 -07:00
Alex Crichton 27a70d4024 Name the fields of the custom table AST 2015-06-08 00:04:30 -07:00
Alex Crichton 00baf76107 Add a few more tests for redefining tables 2015-06-07 23:58:45 -07:00
Alex Crichton 88461157f2 Clean up more style 2015-06-07 23:57:50 -07:00
Alex Crichton 68924534e2 Use deref coercions 2015-06-07 23:48:32 -07:00
Alex Crichton 6580b77a20 Re-structure control flow a bit + modernization 2015-06-07 23:47:22 -07:00
Andrzej Janik 8487b63c97 Rework fix for table redefinition to avoid breaking AST-compatiblity 2015-06-06 18:11:48 +02:00
Andrzej Janik 2fcd829b1d Disallow table redefinitions 2015-06-04 20:23:46 +02:00
Alex Crichton 94023b1d89 Fix serde-only compilation 2015-04-21 12:00:05 -07:00
Alex Crichton 3301c39630 Tweak some style 2015-04-21 09:16:06 -07:00
Oliver Schneider 6e2f2c39e4 most tests work now 2015-04-20 15:11:34 +02:00
Oliver Schneider ac86f4c941 updated to master 2015-04-20 12:29:58 +02:00
Alex Crichton 41563ee01b wip 2015-04-02 17:12:37 -07:00
Alex Crichton 2d49247b92 Modularize rustc-serialize support
* Add rustc-serialize as a default feature
* Make room for for serde support
2015-04-02 17:07:37 -07:00
Alex Crichton cd33b87bf9 Bump to 0.1.20 2015-04-01 09:56:05 -07:00
Alex Crichton c8a5ca4ece Bump to 0.1.19 2015-03-25 10:11:05 -07:00
Alex Crichton 2c5aa07722 Implement Encodable for Value
We can't generically decode into one, but we can generically encode one!

Closes #58
2015-03-20 10:53:36 -07:00
Alex Crichton b852af0a60 Improve test coverage 2015-03-15 11:26:32 -07:00
Alex Crichton ff3bb7d255 Reduce usage of unstable features 2015-03-09 11:09:07 -07:00
Alex Crichton e14c2052b7 Don't upload extra docs on travis 2015-03-03 20:35:04 -08:00
Steven Fackler 93e5ace69c Add a doc root url 2015-03-03 20:27:09 -05:00
Alex Crichton 1bebfa1394 Move away from deprecated syntax 2015-02-23 14:45:02 -08:00
Alex Crichton 26da27e628 Add support for numbers with underscores 2015-02-11 11:15:48 -08:00
Alex Crichton 95085dba9a Implement parsing of inline tables 2015-02-07 22:02:32 -08:00
Alex Crichton 0042025904 Bump to 0.1.16 2015-02-03 08:37:05 -08:00
Alex Crichton b3e9653b7f Properly escape keys when printing TOML
Closes #53
2015-02-02 22:54:46 -08:00
Alex Crichton 68e6c34b90 Move show.rs to display.rs 2015-02-02 22:30:06 -08:00
Alex Crichton c6b2aea11e Fix a deprecation warning 2015-02-02 22:29:51 -08:00
Alex Crichton 0a6a1cabde Add some feature gates 2015-01-29 08:42:02 -08:00
Alex Crichton 482752b5f4 Migrate to as many stable functions as possible 2015-01-27 19:29:58 -08:00
Alex Crichton 909a85069b Bump to 0.1.15 2015-01-23 08:19:29 -08:00
Alex Crichton 31d99cd425 Remove slash as an escapeable character 2015-01-20 10:00:43 -08:00
Alex Crichton 885db13d09 Don't infinite loop on bad keys 2015-01-19 13:16:42 -08:00
Alex Crichton 3536cb50e6 Update key syntax to TOML master
* Bare keys contain a very limited set of characters now.
* Keys in quotes behave the same as basic strings.

Closes #47
2015-01-15 19:47:56 -08:00
Alex Crichton 46a70861d5 Add some tests from the spec 2015-01-15 17:37:13 -08:00
Alex Crichton 0285af245a Implement new rules for bare key names
* Key names are restricted to [a-zA-Z0-9_-]
* Equal signs must be on the same line (as must the next value) as the key
* Quoted keys are allowed and are parsed as basic strings.

Closes #48
2015-01-15 17:34:27 -08:00
Alex Crichton bc825a5fb5 Expand float parsing to include exponents
Closes #50
2015-01-15 16:01:27 -08:00
Alex Crichton f098d70145 Disallow leading 0s in integers/floats 2015-01-15 15:37:48 -08:00
Alex Crichton f4b2045de0 Audit string parsing, fixing a few bugs here and there
Closes #51
2015-01-15 15:23:37 -08:00
Alex Crichton 5f2c7b4986 Tighten up CRLF parsing
Fix lots of false positives with stray \r characters and also fix CRFL parsing
in raw string literals with escapes.

Closes #49
2015-01-15 15:10:42 -08:00
Alex Crichton 9dd46d6fbf Fix parsing leading + on numbers 2015-01-15 14:27:55 -08:00
Alex Crichton 0d8ce979a4 Move tests to integration tests 2015-01-15 12:44:05 -08:00
Alex Crichton d4319caa20 Bump to 0.1.11 2015-01-09 11:50:54 -08:00
Valerii Hiora 7a19808670 Updated serialization traits 2015-01-09 17:24:42 +02:00
Valerii Hiora 1dfb94afba Update to master
- features
- macro reform
- String/Show split in formatter
- staging
2015-01-08 19:50:03 +02:00
Alex Crichton 6195861f53 Remove old_orphan_check 2015-01-06 07:34:16 -08:00
Valerii Hiora aeb765b723 Fallout of serialize traits changes 2015-01-06 15:39:06 +02:00
Valerii Hiora 887e5ff844 Update to master
- updated `rustc-serialize` dependency, in other case `toml-rs`
  prohibits `rustc-serialize` update on other crates
- updated after syntax and lib changes
2015-01-03 18:01:19 +02:00
Alex Crichton 2557fc9ab9 Update to rust master 2015-01-01 08:48:47 -08:00
Alex Crichton 31ee496621 Update to rust master 2014-12-23 08:01:45 -08:00
Alex Crichton f16498b8db Update to rust master 2014-12-22 08:17:46 -08:00
Alex Crichton 95c6161dce Update to rust master 2014-12-20 22:35:30 -08:00
Alex Crichton 1346affca9 Remove weird 'invalid toml array of tables' printing
Closes #42
2014-12-20 22:33:40 -08:00
Victor Berger 88b09c57e7 Add all now needed ';' after macro invocations. 2014-12-18 22:48:34 +01:00
Victor Berger 5882522112 Update to last rust. 2014-12-18 10:31:20 +01:00
Alex Crichton 944b94c21a Handle deserializing empty or missing arrays 2014-12-12 13:30:40 -08:00
Alex Crichton 4dce070c70 Update to rust master 2014-12-12 13:19:22 -08:00
Alex Crichton f9408377c9 Fix parsing nested tables in arrays
Closes #36
2014-12-11 22:30:32 -08:00
Alex Crichton 6e4e8251b1 Update to rust master
Closes #34
2014-12-06 14:51:51 -08:00
Alex Crichton b6e487e05b Update to rust master 2014-12-06 14:48:32 -08:00
Alex Crichton 1297910d25 Update to rust master 2014-12-02 23:57:17 -08:00
Markus Kobler c7872d82fc Fixing test json::List -> json::Array 2014-11-22 13:28:41 +00:00
Markus Kobler d0519edd21 Fixing build errors with latest rust 2014-11-22 13:20:55 +00:00
Victor Berger bfcfa89e95 Update to namespaced enum variants. 2014-11-18 09:19:13 +01:00
Valerii Hiora 6ae6fdfb97 FromStr fixes 2014-11-17 10:48:33 +02:00
Alex Crichton 796a127adf Fix a deprecation in the documentation 2014-11-08 09:59:00 -08:00
Alex Crichton ac6f3b27e0 Update to rust master 2014-11-06 22:11:52 -08:00
Steve Klabnik 3dd74d6dbd fix error on master 2014-11-06 08:03:38 -05:00
Alex Crichton 78acb5081d Implement the libstd error trait for errors 2014-11-04 11:56:11 -08:00
Mike Dilger ada3e6474d Update to rust master 2014-11-03 08:39:17 +13:00
Alex Crichton 71d1689d63 Update to rust master 2014-10-31 08:27:24 -07:00
Adolfo Ochagavía 9f668fd541 Fix \r\n on multiline strings and add comments 2014-10-30 21:49:47 +01:00
Steve Klabnik 334b30bb3d fail -> panic 2014-10-29 21:45:18 -04:00
Louis Morgan 46f3872415 Fix deprecation warnings: push_char => push 2014-10-11 18:04:44 +01:00
Cristian Cobzarenco 1f79d9e7d3 Export DecodeErrorKind c-tors publicly. 2014-10-03 14:38:57 +01:00
Alex Crichton 8cdb2747de Allow warnings for now 2014-09-23 06:39:48 -07:00
Björn Steinbrink a56c686cc4 Remove allow(visible_private_types)
It's not needed and no longer supported by rustc anyway.
2014-09-23 11:38:12 +02:00
Alex Crichton 22ad6e7ea9 Update to rust master
Closes #19
2014-09-21 07:55:19 -07:00
Alex Crichton 1ca52c5ea4 Merge pull request #17 from jroesch/into-iter
Update uses of move_iter() to into_iter()
2014-09-18 09:50:04 -04:00
Jared Roesch ef4e8f58ac Update show to print an error instead of failing 2014-09-17 22:01:17 -07:00
Jared Roesch d2208b1d2b Update uses of move_iter() to into_iter() 2014-09-17 21:51:25 -07:00
Valerii Hiora 25703d5f79 Updated to _mut conventions 2014-09-17 10:00:15 +03:00
Brian Koropoff a9297d3cac Fix build break due to generalized type parameter bounds 2014-08-28 21:38:53 -07:00
Julian Orth 3ad7e6055c add crate_name 2014-08-24 11:26:33 +02:00
Brian Koropoff 04827b4d07 Rename parser::Error to parser::ParseError
This avoids a conflict with serialization::Error and
actually re-exports it from the crate root as intended.
It also fixes a build break due to the new import
shadowing gate in rustc.
2014-08-17 16:46:08 -07:00
Alex Crichton 934e093047 Put documentation on github 2014-08-03 21:36:44 -07:00
Andrew Poelstra e5763bc6b2 Add required error method to Decoder
Since rustc pull #16130 there has been a new method in the `Decoder`
trait for signalling application-specific decode errors.
2014-08-01 10:17:21 -07:00
Alex Crichton a3c7f2c38e Don't escape / when printing.
It's not necessary and it's a little ugly to look at
2014-07-18 14:28:06 -07:00
Huon Wilson e756f56b62 Disambiguate "" empty strings from multiline strings properly.
Previously `""` would go into multiline mode and thus *require* a
following ".
2014-07-18 20:20:45 +10:00
Michael Sproul 9b9a43a034 Remove use of deprecated vector get method. 2014-07-17 20:54:34 +10:00
Alex Crichton 3a7ec7f4c4 Update an error message with \U support 2014-07-15 19:13:42 -07:00
Alex Crichton c4d9e5c0b4 Fix doc tests 2014-07-15 19:05:22 -07:00
Alex Crichton 98a5e0e244 Implement multiline string literals
While I'm at it, implement literal strings as well.

Closes #5
2014-07-15 19:00:50 -07:00
Alex Crichton 5b6053fdac Support \U escapes in strings 2014-07-15 18:43:00 -07:00
Alex Crichton b4a4ed72d7 Migrate to a TreeMap for determinism 2014-07-15 17:30:00 -07:00
Michael Gehring 46ab9eb436 ToStr::to_str -> ToString::to_string 2014-07-09 15:46:49 +02:00
Alex Crichton 6e0701caa5 Add a test for _ => - translation 2014-07-02 18:43:32 -07:00
Yehuda Katz + Carl Lerche 806a7bd937 Decodes foo-bar into a field named foo_bar
This logic is specific to the Decoder, and because Rust does not support
hyphenated names as identifiers, it's the only reasonable thing to do
with hyphenated names in Toml.
2014-07-02 17:23:35 -07:00
Alex Crichton e32363c788 Fix tests on master 2014-07-01 06:30:17 -07:00
Alex Crichton 713816102b Remove stray println!() 2014-06-28 15:16:15 -07:00
Alex Crichton b4f706cceb Be more resilient about unused values in array 2014-06-28 15:15:25 -07:00
Alex Crichton 85af174778 Always remove Array values from the Decoder 2014-06-28 15:00:45 -07:00
Alex Crichton 0f20aad823 Prune more unused fields 2014-06-28 14:49:04 -07:00
Alex Crichton 6b4f33444a Don't leave empty tables lying around 2014-06-28 14:42:30 -07:00
Alex Crichton 9c1806283c Merge pull request #1 from vhbit/lookups
Path lookups
2014-06-27 13:53:15 -04:00
Valerii Hiora 13cc8a9201 Fixed tests, merged lookup functions 2014-06-27 17:28:55 +03:00
Alex Crichton 0f9410a7f0 Document a new public field 2014-06-26 22:55:20 -07:00
Alex Crichton c28df7cb52 Leave unused keys in TOML while decoding 2014-06-26 22:52:31 -07:00
Alex Crichton caf4071137 Add a CRLF test 2014-06-26 19:27:42 -07:00
Valerii Hiora 2047fa3bc9 Added separate tests, moved comments 2014-06-25 17:00:10 +03:00
Daniel Trebbien 8524f2b2c2 Fix "error: cannot determine the type of this integer" 2014-06-25 08:42:46 -04:00
Valerii Hiora dd828e613b Path lookups 2014-06-25 12:22:11 +03:00
Alex Crichton b663d6ae99 Handle \r\n 2014-06-23 22:28:53 -07:00
Alex Crichton 6e30770355 Fix a test 2014-06-23 11:17:39 -07:00
Alex Crichton ed88ef0b81 Expose kinds of errors 2014-06-23 10:58:06 -07:00
Alex Crichton 21e91fe753 Add Encodable/Decodable support for enums 2014-06-23 09:37:13 -07:00
Alex Crichton cd4fede072 Add a method for converting to (line, column) 2014-06-23 08:58:44 -07:00
Alex Crichton 3ff116ea84 Add a test for a missing field 2014-06-23 08:50:00 -07:00
Alex Crichton 266cd75e92 Improve decoder errors 2014-06-23 08:38:45 -07:00
Alex Crichton 16d5e67fa5 Clean up warnings and documentation 2014-06-22 22:31:09 -07:00
Alex Crichton f06fae1602 Implement Encoder/Decoder for libserialize traits 2014-06-22 22:23:27 -07:00
Alex Crichton 3bbf216491 Add documentation and examples 2014-06-20 17:30:08 -07:00
Alex Crichton 11115f13a3 Initial commit 2014-06-20 17:01:38 -07:00