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