Commit Graph

614 Commits

Author SHA1 Message Date
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
ToruNiina
ff83a6a477 remove redundant part of error messages 2018-12-10 21:42:56 +09:00
ToruNiina
3f991c4759 improve power of get 2018-12-10 15:58:20 +09:00
ToruNiina
bf2158ae98 add map from exact toml type -> toml::value_t 2018-12-10 15:57:44 +09:00
ToruNiina
ff19c9f492 add corresponding region to each value 2018-12-10 15:57:17 +09:00
ToruNiina
28ba2713ee fix initialization of region in value 2018-12-10 15:25:27 +09:00
ToruNiina
129ea81f66 remove redundant words in error message 2018-12-10 15:23:46 +09:00
ToruNiina
8dfe187d59 add a function to show a better error message 2018-12-10 15:06:28 +09:00
ToruNiina
8078c719fe remove old code 2018-12-10 00:15:41 +09:00
ToruNiina
8e18aa9b16 add toml::parse 2018-12-10 00:14:46 +09:00
ToruNiina
ed155a5040 remove help msgs in parse_value
because the error message becomes too long
2018-12-09 21:54:47 +09:00
ToruNiina
cf03a08632 re-write parser using result and new value
wip.
2018-12-09 19:32:30 +09:00
ToruNiina
34c3d33936 use vector instead of initializer_list 2018-12-09 19:30:46 +09:00
ToruNiina
c04b75b2e3 consider LF in the range when writing error msg 2018-12-09 18:08:04 +09:00
ToruNiina
e24039f4ef update toml::value and improve test_value
- enable to store new types
- store source string if possible
- refactoring
2018-12-09 18:03:20 +09:00
ToruNiina
dc8ccdc458 construct much more tmp variables
std::chrono::seconds -= std::chrono::milliseconds cannot be done bc
it represents the duration as integer value and milliseconds are less
than seconds. it causes compilation error when we pass a duration to
toml::local_time. to avoid this, we need to type-cast the values to
smaller duration, like sec -> msec
2018-12-09 18:00:46 +09:00
ToruNiina
2696e4e6ba split storage from value
also, quit inheritance in storage class
2018-12-09 16:41:45 +09:00
ToruNiina
d1d5ca6bf8 add toml::string to have basic/literal flag 2018-12-09 16:40:57 +09:00
ToruNiina
80eafd1424 add datetime variants and rearrange type-related functions 2018-12-09 16:34:47 +09:00
ToruNiina
9fadf71a10 add constructor from duration to local_time 2018-12-09 16:27:47 +09:00
ToruNiina
ac3025d92f change default return value of region_base 2018-12-09 13:39:13 +09:00
ToruNiina
b0e7efa1e0 make some constructors explicit 2018-12-09 13:38:57 +09:00
ToruNiina
84676eab0b improve quality of error message 2018-12-09 13:05:09 +09:00
ToruNiina
2b3a4d49a5 add region_base to contain it in toml::value
to make toml::get and toml::value::cast return better error messages
2018-12-09 12:41:38 +09:00
ToruNiina
f834e0d142 cosmetic: sort value_t in types.h 2018-12-09 11:06:19 +09:00
ToruNiina
a1aa780a60 Merge branch 'toml-v050' of github.com 2018-12-09 11:05:26 +09:00
ToruNiina
48f3b73b91 add ctor(local_datetime, time_offset) to offset_datetime 2018-12-09 00:11:07 +09:00
ToruNiina
04854f9d21 stop having begin/end iterator in region/location 2018-12-09 00:00:15 +09:00
ToruNiina
8388664fc6 add map_err_or_else to result 2018-12-08 22:44:15 +09:00
ToruNiina
bb215836dc add missing header files 2018-12-08 20:39:37 +09:00
ToruNiina
2b2a05148e add from_string to utility 2018-12-08 20:21:15 +09:00
ToruNiina
66807d19d1 add specializations 2018-12-08 19:40:58 +09:00
ToruNiina
25789d1450 set Datetime as offset_datetime
prepare for TOML v0.5.0
2018-12-08 19:23:09 +09:00
ToruNiina
366f72bbdd Merge branch 'datetime' into combinator 2018-12-08 19:06:19 +09:00
ToruNiina
3ef33c1637 change almost everything about datetime 2018-12-08 19:04:41 +09:00
ToruNiina
e05d0bdb84 stop using distance(next(iter), last)
under some condition, it causes serious error.
2018-12-06 20:13:06 +09:00
ToruNiina
5dbbc1fb1a add escaped newline to lexer for multiline string
to use it in parse_ml_basic_string
2018-12-06 19:53:49 +09:00
ToruNiina
b3b5682cc0 add message to bad_unwrap 2018-12-06 17:15:19 +09:00
ToruNiina
df314da751 change error message considering context
combinators are used with other parser-combinators. in such cases, empty
input means `not enough character`.
2018-12-06 17:03:57 +09:00
ToruNiina
3d1783e12a Merge 'types' into combinator 2018-12-06 16:06:25 +09:00
ToruNiina
f8aa604959 Merge branch 'result' into combinator
- fix some of the constructors of result
- add some utility member functions to boost
2018-12-06 12:57:58 +09:00
ToruNiina
e3f6805629 add conversion members to result 2018-12-06 12:47:14 +09:00
ToruNiina
1dddc6e26c add missing std::move for ctors 2018-12-06 12:46:32 +09:00
ToruNiina
5e052237ba add alias for snake_case types 2018-12-06 01:20:11 +09:00
ToruNiina
a995bd515b Merge branch 'master' into combinator
split typedefs from value.hpp
2018-12-05 21:42:14 +09:00
ToruNiina
532457345c split type definitions from value.hpp 2018-12-05 20:55:25 +09:00
ToruNiina
aa05858de3 add source_name to location/region to show filename
now error message prints the filename
2018-12-05 16:55:31 +09:00
ToruNiina
2b3c8887d6 add comment to confusing implementation 2018-12-04 22:17:20 +09:00
ToruNiina
932a0646ce force clamping character code in [0,256) 2018-12-04 21:58:47 +09:00
ToruNiina
17f3d96766 add lexers 2018-12-04 20:29:59 +09:00
ToruNiina
1f564ec047 add combinators to scan content 2018-12-04 20:29:39 +09:00
ToruNiina
679e282e23 make variables in region/location read-only
to avoid modifying mistakenly
2018-12-03 00:10:26 +09:00
ToruNiina
59588e3a10 add static_assert and useful member funcs 2018-12-02 23:22:27 +09:00
ToruNiina
f83a8b450e add concat_to_string to utility for error messges 2018-12-02 23:05:15 +09:00
ToruNiina
8bf97d8a00 add constructors that receive range to region 2018-12-02 23:04:49 +09:00
ToruNiina
2ee8ffab21 add begin/end to region 2018-12-02 21:54:39 +09:00
ToruNiina
9c1bfbd5eb make region::source immutable 2018-12-02 21:03:08 +09:00
ToruNiina
c38b9b7dc7 add region and location to represent tokens
location is almost same as an Iterator, but having shared_ptr that points
the content. region is almost same as a range. by adding pointer to the
content source, utility function to show the error message can be
implemented easier. it is expected that this also makes easy to show
error messages after parse (e.g., in the case of bad_get)
2018-12-02 20:52:04 +09:00
ToruNiina
6c0a12148b add result<T, E> struct to handle errors
aiming later updates and refactoring of parsers
2018-12-02 18:01:37 +09:00
ToruNiina
f326334147 add definition of constexpr static value to avoid linker error 2018-07-08 18:58:38 +09:00
ToruNiina
b1a55b1331 simplify SFINAE in to_toml 2018-05-05 13:09:40 +09:00
ToruNiina
170b0d6b3f use constexpr value instead of call constexpr func directory 2018-05-05 12:06:06 +09:00
ToruNiina
433636a06f simplify the implementation of from_toml 2018-05-05 11:59:34 +09:00
ToruNiina
9555817901 add get<pair>, get<tuple> 2018-05-05 11:46:09 +09:00
ToruNiina
e54deacf1a simplify SFINAE expressions in toml::get 2018-05-05 11:42:11 +09:00
ToruNiina
f953a9cf23 add conjunction, disjunction, negation, index_seq 2018-05-05 11:37:18 +09:00
ToruNiina
117549bf70 change is_(map|container) and remove needless trait 2018-05-05 11:36:47 +09:00
ToruNiina
5aeb6f24df change exception type #8; iterator may be invalid 2017-12-24 11:02:32 +09:00
ToruNiina
3f1b431ee2 add missing inline specifier #7 2017-12-15 21:39:38 +09:00
ToruNiina
3083f65493 add get_or 2017-12-11 12:04:57 +09:00
ToruNiina
d1fd42ff7e output line number if error occured 2017-06-17 19:05:24 +09:00
Guillaume Fraux
57cc7f77c1 Allow to build with intel c++ compiler 2017-06-13 16:05:55 +02:00
ToruNiina
8a98ce8e35 permit tie with non-match types in from_toml 2017-05-19 14:44:05 +09:00
ToruNiina
80adda8184 open file with binary mode 2017-05-17 14:12:19 +09:00
ToruNiina
2c92142d5c restore parser and test 2017-05-17 14:07:34 +09:00
ToruNiina
d77ec7dc88 restore old parse function 2017-05-17 13:21:32 +09:00
ToruNiina
430940f766 fix typos 2017-05-17 13:12:21 +09:00
ToruNiina
1fc58095fa use wstring_convert (but is deprecated in c++17) 2017-05-17 13:08:24 +09:00
ToruNiina
5ffc51a99d experimentally use wchar and wstring in parser.hpp 2017-05-17 13:04:36 +09:00
ToruNiina
1265952b97 split parsing unicode file 2017-05-17 12:54:13 +09:00
ToruNiina
89c1094a69 set binary flag.. 2017-05-17 12:15:39 +09:00
ToruNiina
d65642ddf6 add locale settings 2017-05-17 11:45:27 +09:00
ToruNiina
9e9a5a7253 fix typo 2017-05-17 10:55:22 +09:00
ToruNiina
81b08c924b remove check from function not dereferencing iter 2017-05-17 08:06:17 +09:00
ToruNiina
74b618c412 fix is_chain_of_impl 2017-05-16 22:29:31 +09:00
ToruNiina
fe6a38737d add Iterator pointing to the end of a range 2017-05-16 22:12:32 +09:00
Luthaf
40da3f54d5 Fix missing include 2017-05-16 14:09:46 +02:00
Guillaume Fraux
612119fa1e Do not use the macro shortcut for not
It is not required by the standard
2017-05-15 14:05:54 +02:00
ToruNiina
eb9f4dce1e remove static and indent 2017-05-13 15:00:02 +09:00
ToruNiina
95e48744d1 impl format<string> 2017-05-13 11:28:11 +09:00
ToruNiina
f52b78010c fix array_of_table assignments 2017-05-12 22:28:49 +09:00
ToruNiina
1c26ffe3ae add parse() function 2017-05-12 20:49:47 +09:00
ToruNiina
fd58cc507f add parse_data 2017-05-11 19:36:12 +09:00
ToruNiina
6ab05a8594 change impl of parser of values 2017-05-11 15:09:11 +09:00
ToruNiina
855cbe5aff add operator= and ctor for result 2017-05-11 15:08:38 +09:00
ToruNiina
f5d301016f add parser impl for integer, float, boolean 2017-05-11 00:14:22 +09:00
ToruNiina
88e2c3fe48 change impl of parser: optional based 2017-05-10 23:56:09 +09:00
ToruNiina
acfc706e0c fix some small mistakes 2017-05-10 11:16:22 +09:00
ToruNiina
1392c2f3b9 add stream manipulators 2017-05-10 00:43:13 +09:00
ToruNiina
70f85ec818 add format 2017-05-09 22:09:03 +09:00
ToruNiina
c706a54121 add namespace specifier 2017-05-09 22:07:28 +09:00
ToruNiina
6878abdca1 define charactor type 2017-05-08 19:17:14 +09:00
ToruNiina
bf7461f7b4 fix parsing order of toml::value 2017-05-08 19:16:54 +09:00
ToruNiina
bdc7fbdf08 fix fundamental_type checking order 2017-05-08 19:16:26 +09:00
ToruNiina
29fe377438 add parser for tables 2017-05-08 19:08:49 +09:00
ToruNiina
d1814d3922 fix arguments 2017-05-08 19:08:30 +09:00
ToruNiina
bae25322f8 add acceptor for overall data 2017-05-08 19:07:50 +09:00
ToruNiina
567b69d050 fix orders of call 2017-05-08 19:07:29 +09:00
ToruNiina
98d1d88f60 add parse_array/inline table 2017-05-07 15:04:40 +09:00
ToruNiina
414fc4d0fa change key acceptor 2017-05-07 15:04:18 +09:00
ToruNiina
2d27c94506 fix missing semicolon 2017-05-07 14:09:13 +09:00
ToruNiina
77f59a2e94 split is_array to fixed_type_array and array_of_some_type 2017-05-07 14:08:42 +09:00
ToruNiina
7355c76ed0 add parse_string and parse_datetime 2017-05-07 13:51:25 +09:00
ToruNiina
a1218b266a add restriction to datetime offset size 2017-05-07 13:50:53 +09:00
ToruNiina
00e4c94766 add is_string and is_datetime 2017-05-07 12:29:54 +09:00
ToruNiina
726a70cd8f enable toml::from_toml to get static array (like std::array) 2017-05-07 10:40:47 +09:00
ToruNiina
3203d39dad enable toml::get to make static array (like std::array) 2017-05-07 10:40:17 +09:00
ToruNiina
58c12a69be add toml::resize func that resize only resizable container 2017-05-06 23:40:57 +09:00
ToruNiina
a506dfd3c1 add has_resize_method 2017-05-06 23:40:28 +09:00
ToruNiina
7c63bc438c remove needless typedef 2017-05-06 18:46:07 +09:00
ToruNiina
7dde4f3039 add parser of fundamental types 2017-05-06 18:44:19 +09:00
ToruNiina
bbb9388d3a add typedefs to basic_datetiem 2017-05-06 18:43:55 +09:00
ToruNiina
864840d11c add table definition acceptor 2017-05-05 19:33:45 +09:00
ToruNiina
e35e620812 add acceptor for array and inline table 2017-05-05 18:54:09 +09:00
ToruNiina
9a627b44fb add some test 2017-05-05 17:17:03 +09:00
ToruNiina
50d00a840f add acceptors for toml values 2017-05-05 16:48:54 +09:00
ToruNiina
3e016be668 add simple acceptors 2017-05-05 10:54:47 +09:00
ToruNiina
833c69628a fix datetime::ctor and stream operator for datetime 2017-04-21 15:54:48 +09:00
ToruNiina
78f25dd66d split files 2017-04-21 13:14:53 +09:00
ToruNiina
337a671f0c split datetime definition from toml.hpp 2017-04-21 12:56:39 +09:00
ToruNiina
7918894e6b add decl of basic_datetime 2017-04-20 22:07:43 +09:00
ToruNiina
f4afaa7509 add from_toml(std::tie, value) and test for it 2017-04-20 16:13:06 +09:00
ToruNiina
85ea77043a add missing default 2017-04-20 14:37:51 +09:00
ToruNiina
24b759b827 add operator for toml::value 2017-04-20 14:23:01 +09:00
ToruNiina
c6f38967df change message in exception 2017-04-20 13:30:01 +09:00
ToruNiina
1b2b422ea1 add from_toml and get function 2017-04-20 12:49:36 +09:00
ToruNiina
fd8753612a add to_toml(initializer_list) 2017-04-20 12:05:10 +09:00
ToruNiina
4a5f4a4bf5 add ctor for initializer_list 2017-04-20 10:44:11 +09:00
ToruNiina
df3602f347 add to_toml func 2017-04-20 00:13:58 +09:00
ToruNiina
34b0176083 remove is_castable 2017-04-19 23:10:29 +09:00
ToruNiina
0260a13f1c make tests/ and toml/ dir and move codes 2017-04-19 22:47:24 +09:00