ToruNiina
6f950c9ec8
perf: cache current line number in location
...
`location::line_num()` function used to be implemented by using
`std::count`, so each time the parser encounters a type mismatch,
`std::count` was called with almost whole file. It decelerates the
parsing process too much, so I decided to add `line_number_` member
variable to `location` and add `advance/retrace/reset` to `location`
in order to modify the position that is pointed.
2019-04-12 18:32:46 +09:00
ToruNiina
ea13e40889
feat: add static_assert for location/range
...
to check the container is randomly-accessible
2019-04-12 18:00:53 +09:00
ToruNiina
595fb1aef3
refactor: remove unused function parameter names
2019-04-06 19:39:13 +09:00
ToruNiina
5aebd6b562
fix: restore the back compat of format_error
...
the following code was okay in the last release
```
toml::format_error("[test]", v, "test", {"hint1", "hint2"})
```
but was not okay in the current master. This commit fixes this.
cons: By this, the number of values to show is limited upto 3.
2019-03-20 20:46:22 +09:00
ToruNiina
4c13085b35
fix: add stream operator for toml::table
2019-03-20 19:30:08 +09:00
Toru Niina
65b10b6537
Merge pull request #46 from ToruNiina/toml-literal
...
feat: add ""_toml literal
2019-03-20 10:12:56 +09:00
ToruNiina
20ba57e389
fix: add missing const specifier to some of get()s
2019-03-20 00:37:13 +09:00
ToruNiina
40ccf1d912
feat: add argument to control top-level inlinization
2019-03-19 23:25:26 +09:00
ToruNiina
982ae36428
feat: add ""_toml literal
2019-03-19 21:34:57 +09:00
ToruNiina
d6714ec450
feat: detect value type and format as a file
...
in toml::format
2019-03-19 21:24:51 +09:00
ToruNiina
7a0ecf977d
feat: add find_or(table, key, fallback)
...
get_or(value, fallback) is still ok, but get_or(table, key, fallback)
is now deprecated.
2019-03-18 17:44:03 +09:00
ToruNiina
aade704411
refactor: remove needless overload of get_or
2019-03-18 17:10:18 +09:00
ToruNiina
ca3f6102ef
fix: correctly resolve overloads of get_or
2019-03-18 16:44:36 +09:00
ToruNiina
4a58b629ce
feat: add a way to check arg is "string literal"
2019-03-18 16:31:12 +09:00
ToruNiina
3adba237b8
feat: enable to show message for deprecated()
2019-03-18 16:28:27 +09:00
ToruNiina
f40fd12e25
refactor: add and rewrite comments
2019-03-18 11:09:12 +09:00
ToruNiina
65c2c3c238
fix: correctly deduce return value of visitor
2019-03-18 10:53:04 +09:00
ToruNiina
891a61a5e3
fix: do not move array element without checking
2019-03-18 02:05:55 +09:00
ToruNiina
243f43fafd
Merge branch 'master' into hotfix
2019-03-17 21:16:37 +09:00
ToruNiina
66e27a94b6
fix: simplify and correct the format of timezone
2019-03-17 21:14:17 +09:00
Toru Niina
f3e3000d45
Merge pull request #40 from ToruNiina/remove-to-toml
...
refactor: remove to_toml and related tests
2019-03-17 13:12:30 +09:00
Toru Niina
f7380c6e32
Merge pull request #39 from ToruNiina/throw-incorrect-unicode
...
Throw syntax_error when parser encounter an incorrect utf-8 codepoint
2019-03-17 13:12:16 +09:00
Toru Niina
d86870e038
Merge pull request #38 from ToruNiina/get-any-type
...
extended conversions
2019-03-17 13:11:59 +09:00
Toru Niina
0908806915
Merge pull request #33 from ToruNiina/is-something
...
add `is_boolean` and other stuffs like that
2019-03-16 23:55:01 +09:00
ToruNiina
d17c192681
refactor: remove to_toml and related tests
2019-03-16 17:05:58 +09:00
ToruNiina
43014c6619
fix: remove redefined default template argument
2019-03-16 16:24:10 +09:00
ToruNiina
04bfeba3f2
merge branch master into get-any-type
2019-03-16 15:58:18 +09:00
ToruNiina
190636b791
fix: support getting a container of external types
2019-03-16 15:52:22 +09:00
ToruNiina
b1b72a94a8
feat: support conversion with external types
2019-03-16 14:44:04 +09:00
ToruNiina
6929bcdf78
feat: add from<T> and into<T>
2019-03-16 14:27:05 +09:00
ToruNiina
fd063af7ce
refactor: make include guard style uniform
2019-03-16 14:19:47 +09:00
ToruNiina
df6dcbc4ed
feat: check a class has from/into_toml member fn
...
to support better serialization
2019-03-16 14:16:31 +09:00
ToruNiina
9b8db6a225
fix: remove extraneous null character after float
...
the bug was introduced by snprintf
2019-03-15 19:30:36 +09:00
ToruNiina
76863cb27f
refactor: simplify branches about utf8 codepoint
2019-03-15 17:48:47 +09:00
ToruNiina
514df99e40
feat: consider invalid UTF-8 as syntax_error
...
the following codepoints are considered to be a syntax_error
- [0xD800, 0xDFFF]
- larger than 0x10FFFF
2019-03-15 17:39:31 +09:00
ToruNiina
055353a460
chore: merge branch 'master' into is-something
2019-03-15 17:25:17 +09:00
ToruNiina
a04544637b
feat: mark to_toml as deprecated
...
because the constructor of `toml::value()` supports all the stuff that
are supported by `to_toml`.
2019-03-15 14:29:32 +09:00
ToruNiina
61dfa4a2dc
feat: format any number of values into an err msg
...
```cpp
toml::format_error("[error] message", v1, "v1", v2, "v2", ...);
```
2019-03-15 12:38:37 +09:00
ToruNiina
0babe8d589
fix: use format_underline for N regions everywhere
2019-03-14 00:59:10 +09:00
ToruNiina
5b2ce26721
refactor: remove redundant function
...
since N region format_underline() has been implemented, overloads for 1
and 2 region(s) are not needed.
2019-03-14 00:56:35 +09:00
ToruNiina
74ceceef73
fix: suppress warning about sign-unsign comparison
...
The solution is not ideal, but it's okay at the line
2019-03-13 14:03:04 +09:00
ToruNiina
46b35870c5
style: remove needless type casting
2019-03-13 01:17:27 +09:00
ToruNiina
dddcecb034
fix: use snprintf instead of stringstream
...
to avoid the effect of locale
2019-03-12 23:37:46 +09:00
ToruNiina
dc112bd6c1
feat: add is_[boolean|integer|...]() member func
...
it is an alias to is<toml::value_t::[Boolean|Integer|...]>
2019-03-12 20:43:07 +09:00
ToruNiina
d90ffb63c6
Merge branch 'master' into allow-deeper-table-before
2019-03-05 23:27:11 +09:00
ToruNiina
b0ed122214
fix: allow deeper table appeared before
...
allow the following toml file.
```toml
[a.b.c]
d = 10
[a]
e = 2.718
```
2019-03-05 23:25:25 +09:00
ToruNiina
d88521d63c
feat: enable to change region of value
...
To allow the following toml file, we need to replace the region after
the more precise region is found.
```toml
[a.b.c]
d = 42
[a]
e = 2.71
```
If the precise region (here, [a]) is found, the region of `a` should be
`[a]`, not `[a.b.c]`. After `[a]` is defined, toml does not allow to
write `[a]` twice. To check it, we need to replace the region of values
to the precise one.
2019-03-04 15:01:28 +09:00
ToruNiina
2accc9d22c
fix: diagnose, but not throw for unicode error
...
in 2.0.x and 2.1.0, README says "it shows warning" for invalid unicode
codepoints. So far, this library just show an error message in stderr
for this case. It is not good to change the behavior fatal in the next
minor release, 2.1.1, that includes patches and improved error msgs.
I will make it throw syntax_error after 2.2.0 for invalid unicode
codepoints. For now, I will keep it to be "warning".
2019-03-03 18:56:45 +09:00
ToruNiina
ae793fb631
feat: improve error message for invalid array
2019-03-02 17:56:16 +09:00
ToruNiina
944b83642a
feat: make location to inherit region_base
...
To generate error message, it is better to have the same interface.
Also, location can be considered as a region having only one character.
2019-03-02 17:52:00 +09:00