ToruNiina
b8291af42b
fix: rename func args to avoid -Wshadow in GCC 4.x
2021-05-10 22:56:16 +09:00
ToruNiina
1ead14589e
fix: check if it is empty before calling back()
2020-11-04 23:24:02 +09:00
ToruNiina
32a5341d09
refactor: use source_location, not region_base*
2020-07-27 22:29:18 +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
ToruNiina
75999aa9ad
refactor: add a constructor to location
...
By adding the constructor, vec() would not be not needed. But inserting
Container = std::string makes the constructor ambiguous, so it breaks
the current code.
2020-07-21 20:53:44 +09:00
ToruNiina
b461f363da
refactor: add a method to reduce complexity later
2020-07-20 19:40:55 +09:00
ToruNiina
761e576991
fix: workaround for windows.h that defines min/max
...
related to #123
2020-07-10 15:07:13 +09:00
ToruNiina
128b66bda9
refactor: add missing whitespace
2020-02-29 22:54:50 +09:00
Jordan Williams
3b6417de00
fix clang range-loop-analysis warnings
2020-02-11 06:13:55 -06:00
ToruNiina
c199bd8b49
feat: enable to access the 1st char of region
2019-12-19 22:13:33 +09:00
ToruNiina
d3513c0f84
fix: fmt line num in err msg correctly
2019-12-17 19:35:26 +09:00
ToruNiina
4688c235f5
refactor: rename internal macro value
2019-12-12 17:38:29 +09:00
ToruNiina
2fd466a3c3
fix: skip only the prefix, keep spaces
2019-11-14 15:32:17 +09:00
ToruNiina
f290390c63
fix: consider the no-space cases like [error]:
2019-11-13 18:14:42 +09:00
ToruNiina
bbe33e87d9
feat: detect [error] prefix duplication
2019-11-13 18:05:37 +09:00
ToruNiina
4c5076f263
feat: add runtime colorize flag
2019-11-13 18:01:47 +09:00
ToruNiina
87bebbc37d
feat: put color to the internal error messages
2019-11-13 17:35:05 +09:00
ToruNiina
56812114c3
refactor: simplify inclusion dependencies
2019-10-31 21:58:28 +09:00
ToruNiina
0cee58b0b1
Merge branch 'v3' of github.com:ToruNiina/toml11 into v3
2019-06-21 14:31:52 +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
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
262f9c5fcc
fix: avoid duplicating comment: array/table elems
2019-06-18 01:26:40 +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
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
d30700517d
fix: add missing include file
2019-06-01 19:43:35 +09:00
ToruNiina
f04c97b587
refactor: simplify format_underline a bit
2019-06-01 19:06:08 +09:00
ToruNiina
aa3445f38c
feat: add functions to get comments around region
2019-04-25 22:32:18 +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
61e69c9251
fix: count line number from 1, not 0
2019-04-18 13:56:19 +09:00
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
f40fd12e25
refactor: add and rewrite comments
2019-03-18 11:09:12 +09:00
ToruNiina
fd063af7ce
refactor: make include guard style uniform
2019-03-16 14:19:47 +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
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
ToruNiina
13c1f9c259
output filename of the second value2 if different
...
in format_error.
2018-12-17 18:07:57 +09:00
ToruNiina
fd21d5dd95
add simplest copyright notice
2018-12-13 20:44:10 +09:00
ToruNiina
e5c29c2870
enable to show err msg for 2 different location
2018-12-13 17:07:03 +09:00
ToruNiina
c69969733f
use carriage return depending on env
2018-12-12 23:22:31 +09:00
ToruNiina
fc6a15440d
enable format_underline to print hint with region
2018-12-11 22:22:07 +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
ac3025d92f
change default return value of region_base
2018-12-09 13:39:13 +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