diff --git a/toml/parser.hpp b/toml/parser.hpp index 333f3d1..fbbf38c 100644 --- a/toml/parser.hpp +++ b/toml/parser.hpp @@ -510,7 +510,7 @@ parse_ml_literal_string(location& loc) const auto first = loc.iter(); if(const auto token = lex_ml_literal_string::invoke(loc)) { - location> inner_loc(loc.name(), token.unwrap().vec()); + location> inner_loc(loc.name(), token.unwrap().str()); const auto open = lex_ml_literal_string_open::invoke(inner_loc); if(!open) @@ -573,7 +573,7 @@ parse_literal_string(location& loc) const auto first = loc.iter(); if(const auto token = lex_literal_string::invoke(loc)) { - location> inner_loc(loc.name(), token.unwrap().vec()); + location> inner_loc(loc.name(), token.unwrap().str()); const auto open = lex_apostrophe::invoke(inner_loc); if(!open) @@ -646,7 +646,7 @@ parse_local_date(location& loc) const auto first = loc.iter(); if(const auto token = lex_local_date::invoke(loc)) { - location> inner_loc(loc.name(), token.unwrap().vec()); + location> inner_loc(loc.name(), token.unwrap().str()); const auto y = lex_date_fullyear::invoke(inner_loc); if(!y || inner_loc.iter() == inner_loc.end() || *inner_loc.iter() != '-') @@ -696,7 +696,7 @@ parse_local_time(location& loc) const auto first = loc.iter(); if(const auto token = lex_local_time::invoke(loc)) { - location> inner_loc(loc.name(), token.unwrap().vec()); + location> inner_loc(loc.name(), token.unwrap().str()); const auto h = lex_time_hour::invoke(inner_loc); if(!h || inner_loc.iter() == inner_loc.end() || *inner_loc.iter() != ':') @@ -785,7 +785,7 @@ parse_local_datetime(location& loc) const auto first = loc.iter(); if(const auto token = lex_local_date_time::invoke(loc)) { - location> inner_loc(loc.name(), token.unwrap().vec()); + location> inner_loc(loc.name(), token.unwrap().str()); const auto date = parse_local_date(inner_loc); if(!date || inner_loc.iter() == inner_loc.end()) { @@ -830,7 +830,7 @@ parse_offset_datetime(location& loc) const auto first = loc.iter(); if(const auto token = lex_offset_date_time::invoke(loc)) { - location> inner_loc(loc.name(), token.unwrap().vec()); + location> inner_loc(loc.name(), token.unwrap().str()); const auto datetime = parse_local_datetime(inner_loc); if(!datetime || inner_loc.iter() == inner_loc.end()) { @@ -903,7 +903,7 @@ parse_key(location& loc) if(const auto token = lex_dotted_key::invoke(loc)) { const auto reg = token.unwrap(); - location> inner_loc(loc.name(), reg.vec()); + location> inner_loc(loc.name(), reg.str()); std::vector keys; while(inner_loc.iter() != inner_loc.end()) @@ -1182,7 +1182,7 @@ template bool is_valid_forward_table_definition(const Value& fwd, Iterator key_first, Iterator key_curr, Iterator key_last) { - location> def("internal", detail::get_region(fwd).vec()); + location> def("internal", detail::get_region(fwd).str()); if(const auto tabkeys = parse_table_key(def)) { // table keys always contains all the nodes from the root. @@ -1736,7 +1736,7 @@ parse_table_key(location& loc) { if(auto token = lex_std_table::invoke(loc)) { - location> inner_loc(loc.name(), token.unwrap().vec()); + location> inner_loc(loc.name(), token.unwrap().str()); const auto open = lex_std_table_open::invoke(inner_loc); if(!open || inner_loc.iter() == inner_loc.end()) @@ -1798,7 +1798,7 @@ parse_array_table_key(location& loc) { if(auto token = lex_array_table::invoke(loc)) { - location> inner_loc(loc.name(), token.unwrap().vec()); + location> inner_loc(loc.name(), token.unwrap().str()); const auto open = lex_array_table_open::invoke(inner_loc); if(!open || inner_loc.iter() == inner_loc.end()) @@ -1970,7 +1970,7 @@ result parse_toml_file(location& loc) >; if(const auto token = lex_first_comments::invoke(loc)) { - location> inner_loc(loc.name(), token.unwrap().vec()); + location> inner_loc(loc.name(), token.unwrap().str()); while(inner_loc.iter() != inner_loc.end()) { maybe::invoke(inner_loc); // remove ws if exists diff --git a/toml/region.hpp b/toml/region.hpp index dd8086c..bc5d98c 100644 --- a/toml/region.hpp +++ b/toml/region.hpp @@ -48,8 +48,6 @@ struct region_base virtual std::string line() const {return std::string("unknown line");} virtual std::string line_num() const {return std::string("?");} - virtual std::vector vec() const {return std::vector{};} - // length of the region virtual std::size_t size() const noexcept {return 0;} // number of characters in the line before the region @@ -149,8 +147,6 @@ struct location final : public region_base std::string str() const override {return make_string(1, *this->iter());} std::string name() const override {return source_name_;} - std::vector vec() const override {return std::vector{*this->iter()};} - std::string line_num() const override { return std::to_string(this->line_number_); @@ -269,8 +265,6 @@ struct region final : public region_base return std::to_string(1 + std::count(this->begin(), this->first(), '\n')); } - std::vector vec() const override {return std::vector(first_, last_);} - std::size_t size() const noexcept override { const auto sz = std::distance(first_, last_);