diff --git a/src/dbcparser.cpp b/src/dbcparser.cpp index 1825ad4..cbe3883 100644 --- a/src/dbcparser.cpp +++ b/src/dbcparser.cpp @@ -51,23 +51,6 @@ template auto to_vector(const T& container) -> std::vector; -std::string withLines(const std::string& dbcFile) -{ - - auto withDots = dbcFile; - withDots = StringUtils::replace_all(withDots, " ", "$"); - withDots = StringUtils::replace_all(withDots, "\t", "[t]"); - const strings split = StringUtils::split(withDots, "\n"); - std::string buff; - - int counter{ 1 }; - for (const auto& line : split) { - buff += std::to_string(counter++) + std::string{ ": " } + line + std::string{ "\n" }; - } - - return buff; -} - // Changes \r\n to \n std::string dos2unix(const std::string& data) { @@ -76,14 +59,6 @@ std::string dos2unix(const std::string& data) return noWindowsShit; } -std::string toUtf(const std::string& data) -{ - return data; - // std::wstring_convert> converter; - // std::wstring_convert> converter2; - // return converter2.to_bytes(converter.from_bytes(data)); -} - tl::expected loadPegParser() { peg::parser pegParser; @@ -105,10 +80,10 @@ CANdb::CanDbOrError parse(peg::parser& pegParser, const std::string& data) } const auto noTabsData = dos2unix(data); - const auto traceEnter = [](const peg::Ope& ope, const char* name, std::size_t, const peg::SemanticValues&, + const auto traceEnter = [](const peg::Ope&, const char* name, std::size_t, const peg::SemanticValues&, const peg::Context&, const std::any&) { cdb_trace(" Parsing {} ", name); }; - const auto traceLeave = [](const peg::Ope& ope, const char* s, std::size_t n, const peg::SemanticValues& sv, - const peg::Context& c, const std::any& dt, std::size_t) {}; + const auto traceLeave = [](const peg::Ope&, const char*, std::size_t, const peg::SemanticValues&, + const peg::Context&, const std::any&, std::size_t) {}; pegParser.enable_trace(traceEnter, traceLeave); strings phrases; std::deque idents, signs, sig_sign, ecu_tokens; @@ -229,7 +204,7 @@ CANdb::CanDbOrError parse(peg::parser& pegParser, const std::string& data) muxName = ""; }; - pegParser["signal"] = [&idents, &numbers, &phrases, &signals, &signs, &sig_sign, &ecu_tokens, &mux, &muxNdx, + pegParser["signal"] = [&idents, &numbers, &phrases, &signals, &sig_sign, &ecu_tokens, &mux, &muxNdx, &muxName](const peg::SemanticValues& sv) { cdb_debug("Found signal {}", sv.token()); diff --git a/src/parsererror.cpp b/src/parsererror.cpp index 86f790d..0b6e014 100644 --- a/src/parsererror.cpp +++ b/src/parsererror.cpp @@ -3,7 +3,7 @@ namespace CANdb { const char* ParserErrorCategory::name() const noexcept { return "ParserError"; } -std::string ParserErrorCategory::message(int condition) const { return "ParserError"; } +std::string ParserErrorCategory::message(int) const { return "ParserError"; } std::string ParserError::message() const { return _mess; } ParserError make_error_code(ErrorType t, const std::string& msg) { return ParserError{ t, msg }; } diff --git a/src/parsererror.hpp b/src/parsererror.hpp index 59c806c..15e59b5 100644 --- a/src/parsererror.hpp +++ b/src/parsererror.hpp @@ -13,20 +13,17 @@ struct ParserErrorCategory : std::error_category { }; struct ParserError { - ParserError(ErrorType t, const std::string& mess) - : _t(t) - , _mess(mess) + ParserError(ErrorType, const std::string& mess) + : _mess(mess) { } - ParserError(std::error_code ec) - : _t(ErrorType::StdErrorCode) + ParserError(std::error_code) { } std::string message() const; private: - ErrorType _t; const std::string _mess; };