Commit Graph

326 Commits

Author SHA1 Message Date
ToruNiina
edb48b2872 add test_error_detection to check it detects error 2018-12-22 17:43:42 +09:00
ToruNiina
c63ac7e435 detect syntax_error; appending array-of-tables
toml file like the following is explicitly prohibited.
a = [{b = 1}]
[[a]]
b = 2
this commit detects this kind of syntax-error while parsing toml file
2018-12-22 17:07:06 +09:00
ToruNiina
fec49aaaa3 fix error message: add missing spaces 2018-12-22 17:06:36 +09:00
ToruNiina
24723226f1 remove template argument from result::unwrap_or 2018-12-17 19:18:16 +09:00
ToruNiina
7b3684b54e add and_other and or_other to toml::result
effectively same as Rust's std::Result::and and or.
2018-12-17 18:24:41 +09:00
ToruNiina
13c1f9c259 output filename of the second value2 if different
in format_error.
2018-12-17 18:07:57 +09:00
ToruNiina
6df75ad28e fix README 2018-12-17 16:56:09 +09:00
ToruNiina
74fc70cfee return copied object from except
having reference makes some technical difficulties.
2018-12-17 10:57:40 +09:00
Toru Niina
91ac2debce
Merge pull request #12 from ToruNiina/hotfix
enable to get toml::value as toml::value
2018-12-17 10:50:05 +09:00
Toru Niina
0de89a9f19
Merge pull request #13 from ToruNiina/error-format
enable to show user-defined error message with (a) toml::value(s)
2018-12-17 10:49:47 +09:00
ToruNiina
130609bf5f update README 2018-12-16 23:51:38 +09:00
ToruNiina
ab41e7acb9 enable to pass 2 value and change interface for clarity 2018-12-16 21:50:18 +09:00
ToruNiina
c15bc8df4a add format_error(toml::value, msg, comment) 2018-12-16 21:46:32 +09:00
ToruNiina
19524dbc4b fix silly typo 2018-12-16 21:13:21 +09:00
ToruNiina
c2e733a65d enable to get toml::value as toml::value 2018-12-16 20:50:40 +09:00
ToruNiina
0c08b9e940 fix typo 2018-12-15 22:02:46 +09:00
ToruNiina
06197605ba add link to toml-v0.5.0 official 2018-12-13 23:58:37 +09:00
ToruNiina
5c24cfd325 add example of multi-line error message 2018-12-13 23:47:32 +09:00
Toru Niina
abb6ae517d
Merge pull request #11 from ToruNiina/toml-v050
WIP: major update: support TOML v0.5.0
2018-12-13 21:38:03 +09:00
ToruNiina
fd21d5dd95 add simplest copyright notice 2018-12-13 20:44:10 +09:00
ToruNiina
57de57a1de improve error message for empty value 2018-12-13 20:37:40 +09:00
ToruNiina
e86777d19c improve error message for conflicting tables 2018-12-13 20:17:57 +09:00
ToruNiina
e79069cc47 enable to show err msg for invalid insertion
like, with the following (invalid) toml file

> a.b = "value"
> a.b.c = 42

The error message becomes

> terminate called after throwing an instance of 'toml::syntax_error'
>   what():  [error] toml::insert_value: target (a.b) is neither table nor
> an array of tables
>  --> example.toml
>  1 | a.b = "value"
>    |       ~~~~~~~ actual type is string
>  ...
>  2 | a.b.c = 42
>    |         ~~ inserting this
2018-12-13 17:09:38 +09:00
ToruNiina
f60e93c36f enable to assign value keeping region info 2018-12-13 17:07:26 +09:00
ToruNiina
e5c29c2870 enable to show err msg for 2 different location 2018-12-13 17:07:03 +09:00
ToruNiina
acc7b7870f remove format_error_for_value and add get_region instead
it is convenient to have get_region function that can access region_info
in toml::value. get_region is placed in toml::detail and made friend of
toml::value because I don't want to make toml::value::region_info public
and keep it internal use only.
2018-12-13 16:13:05 +09:00
ToruNiina
06f04af375 fix typoes in README 2018-12-13 14:58:42 +09:00
ToruNiina
5125287ac7 fix datetime conversion
use internal duration type in std::chrono::system_clock::time_point
2018-12-13 14:57:42 +09:00
ToruNiina
56287803e7 update README a bit 2018-12-13 13:21:26 +09:00
ToruNiina
95d73a290f add test case for reading dotted-keys 2018-12-13 13:07:48 +09:00
ToruNiina
26e0d87d3b enable nanoseconds in datetimes 2018-12-13 12:49:53 +09:00
ToruNiina
fb6d51954a turn test_parse_unicode on; no change required 2018-12-13 02:28:52 +09:00
ToruNiina
4d7cfc9d1d turn test_parse_file on
the required change is;
- change Datetime -> offset_datetime and construct correctly.
2018-12-13 02:26:55 +09:00
ToruNiina
514f3c773f set test_from_toml 2018-12-13 02:24:03 +09:00
ToruNiina
77b237c53a update README 2018-12-13 02:00:42 +09:00
ToruNiina
27a80b1214 rename get(table, key) to find() 2018-12-13 02:00:13 +09:00
ToruNiina
f62bcb3077 update cmakelists 2018-12-13 01:30:25 +09:00
ToruNiina
be1a310ae5 move test for find to get_related 2018-12-13 01:30:06 +09:00
ToruNiina
affa159c82 add get_or(value, key, opt) 2018-12-13 01:29:23 +09:00
ToruNiina
901c299c40 add unwrap_or to result 2018-12-13 01:28:55 +09:00
ToruNiina
2080b30110 add test cases for test_to_toml 2018-12-13 00:38:36 +09:00
ToruNiina
c15cb15c4c simplify to_toml implementation 2018-12-13 00:38:04 +09:00
ToruNiina
d370ae7d0d set tm_isdst as negative value 2018-12-13 00:35:43 +09:00
ToruNiina
83b588a8c8 rename test code 2018-12-13 00:35:05 +09:00
ToruNiina
5bfbbe35a6 update README 2018-12-12 23:23:59 +09:00
ToruNiina
c69969733f use carriage return depending on env 2018-12-12 23:22:31 +09:00
ToruNiina
47cd6f5a41 remove redundant error message 2018-12-12 23:17:28 +09:00
ToruNiina
a19c9b4a39 add test case for find & get 2018-12-12 21:55:11 +09:00
ToruNiina
f64430af92 remove old test; individual test cases are added
test_parse_* is now available, old test_parser is not needed now
2018-12-12 20:55:58 +09:00
ToruNiina
8e154cdd74 add test case for parsing datetime 2018-12-12 20:55:30 +09:00