ToruNiina
7354e91924
fix: Allow MSVC to have old version
2021-12-18 00:36:20 +09:00
ToruNiina
4522070391
ci: check if MSVC 14 2015 (19.0.24241.7) (1900)
...
passes ci build if we skip _MSVC_LANG
2021-12-18 00:21:55 +09:00
ToruNiina
02fd8a577b
feat: workaround __cplusplus problem on MSVC
2021-12-17 22:29:57 +09:00
ToruNiina
cc1cc27613
fix: disallow merging dotted key and inline table
...
current code mistakenly allows the following TOML file.
```toml
a.b = 42 # table "a" is defined here, implicitly
a = {c = 3.14} # table "a" is overwritten here
```
But we need to allow the following (structually similar) TOML file.
```toml
a.b = 42 # table "a" is defined here, implicitly
a.c = 3.14 # table "a" is merged with {c = 3.14}
```
To distinguish those, we check whether the current table is defined as
an inline table or via dotted key. If the table we are inserting is
defined via dotted key, we accept it and merge the table. If the table
being inserted is defined as an inline table, then we report an error.
2021-12-16 01:11:47 +09:00
ToruNiina
75e297eb47
fix: Merge branch 'check-datetime'
...
Briefly check if a given date and time is valid
2021-12-15 22:35:56 +09:00
ToruNiina
518e6d4ae2
feat: check date and time are valid or not
2021-12-15 00:31:41 +09:00
ToruNiina
db2aa55d20
fix: disallow null char at the end of input
...
since std::string and ""_toml literal actually does not include null
char, we don't need to check if the last char is null or not
2021-12-14 22:33:58 +09:00
ToruNiina
2e4c7fb95e
fix: line-feed is not required at the EOF
2021-12-10 23:39:54 +09:00
Louis R. Marascio
21732fce45
Resolve g++ warning: free-nonheap-object
...
As described in issue #173 , this warning is raised on various platforms
and in various build types. For example, g++ 11 in release mode will
cause this warning to be raised. This change fixes this warning.
2021-12-01 14:43:43 -06:00
Philip Top
9c1708c988
Update toml/traits.hpp
...
Co-authored-by: Toru Niina <niina.toru.68u@gmail.com>
2021-11-24 06:40:09 -08:00
Philip Top
eef7106fbe
fix more warnings
2021-11-19 10:22:37 -08:00
Philip Top
99e483c447
[ci skip] use a policy in the CMakeLists.txt for toml11 fix some more string_view errors
2021-11-19 08:41:00 -08:00
Philip Top
26a066ad07
skip ci
...
ci skip
update another string_view issue
2021-11-19 08:39:00 -08:00
Philip Top
acad8b1a61
add additional check for invocability
2021-11-19 08:37:02 -08:00
Philip Top
605cd8ef4a
fix shadow and some undef warnings
2021-11-19 08:37:01 -08:00
ToruNiina
bcee9f25a2
fix: check if subtable key conflicts
2021-10-10 20:58:28 +09:00
estshorter
dced71224d
fix a compile warning C26478
2021-10-09 11:12:58 +09:00
ohdarling
e434c96b7f
fix: serializer has wrong constructor params order when format root object
2021-09-22 11:38:42 +08:00
Karl Nilsson
3eee515ce1
Spelling fixes
2021-08-27 19:52:45 -04:00
ToruNiina
ca9e36a484
fix: avoid duplicated-branches in result
...
when both two types are trivially destructible, both branches of cleanup
function results in the same code...
2021-07-01 00:46:56 +09:00
ToruNiina
0858fbfced
fix: avoid max
macro expansion on Windows
...
in numeric_limits<T>::max
2021-06-30 01:43:27 +09:00
ToruNiina
0aa3773860
feat: add bare minimum utf8 seq validity check
2021-06-30 00:58:50 +09:00
ToruNiina
c72b27bb4b
fix: escape control characters in a string
2021-06-27 18:57:20 +09:00
ToruNiina
be5ffaf662
feat: check if width == max before using ml-string
2021-06-27 18:56:57 +09:00
ToruNiina
47a2a3332b
fix: use empty quoted string for empty key
2021-06-27 18:56:33 +09:00
ToruNiina
9d28afa012
fix: fix serialization of inf/nan
2021-06-27 18:56:05 +09:00
ToruNiina
f09bd5b035
feat: easy check for datetime
2021-06-27 18:54:55 +09:00
ToruNiina
0dc51f95d9
fix: disallow trailing comma in an inline table
2021-06-27 18:54:28 +09:00
ToruNiina
cf9e86a84f
fix: disallow control characters
...
in basic/literal string and comment
2021-06-27 18:53:48 +09:00
ToruNiina
45bd566f7a
fix: serialization of array containing a table
...
table in a (hetero-) array should be force-inlined
2021-06-27 16:28:41 +09:00
ToruNiina
1b7ca8566b
fix: out_of_range with malformed toml file #164
2021-06-27 15:58:40 +09:00
Toru Niina
c281539b26
Merge pull request #161 from cubiest/bugfix/empty_files_missing_filename_in_error
...
Preserve empty location for empty files
2021-05-26 12:28:38 +09:00
Oliver Kahrmann
58542d36be
Preserve empty location for empty files
...
Without a region, error messages in exceptions are unable to print
a filename.
By retaining the location in a zero-length region and detecting this
when formatting the exception text it is possible to print the filename
and explicitly state that the file is completely empty.
Fixes #160
2021-05-25 20:52:33 +02:00
ToruNiina
c38079f7c0
fix: remove needless include file
...
that might cause compilation error
2021-05-25 21:40:41 +09:00
ToruNiina
891f68eab0
feat: support all &/const&/&& variants
2021-05-15 20:41:11 +09:00
ToruNiina
4b1df61142
Merge branch 'master' into recursive-find-or
2021-05-15 20:01:30 +09:00
ToruNiina
0ac3919e08
feat: from<T> and from_toml precede constructor
...
constructor sometimes has `template<T> ctor(const T&)` and it causes
ambiguity. To avoid it, from<T> and T.from_toml precedes any
constructor. But, to check the ambiguity between from<T> and from_toml,
they do not precede each other. If anyone define both from<T> and
from_toml, it causes compilation error.
2021-05-14 16:05:54 +09:00
ToruNiina
e622595426
fix: fix has_specialized_from/into
...
to avoid ambiguity
2021-05-14 16:01:43 +09:00
ToruNiina
72ee8caf09
refactor: use has_specialized_from<T>
...
to check if toml::from<T> exists for a specific T
2021-05-14 15:53:34 +09:00
ToruNiina
b6e2c6e235
feat: add detail::has_specialization_from/into
2021-05-14 15:46:00 +09:00
ToruNiina
7e90282175
fix: add region where -Wshadow is ignored on GCC 4
2021-05-10 23:00:30 +09:00
ToruNiina
b8291af42b
fix: rename func args to avoid -Wshadow in GCC 4.x
2021-05-10 22:56:16 +09:00
ToruNiina
cd60045014
fix: gcc 7 introduces wshadow variants
2021-05-10 21:51:51 +09:00
ToruNiina
4acc563b28
feat: explicitly avoid -Wshadow=global in GCC
2021-05-10 20:49:20 +09:00
ToruNiina
dce50142e6
fix: avoid argname key
to supress warning
...
about shadowing
2021-05-10 20:47:08 +09:00
ToruNiina
c40e0dbd37
feat: use comment macro everywhere
2021-04-16 15:29:24 +09:00
ToruNiina
d90c26f9ac
feat: add TOML11_PRESERVE_COMMENTS_BY_DEFAULT
2021-04-16 15:28:58 +09:00
ToruNiina
b592ddcca2
fix: add SFINAE to avoid incorrect matching
2021-04-14 13:09:51 +09:00
ToruNiina
5518b2b155
refactor: simplify last_one_in_pack meta func
2021-04-14 13:09:25 +09:00
ToruNiina
ba3d41d913
feat( #156 ): add find_or(value, keys..., opt)
2021-04-14 11:22:19 +09:00
ToruNiina
db1f42b5da
fix: enable to control macro definition
2021-04-02 17:21:25 +09:00
ToruNiina
14c6430dda
Merge branch 'master' into auto-conversion-macro
2021-04-02 16:25:41 +09:00
ToruNiina
a3b8dd6787
fix( #152 ): add newline btw kv-pair and subtables
2021-03-31 10:52:18 +09:00
ToruNiina
c121492071
fix: uneven spacing between tables
...
related: issue #152
2021-03-29 17:48:03 +09:00
ToruNiina
b924e70e3c
feat: add a simple way to disable <filesystem>
...
As jwillikers pointed out in #150 , there is a case where compiler
defines the corresponding feature test macro of <filesystem> but is
actually not available. The macro is a way to disable the feature
regardless of the status of feature test macro.
2021-03-25 11:44:11 +09:00
sneakypete81
08859c36d0
Fix typo in error message
2021-01-30 20:04:00 +00:00
Alex Merry
db2d33ca4b
Add missing header for std::out_of_range exception
...
Failure seen on GCC 4.8.5 when including "toml/value.hpp".
2020-12-09 10:39:10 +00:00
Alex Merry
935da51769
Add missing include for ostringstream
...
Since region.hpp no longer includes <iostream> (but only <iomanip>),
source_location.hpp no longer includes a header that provides
std::ostringstream. Including <sstream> fixes this.
2020-12-09 10:19:07 +00:00
ToruNiina
9b472a6c72
fix: check it is empty before calling back
2020-11-04 23:24:59 +09:00
ToruNiina
1ead14589e
fix: check if it is empty before calling back()
2020-11-04 23:24:02 +09:00
ToruNiina
a6581ee66b
fix: an empty array is not an array of table
2020-11-03 20:34:01 +09:00
ToruNiina
908b91079b
fix: distinguish the comments and try to keep it
...
If a value has a comment, we need to try to write it explicitly.
2020-10-18 20:43:33 +09:00
ToruNiina
fce6ff317e
refactor: distinguish the reason of failure
2020-10-18 18:36:05 +09:00
ToruNiina
fd50b11523
refactor: add write_comments()
2020-10-18 18:35:56 +09:00
ToruNiina
9090b8273c
refactor: move array-of-table stuff to a function
2020-10-18 17:20:06 +09:00
ToruNiina
88882b523f
feat: add a macro defines convertion automatically
2020-10-16 21:40:47 +09:00
ToruNiina
382e3dc3ab
refactor: use serializer::is_array_of_tables
2020-10-14 22:27:29 +09:00
ToruNiina
f7bfcdd7aa
fix: check all the elements in an array
...
while checking if the array is array-of-tables or not (heterogeneous
arrays are allowed, so there might be an array that has a table and
an integer at the same time)
2020-10-14 18:00:04 +09:00
ToruNiina
2e41a26785
Merge branch 'master' of github.com:ToruNiina/toml11 into master
2020-10-14 15:35:18 +09:00
ToruNiina
f283a257d2
Revert "quick temporary patch for comment dup"
...
This reverts commit a6d38c1ec0
.
Since the problem is solved, we don't need this patch any more.
2020-10-13 22:02:32 +09:00
ToruNiina
3d86f3a4e1
fix: avoid comment duplication in array of tables
2020-10-13 21:59:46 +09:00
ToruNiina
dc5a8069a9
refactor: require comments while construction
...
Note: at this commit, the code would not compile.
2020-10-13 21:58:08 +09:00
Ivan Shynkarenka
5d8c573357
Fixed: Compile toml11 with MinGW cause error in <filesystem> #136
2020-10-03 23:16:58 +03:00
Ivan Shynkarenka
6e1e5ccd84
Fixed: Compile toml11 with MinGW cause error in <filesystem> #136
2020-10-03 23:06:47 +03:00
Ivan Shynkarenka
f2d9fd1d1f
Fixed: Compile toml11 with MinGW cause error in <filesystem> #136
2020-10-03 22:36:59 +03:00
Ivan Shynkarenka
97c8cbdaf5
Fixed: Compile toml11 with MinGW cause error in <filesystem> #135
2020-10-02 19:10:04 +03:00
ToruNiina
05ceb5ae79
fix: workaround for error around SFINAE in MSVC
...
avoid lambda with template argument
2020-09-29 02:26:16 +09:00
ToruNiina
0fec125688
feat: remove default value from internal src
2020-09-29 01:40:49 +09:00
ToruNiina
a6d38c1ec0
fix: add a quick temporary patch for comment dup
...
first aid for #131
2020-09-22 17:36:24 +09:00
ToruNiina
670186fac7
Merge branch 'master' into allow-comment-before-comma
2020-09-19 18:10:45 +09:00
ToruNiina
a32cd6cb61
feat: enable to use u8""_toml literal in C++20
2020-09-16 21:24:03 +09:00
ToruNiina
003bc16c1b
fix: skip the last zero in the file
2020-09-14 16:35:51 +09:00
ToruNiina
5f38127692
feat: allow comments before comma
...
replace ws by ws_comment_newline, as suggested.
discussed here: toml-lang/toml/issues/766
2020-08-16 11:03:58 +09:00
ToruNiina
3c3ebd88b4
feat: improve error message about invalid keys
2020-08-09 18:38:50 +09:00
ToruNiina
08f7ea9c56
refactor: remove extraneous whitespaces in errmsg
2020-08-09 18:38:21 +09:00
ToruNiina
cde29399f4
fix: use 1 in source_location as the default pos
2020-08-07 22:24:01 +09:00
ToruNiina
4fa94d45b3
fix: use const char* instead of &char[N]
...
to enable to pass char*, not only string literal
2020-08-04 20:08:58 +09:00
ToruNiina
4e6ae9a994
refactor: avoid string construct in format_ul
2020-07-30 16:11:35 +09:00
ToruNiina
f23c003d2f
fix: add missing namespace specifier
2020-07-28 00:04:25 +09:00
ToruNiina
4b719f0806
refactor: use location() instead of get_region
2020-07-27 23:15:14 +09:00
ToruNiina
22ace027de
refactor: rm template from detail::change_region
2020-07-27 23:04:24 +09:00
ToruNiina
bc219af5b5
refactor: use location() member instead of ctor
2020-07-27 23:03:33 +09:00
ToruNiina
68e8a31659
refactor: remove needless addressof() call
2020-07-27 23:00:40 +09:00
ToruNiina
32a5341d09
refactor: use source_location, not region_base*
2020-07-27 22:29:18 +09:00
ToruNiina
ce68f6f4c2
refactor: check (always-valid) ptr before deref
2020-07-27 21:32:35 +09:00
ToruNiina
e696aabd11
refactor: change internal interface to reduce code
...
to remove `std::addressof` calls, get_region(toml::value) now
returns a pointer to region.
2020-07-27 00:48:04 +09:00
ToruNiina
7fb93e2f54
fix: add missing explicit
to detail::region
2020-07-27 00:20:26 +09:00
ToruNiina
19cc9a2edf
refactor: remove template from detail::region
2020-07-25 22:01:34 +09:00
ToruNiina
72f5afb6af
refactor: remove template from detail::location
2020-07-25 21:06:26 +09:00
ToruNiina
a8fa14d159
refactor: remove vec() method, use a constructor
2020-07-21 20:55:18 +09:00