ToruNiina
4c5076f263
feat: add runtime colorize flag
2019-11-13 18:01:47 +09:00
ToruNiina
d47174954f
feat: colorize user-defined msg by format_error
2019-11-13 18:00:55 +09:00
ToruNiina
821eb9632b
feat: add a macro-dependent constant
2019-11-13 17:59:47 +09:00
ToruNiina
af116991b6
fix: remove overlapping [error] sign
2019-11-13 17:35:23 +09:00
ToruNiina
87bebbc37d
feat: put color to the internal error messages
2019-11-13 17:35:05 +09:00
ToruNiina
c2d0351e69
feat: add (ANSI) terminal colorize operators
2019-11-13 17:24:51 +09:00
ToruNiina
1526b9feee
Merge branch 'heterogeneous-array'
2019-11-09 11:03:18 +09:00
ToruNiina
adf8fa9234
fix: fix typos in an error message in toml::get
...
when converting toml::value to std::tuple
2019-11-08 16:12:18 +09:00
ToruNiina
9af2d65417
feat: allow heterogenous array
...
if TOML11_USE_UNRELEASED_TOML_FEATURES is activated.
In TOML v0.5.0, heterogenous arrays are not allowed. But after some
discussions in toml-lang/toml, it is decided to allow it in the next
release (toml-lang/toml/pull/676).
To support it, disable type check in parse_array function.
2019-11-08 15:36:58 +09:00
ToruNiina
8240fffeca
Merge branch 'master' into add-src-loc-to-exception
2019-11-02 12:53:16 +09:00
ToruNiina
047611764c
fix: silly typo
2019-11-01 21:15:20 +09:00
ToruNiina
bc3eb9d967
feat: add src_loc to all the exceptions
...
including internal_error.
2019-11-01 21:14:33 +09:00
ToruNiina
6862264bde
feat: use the first char as the top-level region
...
A bit related to #89
2019-11-01 20:47:25 +09:00
ToruNiina
2ee69fc420
fix: improve error messages about strings a bit
2019-11-01 13:34:15 +09:00
ToruNiina
6a15e8360f
refactor: remove redundant namespace specifier
2019-10-31 23:13:49 +09:00
ToruNiina
41eb1d6887
feat: pass source_location to exception
2019-10-31 22:23:31 +09:00
ToruNiina
3ca712a8da
feat: check line_num before converting it to int
2019-10-31 22:21:24 +09:00
ToruNiina
8e589ff4d7
feat: add source_location to (syntax_|type_)error
2019-10-31 22:04:16 +09:00
ToruNiina
56812114c3
refactor: simplify inclusion dependencies
2019-10-31 21:58:28 +09:00
ToruNiina
f98615d0df
fix: check file content is empty or not
2019-10-30 16:49:49 +09:00
ToruNiina
37769e28f0
fix #88 : check if input is null-terminated or not
2019-10-30 16:33:22 +09:00
ToruNiina
258e62f8f3
feat: add operator+= to toml::string
2019-10-09 21:51:14 +09:00
ToruNiina
b4b35ea33e
feat: allow 0-prefix exponent if the flag is on
...
If unreleased feature is activated, zero-prefixes in an exponent part of
a floating point is allowed. If the flag TOML11_UNRELEASED_TOML_FEATURES
is turned on, we don't need to check whether there is a zero prefix in
the exponent part that is formatted by a standard library.
2019-10-08 23:23:53 +09:00
ToruNiina
d7b4d104d3
refactor: reduce checking; just check once
2019-10-08 23:15:03 +09:00
ToruNiina
1148d01c70
Merge branch 'master' into find-idx
2019-10-07 11:11:08 +09:00
ToruNiina
488015df49
fix: toml -> T is required; related to #83
2019-10-04 13:00:34 +09:00
ToruNiina
4c12dad51f
feat: add find<T>(value, idx) for arrays ( #79 )
2019-10-03 15:27:25 +09:00
ToruNiina
ad7eb56634
fix: avoid potential memory bugs related to move
2019-10-03 14:42:52 +09:00
ToruNiina
22dac3c9f2
Merge branch 'value-at'
2019-09-28 19:40:51 +09:00
ToruNiina
d5adfe8c7d
refactor: use as_xxx instead of cast<enum>
...
because cast<enum>() requires `template` specifier inside a template
function. it makes code long.
2019-09-28 17:01:45 +09:00
ToruNiina
d73bc6076c
feat: add basic_value::at(key) and at(idx)
2019-09-28 16:21:51 +09:00
ToruNiina
f3d3f63ff9
fix: return values from find_or(value&&)
2019-09-28 13:38:26 +09:00
ToruNiina
b44fbad925
fix: remove needless ::type
2019-09-28 11:14:14 +09:00
ToruNiina
826c9444ac
refactor: use remove_cvref
2019-09-28 11:03:46 +09:00
ToruNiina
a1095f3e4c
refactor: use std::map::at instead of []
2019-09-28 11:03:14 +09:00
ToruNiina
483a39beb4
refactor: remove unsupported overload
...
expect<T>(table, ...)
2019-09-28 11:00:35 +09:00
ToruNiina
1409114c96
refactor: add utility meta-func for internal use
2019-09-28 10:58:02 +09:00
ToruNiina
ecfc9d0c5a
fix: make return type rvalue when rvalue is passed
2019-09-28 10:31:10 +09:00
ToruNiina
c2e1aa9a3c
Merge branch 'master' into fp-exp-leading-zeroes
2019-09-05 13:50:58 +09:00
ToruNiina
5b5ece6c32
fix: add "unreleased" flag to raw-tab-in-string
2019-09-04 18:10:15 +09:00
ToruNiina
4f8b62a7e9
feat: add TOML11_USE_UNRELEASED_TOML_FEATURES flag
...
to choose to use unreleased toml feature
2019-09-04 13:32:05 +09:00
ToruNiina
15b68a89c6
fix: suppress warnings by forwarding argument
2019-08-31 13:04:25 +09:00
ToruNiina
1acf87679e
feat: permit leading 0s in exp parts of floats
...
This is an unreleased feature of toml language, but is merged into
toml-lang/toml:master.
2019-08-28 16:02:10 +09:00
ToruNiina
7a1b5bd64e
fix: skip whitespaces without newline
2019-08-26 18:16:09 +09:00
ToruNiina
e332e018db
feat: allow raw tab characters in basic strings
...
This feature is planned to be incorporated in toml v1.0.0 but not
released yet.
2019-08-21 11:19:47 +09:00
ToruNiina
8dded288b4
Merge branch 'master' into find-or-value
2019-08-07 14:58:56 +09:00
ToruNiina
0f491c7f3a
fix: add overload for find_or with toml::value
2019-08-07 14:55:30 +09:00
ToruNiina
cffc605505
fix: stop including iostream
2019-07-23 22:27:20 +09:00
ToruNiina
87e0ba201e
feat: enable to swap comment and strings
2019-07-13 14:33:14 +09:00
ToruNiina
c2435b0d56
feat 💥 : format toml::string as TOML format
2019-06-29 20:19:47 +09:00
ToruNiina
c272188060
fix: check inline table does not include LF
2019-06-29 16:39:54 +09:00
ToruNiina
d5299fef04
feat: add no_comment option to serializer
2019-06-29 14:59:18 +09:00
ToruNiina
0502924d25
feat: add nocomment and showcomment
2019-06-28 19:08:48 +09:00
ToruNiina
3624e4b690
fix: put comment just after non-table values
...
When non-table value is passed to the `operator<<`, it assumes that the
original C++ code looks like the following.
```cpp
std::cout << "key = " << v << std::endl;
```
In this case, the comment associated to `v` should be put just after
`v`, not before.
```toml
key = # comment <= bad
"value"
key = "value" # comment <= good
```
So, if `v` is not a table it would put comments just after the value.
2019-06-28 17:53:19 +09:00
ToruNiina
79e7511871
feat: add format_key to help serialization
2019-06-28 17:47:19 +09:00
ToruNiina
284f122433
refactor: replace for-loop by comment output
2019-06-28 14:58:47 +09:00
ToruNiina
28b3f7d6fb
feat: add ostream operator to comment containers
2019-06-28 14:57:45 +09:00
ToruNiina
6b5fd349aa
fix: initialize source_location correctly
2019-06-26 21:35:01 +09:00
ToruNiina
76e44a0c48
refactor: remove needless inline specifier
2019-06-26 21:34:36 +09:00
ToruNiina
6a251f582e
refactor: remove needless code snippet
2019-06-22 17:52:01 +09:00
ToruNiina
74ef494797
feat: remove unused trait types
2019-06-22 17:35:40 +09:00
ToruNiina
0cee58b0b1
Merge branch 'v3' of github.com:ToruNiina/toml11 into v3
2019-06-21 14:31:52 +09:00
ToruNiina
d4afed5bbb
feat: construct value with a list of comments
2019-06-21 14:26:05 +09:00
ToruNiina
a68543a895
fix: detect comment in stricter way
2019-06-21 13:10:02 +09:00
ToruNiina
ecf55f86d6
refactor: add explicit type conversion
2019-06-21 00:25:57 +09:00
ToruNiina
be2d2aec52
refactor: explicitly convert difference_t to size_t
2019-06-20 23:59:16 +09:00
ToruNiina
be04bf1302
refactor: convert file size to size_t
2019-06-20 23:58:35 +09:00
ToruNiina
427706d671
fix: explicitly add float conversion
2019-06-20 23:58:15 +09:00
ToruNiina
71ff54e76c
fix: rearrange internal int types in datetimes
2019-06-20 23:58:08 +09:00
ToruNiina
8208bbf236
fix: check and convert value manually
...
I totally have no idea when std::count returns a negative value, but the
result type of `std::count` is a differnce_type. So when it is added
with size_t value, implicit sign conversion happens. This changes check
this kind of (almost trivial but required) checking.
2019-06-20 22:27:16 +09:00
ToruNiina
f689d26294
refactor: add conversion function to utf8 encoder
2019-06-20 22:25:40 +09:00
ToruNiina
9e6d8e76d0
fix: replace null deref by terminate for safety
...
Since empty_iterator never points anything, so it always points null
(it returns nullptr by operator->). but dereferencing null causes UB.
Just calling std::terminate is of course better.
2019-06-20 20:56:49 +09:00
ToruNiina
5e5a757208
fix: conversion between different basic_value s
2019-06-20 14:35:38 +09:00
ToruNiina
3379ed82ec
refactor: remove meaningless meta conditions
2019-06-19 20:06:06 +09:00
ToruNiina
9663a6bbdb
Merge branch 'master' into v3
2019-06-19 19:53:08 +09:00
ToruNiina
4a2c823d56
fix: comparison between values that has a table
2019-06-19 19:32:25 +09:00
ToruNiina
24c28c7f4f
fix: correct some SFINAE expressions
2019-06-19 18:59:12 +09:00
ToruNiina
7e5859ba73
Merge branch 'master' into v3
2019-06-19 15:36:27 +09:00
ToruNiina
dee32e7d5e
style: make hint messages clearer
2019-06-19 12:58:34 +09:00
ToruNiina
53a185e7a9
fix: revert misjudgement as a bug
...
Probably I'm too tired.
This reverts commit adcd75e017
.
2019-06-18 21:41:30 +09:00
ToruNiina
fd980a8c5d
🔀 Merge branch 'guess-type-error'
2019-06-18 21:29:45 +09:00
ToruNiina
adcd75e017
fix: correctly initialize offset
2019-06-18 21:27:16 +09:00
ToruNiina
32d5c9e924
fix: serialize array correctly
2019-06-18 01:27:52 +09:00
ToruNiina
262f9c5fcc
fix: avoid duplicating comment: array/table elems
2019-06-18 01:26:40 +09:00
ToruNiina
ca084abe90
feat: consider the first comments as a file comment
2019-06-18 00:44:49 +09:00
ToruNiina
7b1a788e2d
feat: enable to convert vector<string> to comments
2019-06-18 00:43:25 +09:00
ToruNiina
f744a792e2
fix: constructor with array-like types
2019-06-17 23:45:43 +09:00
ToruNiina
bc68a9d9ee
refactor: remove needless include file
2019-06-17 23:07:14 +09:00
ToruNiina
c2b0de623f
feat: enable to convert map-like to toml::value
2019-06-17 22:50:14 +09:00
ToruNiina
af11d56e79
fix: correctly move value from find_or to get_or
2019-06-17 22:40:52 +09:00
ToruNiina
6399d44e3b
fix: consider comments while serialization
2019-06-17 22:13:58 +09:00
ToruNiina
d10c0725fd
fix: consider closing bracket when collect comments
...
table = {key = "value"} # comment.
a value named "table" ({key = "value"}) has the above comment.
but a value named "key" ("value") does not have any comment.
2019-06-17 22:12:20 +09:00
ToruNiina
7eac3a3028
feat: support serialization of basic_value
2019-06-17 20:34:42 +09:00
ToruNiina
57b5545ba2
fix: add _type suffix to value::xxx_type
2019-06-17 20:34:13 +09:00
ToruNiina
f36b39c04f
fix: consider comments while comparing values
2019-06-17 20:33:57 +09:00
ToruNiina
1bfe8f1f54
Merge branch 'master' into guess-type-error
2019-06-17 12:48:36 +09:00
ToruNiina
b3300fad2a
fix: move element of map in toml::find(val&&)
2019-06-17 12:13:59 +09:00
ToruNiina
94bcf0aae9
Merge branch remote into v3
2019-06-17 12:10:45 +09:00
ToruNiina
0ef232a1e0
feat: 💥 remove toml::find_or for toml::table
2019-06-17 01:26:05 +09:00
ToruNiina
0604cf813a
feat: 💥 remove toml::find for tables
2019-06-17 01:24:32 +09:00
ToruNiina
cbaaaaca7c
⏪ revert recursive find function
...
I found that in a user-code (I'm also one of the users of this library),
this new feature sometimes causes an error. Some of my code won't
compile because of this change. Since toml::table is convertible to
toml::value *implicitly*, if toml::find(table, key, tablename) was
called, the overload resolution becomes ambiguous with toml::find(
value, key1, key2). But dropping support for toml::find(toml::table,
key, tablename) is a breaking change. So I concluded that now is not
the right time yet.
2019-06-16 19:55:40 +09:00
ToruNiina
cf1c9371b6
fix: correct example and positions in err msgs
2019-06-16 17:52:42 +09:00
ToruNiina
62e8d58d8d
feat: guess possible format errors
2019-06-16 17:32:29 +09:00
ToruNiina
cc4a9c8d5d
fix: consider identity conversion in SFINAE
2019-06-15 20:20:14 +09:00
ToruNiina
af19dfe032
fix: conversion between different basic_values
2019-06-15 20:19:51 +09:00
ToruNiina
5726d10339
feat: save comment information in value
2019-06-15 17:13:02 +09:00
ToruNiina
a6706f7879
fix: templatize internal function for value
2019-06-15 17:12:30 +09:00
ToruNiina
558349170d
fix: correct the order and remove last CR
2019-06-15 17:11:49 +09:00
ToruNiina
eb4eca86db
feat: 💥 change comment interface in region
2019-06-15 16:11:05 +09:00
ToruNiina
d8a9ee4f72
🔀 Merge branch 'master' into v3
2019-06-15 15:17:08 +09:00
Toru Niina
e66bb3d359
Merge pull request #67 from ToruNiina/hotfix
...
suppress warnings on clang v7+
2019-06-10 10:54:54 +09:00
khoitd1997
2f4f3efbf0
fix sign-compare warning
2019-06-09 12:00:28 -07:00
ToruNiina
06ae67502a
fix: move argument correctly
2019-06-09 21:05:46 +09:00
ToruNiina
6345910c3e
🔀 Merge branch 'master' into v3
2019-06-08 20:05:05 +09:00
ToruNiina
9948549b62
fix: add missing template parameters
2019-06-08 19:53:50 +09:00
ToruNiina
54d46f08c3
🔀 Merge branch 'master' into v3
2019-06-08 19:40:11 +09:00
ToruNiina
57cb806e14
Merge branch 'master' into throw-from-as-something
2019-06-08 19:23:32 +09:00
ToruNiina
4f4d4380f2
feat: throw from as_* if type differs
2019-06-07 19:34:04 +09:00
ToruNiina
31debcb8aa
🔀 Merge branch 'master' into recursive-find
2019-06-07 19:02:20 +09:00
ToruNiina
7db8388d17
fix: avoid deprecated stuff in the internal code
2019-06-07 13:27:10 +09:00
ToruNiina
62c993e096
feat: add as|is_floating and deprecate as|is_float
...
to make the function names consistent with snake_case_typenames
2019-06-07 00:10:12 +09:00
ToruNiina
014d882f8f
feat: enable to find value by recursive search
2019-06-07 00:06:14 +09:00
ToruNiina
a8b5fef827
feat(WIP): add workaround to make literal compiles
2019-06-06 22:32:51 +09:00
ToruNiina
7258c52334
feat: enable to edit comments through memfun
2019-06-03 22:17:10 +09:00
ToruNiina
407d9223f6
feat: 💥 is_float -> is_floating
2019-06-03 22:01:47 +09:00
ToruNiina
d7c5606dcf
fix: update as_float -> floating
2019-06-03 21:46:48 +09:00
ToruNiina
ae2bafa907
fix: correct SFINAE conditions and types
2019-06-03 21:44:11 +09:00
ToruNiina
f19b3822bb
feat: 💥 change as_float -> as_floating
2019-06-03 21:43:35 +09:00
ToruNiina
a19b94511b
fix: add space between operator"" and _toml
...
In C++11, it is required.
2019-06-03 20:58:35 +09:00
ToruNiina
fe8a909213
fix: correctly put references
2019-06-02 22:09:26 +09:00
ToruNiina
5fe166e375
fix: update value_t::* names in serializer
...
Although currently serializer does not support basic_value, it compiles.
2019-06-02 21:51:37 +09:00
ToruNiina
319365f86b
feat: update types in format_error
2019-06-02 21:50:27 +09:00
ToruNiina
89f0ace6ee
fix: initialize comment container correctly
2019-06-02 21:50:01 +09:00
ToruNiina
2e34035e7a
feat: 💥 update types and retval of parser
...
- change return value from toml::table to toml::value
- enable to change container types and comment policy by template
2019-06-02 21:47:57 +09:00
ToruNiina
e094d6e85a
refactor: move type alias from get to trait
2019-06-02 20:43:08 +09:00
ToruNiina
4664f91517
feat: remove unused meta-function alias
2019-06-02 20:40:44 +09:00
ToruNiina
c0b6ca762a
feat: 💥 drop from_toml support
2019-06-02 19:27:03 +09:00
ToruNiina
5ef9890d0c
feat: update find_or for basic_value
2019-06-02 19:22:17 +09:00
ToruNiina
bda337b51f
feat: support conversion between basic_values
2019-06-02 19:09:56 +09:00
ToruNiina
6569c26e1b
feat: make SFINAE condition strict
2019-06-02 19:04:32 +09:00
ToruNiina
6d17d5f60f
feat: update expect for basic_value
2019-06-02 19:02:25 +09:00
ToruNiina
c00eeb18ef
feat: add meta function that detects toml::basic_value
2019-06-02 19:02:01 +09:00
ToruNiina
3ce1aa31f3
feat: update get_or for basic_value
2019-06-02 18:55:02 +09:00
ToruNiina
cf28c3fb95
feat: update toml::find for basic_value
2019-06-02 18:36:49 +09:00
ToruNiina
6de494598a
fix: remove unused argument to suppress warnings
2019-06-02 18:32:47 +09:00
ToruNiina
b06ae03deb
feat: update toml::get<T> for basic_value
2019-06-02 17:53:08 +09:00
ToruNiina
725d915ba9
feat(WIP): update toml::get
2019-06-02 17:31:49 +09:00
ToruNiina
e1556183d1
refactor: remove unused include files
2019-06-02 17:12:01 +09:00
ToruNiina
9676499ab5
refactor: move file inclusion to correct position
2019-06-02 15:29:34 +09:00
ToruNiina
5792411d5e
feat: add default template argument to basic_value
2019-06-02 15:15:43 +09:00
ToruNiina
44184026f9
feat: enable to convert different basic_values
2019-06-02 00:13:12 +09:00
ToruNiina
898423166f
feat: enable to convert preserve/discard comments
2019-06-02 00:02:31 +09:00
ToruNiina
f9b5166c09
refactor: move default value types to value.hpp
2019-06-01 23:58:17 +09:00
ToruNiina
5c5d8b686a
feat: introduce basic_value
...
it is capable to change comment policy, backend container of an array
and a table.
2019-06-01 20:18:57 +09:00
ToruNiina
5c3c1bd0e7
feat: add missing default array/table type
2019-06-01 20:18:15 +09:00
ToruNiina
696e5bb66f
feat: extend has_from_toml_method to be generic
2019-06-01 20:16:59 +09:00
ToruNiina
65540fbb5c
fix: typos
2019-06-01 19:47:10 +09:00
ToruNiina
351320491d
fix: fix has_from_toml using basic_value
2019-06-01 19:46:20 +09:00
ToruNiina
d30700517d
fix: add missing include file
2019-06-01 19:43:35 +09:00
ToruNiina
14ad8d0556
fix: fix typos and invalid names
2019-06-01 19:43:15 +09:00
ToruNiina
f04c97b587
refactor: simplify format_underline a bit
2019-06-01 19:06:08 +09:00
ToruNiina
b8d3038d38
feat: add meta function to detect conversions
2019-06-01 16:03:26 +09:00
ToruNiina
eaa3604dce
refactor: introduce value_t_constant
...
as an alias for integral_constant
2019-06-01 16:01:48 +09:00
ToruNiina
8acc348106
feat: 💥 change interface around types
...
- change value_t::typename from CamelCase to snake_case.
- drop CamelCase typename supports.
The changes are introduced to make the interfaces uniform. For some
(historical) reasons, toml11 has both CamelCase names and snake_case
names for types. Additionally, since `float` is a keyword, snake_case
names uses `floating` to avoid collision and CamelCase name uses `Float`
because toml official calls it `Float`. This is too confusing.
Since it is a major upgrade, I think it is a big chance to make them
uniform.
2019-06-01 13:33:57 +09:00
ToruNiina
2567f2a787
feat: add source_location for error message generation.
2019-06-01 13:25:02 +09:00
ToruNiina
84b5749c6b
feat: implement comment containers
2019-06-01 13:24:54 +09:00
ToruNiina
70d0049511
refactor: move some meta-funcs to traits.hpp
2019-06-01 12:35:40 +09:00
ToruNiina
717f5929c2
feat: use detail::none_t instead of char
...
Although the error value from combinators currently does not have any
information, it can have an information because it is a char value. It
is better to use no-information-type explicitly to make it clear that
it does not have any information. So I added none_t in toml::detai and
use it in combinators and parsers as an error value from combinators.
2019-05-31 17:07:52 +09:00
ToruNiina
81abb6c9d7
perf: remove err-msg from combinator
...
Generate error message in `parse_something()`, not in `lex_something`.
Since the error message generated by `lex_something` is too difficult to
read for humans, I've disabled the error message generation for the sake
of efficiency (it takes time to generate error message that will never
be read). I think now the error message generation itself safely can be
removed from combinators. At this stage, `lex_something` does not need
to return `result<T, E>` because all the error type would be discarded.
Now it is turned out that returing `optional<T>` from lex_* is enough.
Maybe later I would change the return type itself, but currently I
changed the error type from std::string to char because implementing
optional takes time and effort. It makes the parsing process a bit
faster.
2019-05-30 20:08:37 +09:00
ToruNiina
8bba3c8a14
refactor: use literal instead of empty string
...
so far, the error value of the lexer is just ignored because they are
not readable (results from all the nested combinator are concatenated,
so they are too redundant). those ones are replaced by a simple literal.
2019-05-30 19:33:25 +09:00
ToruNiina
b13e727b90
refactor: remove unused func, combinator::pattern
...
because it is not human-readable (too long and redundant)
2019-05-30 18:05:47 +09:00
ToruNiina
d352c9e66f
perf: suppress unused error message generation
2019-05-30 17:47:06 +09:00
ToruNiina
1633268d57
refactor: use snake_case typename only
2019-05-30 14:39:15 +09:00
ToruNiina
4dbd2cb9fe
refactor: use as_* to avoid needless checking
2019-05-29 21:22:32 +09:00
ToruNiina
65124a8d2e
refactor: use is_something instead of is(...)
...
to reduce the code size a bit
2019-05-29 21:20:22 +09:00
ToruNiina
1b78f161f5
refactor: use is_something/as_something in parser
...
this reduces the size of the code. And also it skips needless
double-checking, so we can expect it makes parsing a bit faster.
2019-05-29 21:18:17 +09:00
ToruNiina
0ce259ada0
refactor: split throw_bad_cast from value::cast
2019-05-29 21:06:25 +09:00
ToruNiina
74da49f87f
refactor: move switch_cast from inside of value
...
use as_something() instead of it. To realize this, the implementation of
as_something() is also changed. Now as_something does not depends on
`cast`. This reduces complexity around casting toml::value to other types.
2019-05-29 20:18:15 +09:00
Ivan Shynkarenka
db6f3d5d11
Fix Visual Studio 2019 warnings in pedantic compilation mode (/W4 /WX)
2019-05-10 14:58:22 +03:00
ToruNiina
87be890e07
feat: remove deprecated functions
2019-04-28 15:59:09 +09:00
ToruNiina
4cbbcd8f62
Merge branch 'master' into as-something
2019-04-27 19:04:44 +09:00
Toru Niina
a2631ecacb
Merge pull request #60 from ToruNiina/string-view
...
support std::string_view
2019-04-27 18:33:59 +09:00
ToruNiina
4bcc5e8375
Merge branch 'master' into as-something
2019-04-27 17:42:12 +09:00
ToruNiina
aa7b9a3965
refactor: rename as_floating -> as_float
...
Actually, since `floating` is used for toml::types, `as_floating`
seems to be clearer. But currently `is_*` functions uses `float`,
not `floating`, so `as_float` is chosen for the consistency.
In a future release, possibly v3, those names may need to be
re-considered for clarity.
2019-04-27 16:45:25 +09:00
ToruNiina
0d623856a7
feat: add value::as_something() for convenience
2019-04-27 16:22:23 +09:00
ToruNiina
01aa2ef5b2
feat: add ctor to value to init with string_view
2019-04-26 16:33:09 +09:00
ToruNiina
e460826084
feat: enable to get a comment related to a value
...
- comment_before(): get comments just before a value.
- comment_inline(): get a comment in the same line as a value.
- comment(): get comment_before() + comment_inline().
2019-04-25 22:32:39 +09:00
ToruNiina
aa3445f38c
feat: add functions to get comments around region
2019-04-25 22:32:18 +09:00
ToruNiina
408b7bf35e
Merge branch 'master' into string-view
2019-04-23 23:32:08 +09:00
ToruNiina
d061c33a16
feat: enable toml::get with std::string_view
2019-04-23 23:24:23 +09:00
ToruNiina
0c7d2d07d4
feat: do not consider string_view as a container
...
it is a kind of string.
2019-04-23 23:23:57 +09:00
ToruNiina
62cf4373bd
feat: conversion toml::string <-> string_view
2019-04-22 23:18:05 +09:00
ToruNiina
2d9b4992ec
fix: restrict length of underline by size of line
...
in some cases, `region` contains several lines and `region::size`
returns the whole size that is a sum of lengthes of all the lines.
To avoid too long underlines, restrict the length of underline by
the length of the line that is shown in the message.
2019-04-21 16:38:08 +09:00
ToruNiina
82e8c1e68b
fix: skip first ws/newlines in toml literal
...
when ""_toml literal is used with C++11 raw-string literal,
it normally starts with newline like the following.
```cpp
const auto v = u8R"(
[table]
key = "value"
)"_toml;
```
With this, the error message shows the first empty line that starts just
after `u8R"(` and thus the error message shows nothing. To avoid this,
skip the first empty lines and whitespaces in literal.
2019-04-21 16:31:24 +09:00
ToruNiina
46be054ce9
fix: improve err msg for multiline inline table
...
show "missing curly brace" instead of "missing table key-value separator"
2019-04-19 13:22:13 +09:00
ToruNiina
637c99d637
refactor: generate error message in parser
2019-04-18 15:09:58 +09:00
ToruNiina
0f48852730
perf: check value type before parsing
...
to avoid needless error message generation
2019-04-18 14:26:27 +09:00
ToruNiina
0499b2907d
Merge branch 'master' into optimization
2019-04-18 14:10:08 +09:00
ToruNiina
61e69c9251
fix: count line number from 1, not 0
2019-04-18 13:56:19 +09:00
ToruNiina
4a560ea1e5
fix: show correct error message
2019-04-18 00:04:33 +09:00