mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-17 00:38:08 +08:00
Spelling fixes
This commit is contained in:
14
README.md
14
README.md
@@ -251,7 +251,7 @@ See also [underlying types](#underlying-types).
|
|||||||
**NOTE**: For some technical reason, automatic conversion between `integer` and
|
**NOTE**: For some technical reason, automatic conversion between `integer` and
|
||||||
`floating` is not supported. If you want to get a floating value even if a value
|
`floating` is not supported. If you want to get a floating value even if a value
|
||||||
has integer value, you need to convert it manually after obtaining a value,
|
has integer value, you need to convert it manually after obtaining a value,
|
||||||
like the followings.
|
like the following.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
const auto vx = toml::find(data, "x");
|
const auto vx = toml::find(data, "x");
|
||||||
@@ -905,7 +905,7 @@ toml::visit([](const auto& val) -> void {
|
|||||||
```
|
```
|
||||||
|
|
||||||
The function object that would be passed to `toml::visit` must be able to
|
The function object that would be passed to `toml::visit` must be able to
|
||||||
recieve all the possible TOML types. Also, the result types should be the same
|
receive all the possible TOML types. Also, the result types should be the same
|
||||||
each other.
|
each other.
|
||||||
|
|
||||||
## Constructing a toml::value
|
## Constructing a toml::value
|
||||||
@@ -988,7 +988,7 @@ or macro definition.
|
|||||||
This feature is controlled by template parameter in `toml::basic_value<...>`.
|
This feature is controlled by template parameter in `toml::basic_value<...>`.
|
||||||
`toml::value` is an alias of `toml::basic_value<...>`.
|
`toml::value` is an alias of `toml::basic_value<...>`.
|
||||||
|
|
||||||
If template paramter is explicitly specified, the return value of `toml::parse`
|
If template parameter is explicitly specified, the return value of `toml::parse`
|
||||||
will be `toml::basic_value<toml::preserve_comments>`.
|
will be `toml::basic_value<toml::preserve_comments>`.
|
||||||
If the macro is defined, the alias `toml::value` will be
|
If the macro is defined, the alias `toml::value` will be
|
||||||
`toml::basic_value<toml::preserve_comments>`.
|
`toml::basic_value<toml::preserve_comments>`.
|
||||||
@@ -1618,7 +1618,7 @@ it uses [ANSI escape code](https://en.wikipedia.org/wiki/ANSI_escape_code).
|
|||||||
Without `TOML11_COLORIZE_ERROR_MESSAGE`, you can still colorize user-defined
|
Without `TOML11_COLORIZE_ERROR_MESSAGE`, you can still colorize user-defined
|
||||||
error message by passing `true` to the `toml::format_error` function.
|
error message by passing `true` to the `toml::format_error` function.
|
||||||
If you define `TOML11_COLORIZE_ERROR_MESSAGE`, the value is `true` by default.
|
If you define `TOML11_COLORIZE_ERROR_MESSAGE`, the value is `true` by default.
|
||||||
If not, the defalut value would be `false`.
|
If not, the default value would be `false`.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
std::cerr << toml::format_error("[error] value should be positive",
|
std::cerr << toml::format_error("[error] value should be positive",
|
||||||
@@ -1719,7 +1719,7 @@ const std::string fmt = toml::format(v);
|
|||||||
```
|
```
|
||||||
|
|
||||||
To control the width and precision, `toml::format` receives optional second and
|
To control the width and precision, `toml::format` receives optional second and
|
||||||
third arguments to set them. By default, the witdh is 80 and the precision is
|
third arguments to set them. By default, the width is 80 and the precision is
|
||||||
`std::numeric_limits<double>::max_digit10`.
|
`std::numeric_limits<double>::max_digit10`.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
@@ -1755,7 +1755,7 @@ flag that represents a kind of a string, `string_t::basic` and `string_t::litera
|
|||||||
Although `std::string` is not an exact toml type, still you can get a reference
|
Although `std::string` is not an exact toml type, still you can get a reference
|
||||||
that points to internal `std::string` by using `toml::get<std::string>()` for convenience.
|
that points to internal `std::string` by using `toml::get<std::string>()` for convenience.
|
||||||
The most important difference between `std::string` and `toml::string` is that
|
The most important difference between `std::string` and `toml::string` is that
|
||||||
`toml::string` will be formatted as a TOML string when outputed with `ostream`.
|
`toml::string` will be formatted as a TOML string when outputted with `ostream`.
|
||||||
This feature is introduced to make it easy to write a custom serializer.
|
This feature is introduced to make it easy to write a custom serializer.
|
||||||
|
|
||||||
`Datetime` variants are `struct` that are defined in this library.
|
`Datetime` variants are `struct` that are defined in this library.
|
||||||
@@ -1906,7 +1906,7 @@ I appreciate the help of the contributors who introduced the great feature to th
|
|||||||
- Intel Compiler support
|
- Intel Compiler support
|
||||||
- Quentin Khan (@xaxousis)
|
- Quentin Khan (@xaxousis)
|
||||||
- Found & Fixed a bug around ODR
|
- Found & Fixed a bug around ODR
|
||||||
- Improved error messages for invaild keys to show the location where the parser fails
|
- Improved error messages for invalid keys to show the location where the parser fails
|
||||||
- Petr Beneš (@wbenny)
|
- Petr Beneš (@wbenny)
|
||||||
- Fixed warnings on MSVC
|
- Fixed warnings on MSVC
|
||||||
- Ivan Shynkarenka (@chronoxor)
|
- Ivan Shynkarenka (@chronoxor)
|
||||||
|
@@ -29,7 +29,7 @@ namespace detail
|
|||||||
// to output character as an error message.
|
// to output character as an error message.
|
||||||
inline std::string show_char(const char c)
|
inline std::string show_char(const char c)
|
||||||
{
|
{
|
||||||
// It supress an error that occurs only in Debug mode of MSVC++ on Windows.
|
// It suppresses an error that occurs only in Debug mode of MSVC++ on Windows.
|
||||||
// I'm not completely sure but they check the value of char to be in the
|
// I'm not completely sure but they check the value of char to be in the
|
||||||
// range [0, 256) and some of the COMPLETELY VALID utf-8 character sometimes
|
// range [0, 256) and some of the COMPLETELY VALID utf-8 character sometimes
|
||||||
// has negative value (if char has sign). So here it re-interprets c as
|
// has negative value (if char has sign). So here it re-interprets c as
|
||||||
|
@@ -346,7 +346,7 @@ operator+(const empty_iterator<T, C>& lhs, typename empty_iterator<T, C>::differ
|
|||||||
//
|
//
|
||||||
// Why this is chose as the default type is because the last version (2.x.y)
|
// Why this is chose as the default type is because the last version (2.x.y)
|
||||||
// does not contain any comments in a value. To minimize the impact on the
|
// does not contain any comments in a value. To minimize the impact on the
|
||||||
// efficiency, this is choosed as a default.
|
// efficiency, this is chosen as a default.
|
||||||
//
|
//
|
||||||
// To reduce the memory footprint, later we can try empty base optimization (EBO).
|
// To reduce the memory footprint, later we can try empty base optimization (EBO).
|
||||||
struct discard_comments
|
struct discard_comments
|
||||||
|
@@ -166,7 +166,7 @@ using lex_basic_string = sequence<lex_quotation_mark,
|
|||||||
// | ^- expected newline, but got '"'.
|
// | ^- expected newline, but got '"'.
|
||||||
// ```
|
// ```
|
||||||
// As a quick workaround for this problem, `lex_ml_basic_string_delim` was
|
// As a quick workaround for this problem, `lex_ml_basic_string_delim` was
|
||||||
// splitted into two, `lex_ml_basic_string_open` and `lex_ml_basic_string_close`.
|
// split into two, `lex_ml_basic_string_open` and `lex_ml_basic_string_close`.
|
||||||
// `lex_ml_basic_string_open` allows only `"""`. `_close` allows 3-5 `"`s.
|
// `lex_ml_basic_string_open` allows only `"""`. `_close` allows 3-5 `"`s.
|
||||||
// In parse_ml_basic_string() function, the trailing `"`s will be attached to
|
// In parse_ml_basic_string() function, the trailing `"`s will be attached to
|
||||||
// the string body.
|
// the string body.
|
||||||
|
@@ -870,7 +870,7 @@ parse_local_datetime(location& loc)
|
|||||||
{
|
{
|
||||||
throw internal_error(format_underline(
|
throw internal_error(format_underline(
|
||||||
"toml::parse_local_datetime: invalid datetime format",
|
"toml::parse_local_datetime: invalid datetime format",
|
||||||
{{source_location(inner_loc), "invalid time fomrat"}}),
|
{{source_location(inner_loc), "invalid time format"}}),
|
||||||
source_location(inner_loc));
|
source_location(inner_loc));
|
||||||
}
|
}
|
||||||
return ok(std::make_pair(
|
return ok(std::make_pair(
|
||||||
@@ -1367,7 +1367,7 @@ insert_nested_key(typename Value::table_type& root, const Value& v,
|
|||||||
// b = 54
|
// b = 54
|
||||||
// ```
|
// ```
|
||||||
// Here, from the type information, these cannot be detected
|
// Here, from the type information, these cannot be detected
|
||||||
// bacause inline table is also a table.
|
// because inline table is also a table.
|
||||||
// But toml v0.5.0 explicitly says it is invalid. The above
|
// But toml v0.5.0 explicitly says it is invalid. The above
|
||||||
// array-of-tables has a static size and appending to the
|
// array-of-tables has a static size and appending to the
|
||||||
// array is invalid.
|
// array is invalid.
|
||||||
@@ -1417,7 +1417,7 @@ insert_nested_key(typename Value::table_type& root, const Value& v,
|
|||||||
// ```toml
|
// ```toml
|
||||||
// # comment 1
|
// # comment 1
|
||||||
// aot = [
|
// aot = [
|
||||||
// # coment 2
|
// # comment 2
|
||||||
// {foo = "bar"},
|
// {foo = "bar"},
|
||||||
// ]
|
// ]
|
||||||
// ```
|
// ```
|
||||||
@@ -1904,7 +1904,7 @@ parse_table_key(location& loc)
|
|||||||
source_location(inner_loc));
|
source_location(inner_loc));
|
||||||
}
|
}
|
||||||
|
|
||||||
// after [table.key], newline or EOF(empty table) requried.
|
// after [table.key], newline or EOF(empty table) required.
|
||||||
if(loc.iter() != loc.end())
|
if(loc.iter() != loc.end())
|
||||||
{
|
{
|
||||||
using lex_newline_after_table_key =
|
using lex_newline_after_table_key =
|
||||||
@@ -1961,7 +1961,7 @@ parse_array_table_key(location& loc)
|
|||||||
source_location(inner_loc));
|
source_location(inner_loc));
|
||||||
}
|
}
|
||||||
|
|
||||||
// after [[table.key]], newline or EOF(empty table) requried.
|
// after [[table.key]], newline or EOF(empty table) required.
|
||||||
if(loc.iter() != loc.end())
|
if(loc.iter() != loc.end())
|
||||||
{
|
{
|
||||||
using lex_newline_after_table_key =
|
using lex_newline_after_table_key =
|
||||||
@@ -2252,7 +2252,7 @@ basic_value<Comment, Table, Array> parse(const std::string& fname)
|
|||||||
// Without this, both parse(std::string) and parse(std::filesystem::path)
|
// Without this, both parse(std::string) and parse(std::filesystem::path)
|
||||||
// matches to parse("filename.toml"). This breaks the existing code.
|
// matches to parse("filename.toml"). This breaks the existing code.
|
||||||
//
|
//
|
||||||
// This function exactly matches to the invokation with c-string.
|
// This function exactly matches to the invocation with c-string.
|
||||||
// So this function is preferred than others and the ambiguity disappears.
|
// So this function is preferred than others and the ambiguity disappears.
|
||||||
template<typename Comment = TOML11_DEFAULT_COMMENT_STRATEGY,
|
template<typename Comment = TOML11_DEFAULT_COMMENT_STRATEGY,
|
||||||
template<typename ...> class Table = std::unordered_map,
|
template<typename ...> class Table = std::unordered_map,
|
||||||
|
@@ -854,7 +854,7 @@ template<typename charT, typename traits>
|
|||||||
std::basic_ostream<charT, traits>&
|
std::basic_ostream<charT, traits>&
|
||||||
nocomment(std::basic_ostream<charT, traits>& os)
|
nocomment(std::basic_ostream<charT, traits>& os)
|
||||||
{
|
{
|
||||||
// by default, it is zero. and by defalut, it shows comments.
|
// by default, it is zero. and by default, it shows comments.
|
||||||
os.iword(detail::comment_index(os)) = 1;
|
os.iword(detail::comment_index(os)) = 1;
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
@@ -863,7 +863,7 @@ template<typename charT, typename traits>
|
|||||||
std::basic_ostream<charT, traits>&
|
std::basic_ostream<charT, traits>&
|
||||||
showcomment(std::basic_ostream<charT, traits>& os)
|
showcomment(std::basic_ostream<charT, traits>& os)
|
||||||
{
|
{
|
||||||
// by default, it is zero. and by defalut, it shows comments.
|
// by default, it is zero. and by default, it shows comments.
|
||||||
os.iword(detail::comment_index(os)) = 0;
|
os.iword(detail::comment_index(os)) = 0;
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
@@ -880,7 +880,7 @@ operator<<(std::basic_ostream<charT, traits>& os, const basic_value<C, M, V>& v)
|
|||||||
const int fprec = static_cast<int>(os.precision());
|
const int fprec = static_cast<int>(os.precision());
|
||||||
os.width(0);
|
os.width(0);
|
||||||
|
|
||||||
// by defualt, iword is initialized byl 0. And by default, toml11 outputs
|
// by default, iword is initialized by 0. And by default, toml11 outputs
|
||||||
// comments. So `0` means showcomment. 1 means nocommnet.
|
// comments. So `0` means showcomment. 1 means nocommnet.
|
||||||
const bool no_comment = (1 == os.iword(detail::comment_index(os)));
|
const bool no_comment = (1 == os.iword(detail::comment_index(os)));
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@ using key = std::string;
|
|||||||
|
|
||||||
using boolean = bool;
|
using boolean = bool;
|
||||||
using integer = std::int64_t;
|
using integer = std::int64_t;
|
||||||
using floating = double; // "float" is a keyward, cannot use it here.
|
using floating = double; // "float" is a keyword, cannot use it here.
|
||||||
// the following stuffs are structs defined here, so aliases are not needed.
|
// the following stuffs are structs defined here, so aliases are not needed.
|
||||||
// - string
|
// - string
|
||||||
// - offset_datetime
|
// - offset_datetime
|
||||||
|
@@ -101,7 +101,7 @@ throw_key_not_found_error(const Value& v, const key& ky)
|
|||||||
// ```toml
|
// ```toml
|
||||||
// a = {b = "c"}
|
// a = {b = "c"}
|
||||||
// ```
|
// ```
|
||||||
// toml11 consideres the inline table body as the table region. Here,
|
// toml11 considers the inline table body as the table region. Here,
|
||||||
// `{b = "c"}` is the region of the table "a". The size of the region
|
// `{b = "c"}` is the region of the table "a". The size of the region
|
||||||
// is 9, not 1. The shotest inline table still has two characters, `{`
|
// is 9, not 1. The shotest inline table still has two characters, `{`
|
||||||
// and `}`. The size cannot be 1.
|
// and `}`. The size cannot be 1.
|
||||||
@@ -110,7 +110,7 @@ throw_key_not_found_error(const Value& v, const key& ky)
|
|||||||
// ```toml
|
// ```toml
|
||||||
// [a]
|
// [a]
|
||||||
// ```
|
// ```
|
||||||
// toml11 consideres the whole table key as the table region. Here,
|
// toml11 considers the whole table key as the table region. Here,
|
||||||
// `[a]` is the table region. The size is 3, not 1.
|
// `[a]` is the table region. The size is 3, not 1.
|
||||||
//
|
//
|
||||||
throw std::out_of_range(format_underline(concat_to_string(
|
throw std::out_of_range(format_underline(concat_to_string(
|
||||||
|
Reference in New Issue
Block a user