ToruNiina
b36fdf2f54
refactor: remove internal fn not needed any more
...
The function was needed to copy region information from value to value,
for a useful error message. Because of the last few commits, the region
information about keys are passed to insert_nested_keys that requires
the function which is removed. And it turned out that the function is no
longer required. It is originally a workaround, so I removed it.
2019-02-27 01:07:00 +09:00
ToruNiina
73ba6b385f
feat: use key-region to represent table
...
use x.y.z = 42
~~~ here as the region of the table `x.y`
2019-02-27 01:02:39 +09:00
ToruNiina
30d1639aa4
refactor: return region info from parse_kvpair
2019-02-27 00:21:05 +09:00
ToruNiina
679b365cf7
feat: get region info when parsing keys
...
Error messages related to dotted keys looks weird. like:
1 | a.b.c = 42
| ~~ in this table
The underlined token is not a table. This should be like the following.
1 | a.b.c = 42
| ~~~ in this table
To implement this, the region information is needed when the keys are
read. This commit add this functionality, though currently the region
information is not used yet.
2019-02-26 00:17:28 +09:00
ToruNiina
83bf83b6dd
style: add braces to if and remove additional else
2019-02-19 02:56:15 +09:00
ToruNiina
321364c7c2
fix: format char in an error message correctly
2019-02-19 02:46:48 +09:00
ToruNiina
2dd0a78c52
fix: reset stream width before printing
...
without this, the first line of the serialized result becomes too wide
2019-02-16 23:55:19 +09:00
Toru Niina
d7b8c3c78f
Merge pull request #18 from ToruNiina/threadsafe-localtime
...
add threadsafe localtime_(s|r)
2019-02-16 23:28:48 +09:00
ToruNiina
a00a906482
fix: add comma at correct position
2019-02-14 16:17:32 +09:00
ToruNiina
19ad7d7c96
fix: remove needless empty line from serialization
2019-02-14 16:17:04 +09:00
ToruNiina
251e55da42
fix: don't ignore std::setw(0)
2019-02-14 15:49:27 +09:00
ToruNiina
32f1b2060a
fix: avoid width overflow
2019-02-14 15:49:13 +09:00
ToruNiina
b1c54532df
feat: improve array serialization
...
- make multiline array more clean
- short-circuit for empty array
2019-02-14 15:48:05 +09:00
ToruNiina
38c67f16e8
fix: initialize float precition correctly
2019-02-14 15:47:00 +09:00
ToruNiina
31193d99ba
Merge branch 'master' into serialize
2019-02-13 23:16:39 +09:00
ToruNiina
dd9319245e
fix: open file as binary-mode #16
...
to avoid inconsistency between file size (obtained by tellg) and the
size of the actual contents that would be read later
2019-02-13 19:18:09 +09:00
ToruNiina
5bdc022627
fix: correctly serialize quoted keys
2019-02-13 13:51:08 +09:00
ToruNiina
41e354f1ee
supress warnings while skipping switch-cases
2019-02-13 13:50:33 +09:00
ToruNiina
d1c76709b0
add serializer #23
2019-02-13 13:37:58 +09:00
ToruNiina
64774a8db0
add toml::visit to use it in serializer
2019-02-13 13:36:55 +09:00
ToruNiina
53f6b8268b
fix: compare offset_datetime correctly
2019-02-13 13:34:26 +09:00
ToruNiina
32dcc35918
move return_type_of_t from result to traits
2019-02-13 13:34:03 +09:00
Quentin Khan
1dfe32acd8
Fix multiple definition error
2019-01-30 17:06:23 +01:00
Toru Niina
5dfdbe4bff
Merge pull request #20 from ToruNiina/format-error
...
add an extra parameter `hints` to format_error
2018-12-27 20:34:53 +09:00
ToruNiina
aa67069387
move hints to the internal function
2018-12-27 16:32:20 +09:00
ToruNiina
ee3424ad51
add an extra parameter hints
to format_error
2018-12-27 16:26:23 +09:00
ToruNiina
17def14ab6
add default template arg to toml::find
...
in most of the use cases, toml::value is used (to show error message).
2018-12-27 15:58:50 +09:00
ToruNiina
51dd3abcae
remove one branch by preprocessor
...
since localtime in windows is already thread-safe, there are no need to
change the function.
2018-12-26 13:38:01 +09:00
ToruNiina
825b2c30a1
add threadsafe localtime_(s|r)
2018-12-25 22:40:52 +09:00
Toru Niina
b5b8830c29
Merge pull request #17 from ToruNiina/hotfix
...
fix the error with BOM and end of file w/o newline
2018-12-24 16:37:10 +09:00
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
7c03c446fe
speedup by removing needless format_underline
...
drastical speedup for long toml files
2018-12-23 15:22:12 +09:00
ToruNiina
5546b3389d
Merge branch 'master' into error-message
2018-12-22 17:55:59 +09:00
ToruNiina
9c95992dad
fix error message for empty value
2018-12-22 17:44:09 +09:00
ToruNiina
c63ac7e435
detect syntax_error; appending array-of-tables
...
toml file like the following is explicitly prohibited.
a = [{b = 1}]
[[a]]
b = 2
this commit detects this kind of syntax-error while parsing toml file
2018-12-22 17:07:06 +09:00
ToruNiina
fec49aaaa3
fix error message: add missing spaces
2018-12-22 17:06:36 +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