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
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
ToruNiina
e79069cc47
enable to show err msg for invalid insertion
...
like, with the following (invalid) toml file
> a.b = "value"
> a.b.c = 42
The error message becomes
> terminate called after throwing an instance of 'toml::syntax_error'
> what(): [error] toml::insert_value: target (a.b) is neither table nor
> an array of tables
> --> example.toml
> 1 | a.b = "value"
> | ~~~~~~~ actual type is string
> ...
> 2 | a.b.c = 42
> | ~~ inserting this
2018-12-13 17:09:38 +09:00
ToruNiina
acc7b7870f
remove format_error_for_value and add get_region instead
...
it is convenient to have get_region function that can access region_info
in toml::value. get_region is placed in toml::detail and made friend of
toml::value because I don't want to make toml::value::region_info public
and keep it internal use only.
2018-12-13 16:13:05 +09:00
ToruNiina
47cd6f5a41
remove redundant error message
2018-12-12 23:17:28 +09:00
ToruNiina
5aae0b17c8
change error message; require unicode codepoint
...
before this, it recommends the range that can be represented by utf-8
but the range of valid unicode codepoint is narrower than that. for
error message, it is good to recommend valid unicode codepoint.
2018-12-12 19:14:27 +09:00
ToruNiina
0f83ee6039
change temporaly loc from token to copy of loc
...
location constructed from token string does not has correct line number
information. to show an informative error message about UTF-8 and escape
sequences, parse_(ml_)basic_string requires those information that can
only be given from root location<Container>.
2018-12-12 19:12:23 +09:00
ToruNiina
879b7d3bff
improve format of error message for utf-8
2018-12-12 19:01:22 +09:00
ToruNiina
bcaf5baf88
fix parse_array_of_table_key
...
allow whitespace before and after [[ and ]] (like, [[ a.b ]])
2018-12-12 12:14:11 +09:00
ToruNiina
a1a81089c5
skip whitespace before/inside/after dotted-keys
2018-12-12 01:30:47 +09:00
ToruNiina
d7bba10fa3
improve error message in parse_key_value_pair
2018-12-11 22:21:22 +09:00
ToruNiina
247bcb0714
show error message for inhomogenous array
2018-12-11 22:17:28 +09:00
ToruNiina
27b9334f10
skip BOM if exists
2018-12-11 21:40:48 +09:00
ToruNiina
4e57c5f5df
improve error message for invalid line
...
like a = 12 = true, newline is expected after 12
2018-12-10 21:43:02 +09:00
ToruNiina
ff83a6a477
remove redundant part of error messages
2018-12-10 21:42:56 +09:00
ToruNiina
ff19c9f492
add corresponding region to each value
2018-12-10 15:57:17 +09:00
ToruNiina
8e18aa9b16
add toml::parse
2018-12-10 00:14:46 +09:00
ToruNiina
ed155a5040
remove help msgs in parse_value
...
because the error message becomes too long
2018-12-09 21:54:47 +09:00
ToruNiina
cf03a08632
re-write parser using result and new value
...
wip.
2018-12-09 19:32:30 +09:00
ToruNiina
6c0a12148b
add result<T, E> struct to handle errors
...
aiming later updates and refactoring of parsers
2018-12-02 18:01:37 +09:00
ToruNiina
5aeb6f24df
change exception type #8 ; iterator may be invalid
2017-12-24 11:02:32 +09:00
ToruNiina
3f1b431ee2
add missing inline
specifier #7
2017-12-15 21:39:38 +09:00
ToruNiina
d1fd42ff7e
output line number if error occured
2017-06-17 19:05:24 +09:00
ToruNiina
80adda8184
open file with binary mode
2017-05-17 14:12:19 +09:00
ToruNiina
2c92142d5c
restore parser and test
2017-05-17 14:07:34 +09:00
ToruNiina
d77ec7dc88
restore old parse function
2017-05-17 13:21:32 +09:00
ToruNiina
430940f766
fix typos
2017-05-17 13:12:21 +09:00
ToruNiina
1fc58095fa
use wstring_convert (but is deprecated in c++17)
2017-05-17 13:08:24 +09:00
ToruNiina
5ffc51a99d
experimentally use wchar and wstring in parser.hpp
2017-05-17 13:04:36 +09:00
ToruNiina
1265952b97
split parsing unicode file
2017-05-17 12:54:13 +09:00
ToruNiina
89c1094a69
set binary flag..
2017-05-17 12:15:39 +09:00
ToruNiina
d65642ddf6
add locale settings
2017-05-17 11:45:27 +09:00
ToruNiina
9e9a5a7253
fix typo
2017-05-17 10:55:22 +09:00
ToruNiina
fe6a38737d
add Iterator pointing to the end of a range
2017-05-16 22:12:32 +09:00
Luthaf
40da3f54d5
Fix missing include
2017-05-16 14:09:46 +02:00
ToruNiina
f52b78010c
fix array_of_table assignments
2017-05-12 22:28:49 +09:00
ToruNiina
1c26ffe3ae
add parse() function
2017-05-12 20:49:47 +09:00
ToruNiina
fd58cc507f
add parse_data
2017-05-11 19:36:12 +09:00
ToruNiina
6ab05a8594
change impl of parser of values
2017-05-11 15:09:11 +09:00
ToruNiina
855cbe5aff
add operator= and ctor for result
2017-05-11 15:08:38 +09:00
ToruNiina
f5d301016f
add parser impl for integer, float, boolean
2017-05-11 00:14:22 +09:00
ToruNiina
88e2c3fe48
change impl of parser: optional based
2017-05-10 23:56:09 +09:00
ToruNiina
acfc706e0c
fix some small mistakes
2017-05-10 11:16:22 +09:00
ToruNiina
bf7461f7b4
fix parsing order of toml::value
2017-05-08 19:16:54 +09:00
ToruNiina
29fe377438
add parser for tables
2017-05-08 19:08:49 +09:00
ToruNiina
d1814d3922
fix arguments
2017-05-08 19:08:30 +09:00