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
ToruNiina
04854f9d21
stop having begin/end iterator in region/location
2018-12-09 00:00:15 +09:00
ToruNiina
e05d0bdb84
stop using distance(next(iter), last)
...
under some condition, it causes serious error.
2018-12-06 20:13:06 +09:00
ToruNiina
aa05858de3
add source_name to location/region to show filename
...
now error message prints the filename
2018-12-05 16:55:31 +09:00
ToruNiina
679e282e23
make variables in region/location read-only
...
to avoid modifying mistakenly
2018-12-03 00:10:26 +09:00
ToruNiina
59588e3a10
add static_assert and useful member funcs
2018-12-02 23:22:27 +09:00
ToruNiina
8bf97d8a00
add constructors that receive range to region
2018-12-02 23:04:49 +09:00
ToruNiina
2ee8ffab21
add begin/end to region
2018-12-02 21:54:39 +09:00
ToruNiina
9c1bfbd5eb
make region::source immutable
2018-12-02 21:03:08 +09:00
ToruNiina
c38b9b7dc7
add region and location to represent tokens
...
location is almost same as an Iterator, but having shared_ptr that points
the content. region is almost same as a range. by adding pointer to the
content source, utility function to show the error message can be
implemented easier. it is expected that this also makes easy to show
error messages after parse (e.g., in the case of bad_get)
2018-12-02 20:52:04 +09:00