ToruNiina
11c7ee4501
fix the case of file w/o newline at the end
...
toml::parse failed with the file that contains whitespace or comment at
the end of file without newline. this commit fixes the error.
2018-12-24 16:00:33 +09:00
ToruNiina
d24a188d4c
fix the error while reading BOM.
...
remove possible UB because of the use-after-move.
2018-12-24 15:06:26 +09:00
ToruNiina
e3217cd572
quit returning rvalue ref from unwrap_or
2018-12-17 23:17:45 +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
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
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
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
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
5125287ac7
fix datetime conversion
...
use internal duration type in std::chrono::system_clock::time_point
2018-12-13 14:57:42 +09:00
ToruNiina
26e0d87d3b
enable nanoseconds in datetimes
2018-12-13 12:49:53 +09:00
ToruNiina
514f3c773f
set test_from_toml
2018-12-13 02:24:03 +09:00
ToruNiina
27a80b1214
rename get(table, key) to find()
2018-12-13 02:00:13 +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
c15cb15c4c
simplify to_toml implementation
2018-12-13 00:38:04 +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
65cfa9d06b
remove unused file because its not stable
...
since toml::format is not stable now, remove once for the next release.
2018-12-12 20:35:21 +09:00
ToruNiina
03be08a2e6
fix conversion from offset_datetime to system_clock::time_point
2018-12-12 20:28:11 +09:00
ToruNiina
5aae0b17c8
change error message; require unicode codepoint
...
before this, it recommends the range that can be represented by utf-8
but the range of valid unicode codepoint is narrower than that. for
error message, it is good to recommend valid unicode codepoint.
2018-12-12 19:14:27 +09:00
ToruNiina
0f83ee6039
change temporaly loc from token to copy of loc
...
location constructed from token string does not has correct line number
information. to show an informative error message about UTF-8 and escape
sequences, parse_(ml_)basic_string requires those information that can
only be given from root location<Container>.
2018-12-12 19:12:23 +09:00
ToruNiina
879b7d3bff
improve format of error message for utf-8
2018-12-12 19:01:22 +09:00
ToruNiina
c33ad31981
split lexer for escape sequence for unicode
2018-12-12 18:59:20 +09:00
ToruNiina
5d29509d98
remove duplicated default argument for SFINAE
2018-12-12 18:58:54 +09:00
ToruNiina
717e03cd4a
add find-get overload functions
2018-12-12 17:55:34 +09:00
ToruNiina
dc060ba840
add explicit std::move to toml::get(&&)
2018-12-12 17:22:41 +09:00
ToruNiina
0c9b785969
add missing include file
2018-12-12 16:11:37 +09:00
ToruNiina
bcaf5baf88
fix parse_array_of_table_key
...
allow whitespace before and after [[ and ]] (like, [[ a.b ]])
2018-12-12 12:14:11 +09:00
ToruNiina
a1a81089c5
skip whitespace before/inside/after dotted-keys
2018-12-12 01:30:47 +09:00
ToruNiina
765ab97d8b
add whitespace between [] and key
...
[ a.b.c ] is allowed. also, [[ a . b ]] is allowed.
dotted key matches `a.b.c` only, so the explicit whitespace is needed.
2018-12-12 01:27:10 +09:00
ToruNiina
fc6a15440d
enable format_underline to print hint with region
2018-12-11 22:22:07 +09:00
ToruNiina
d7bba10fa3
improve error message in parse_key_value_pair
2018-12-11 22:21:22 +09:00
ToruNiina
247bcb0714
show error message for inhomogenous array
2018-12-11 22:17:28 +09:00
ToruNiina
27b9334f10
skip BOM if exists
2018-12-11 21:40:48 +09:00
ToruNiina
38135940e9
add expect<T>(toml::value)
2018-12-11 11:36:40 +09:00
ToruNiina
d75a977066
improve error message for bad unwrap a bit
2018-12-11 11:35:07 +09:00
ToruNiina
75c136924b
add datetimes to chrono
2018-12-10 22:06:06 +09:00
ToruNiina
0759e757ae
move is_chrono_duration from types to traits
2018-12-10 22:05:42 +09:00
ToruNiina
4e57c5f5df
improve error message for invalid line
...
like a = 12 = true, newline is expected after 12
2018-12-10 21:43:02 +09:00