Closes #13
This commit is contained in:
1 parent
bce707daf6
commit
51fcdb88ac
174 files changed
+5220
-2213
No files matched your search
@@ -372,6 +372,13 @@ void DbcCommentHandler::Handle(const std::string &line, DbcParseContext &context
|
||||
}
|
||||
|
||||
DbcStatementDispatcher::DbcStatementDispatcher() {
|
||||
RegisterType<DbcHeaderHandler>("VERSION");
|
||||
RegisterType<DbcHeaderHandler>("NS_");
|
||||
RegisterType<DbcHeaderHandler>("NS_:");
|
||||
RegisterType<DbcHeaderHandler>("BS_");
|
||||
RegisterType<DbcHeaderHandler>("BS_:");
|
||||
RegisterType<DbcHeaderHandler>("BU_");
|
||||
RegisterType<DbcHeaderHandler>("BU_:");
|
||||
RegisterType<DbcUnsupportedMultiplexingHandler>("SG_MUL_VAL_");
|
||||
RegisterType<DbcFrameHandler>("BO_");
|
||||
RegisterType<DbcSignalHandler>("SG_");
|
||||
@@ -379,6 +386,8 @@ DbcStatementDispatcher::DbcStatementDispatcher() {
|
||||
RegisterType<DbcValueDescriptionHandler>("VAL_");
|
||||
}
|
||||
|
||||
void DbcHeaderHandler::Handle(const std::string &, DbcParseContext &) const {}
|
||||
|
||||
bool DbcStatementDispatcher::Dispatch(const std::string &line,
|
||||
DbcParseContext &context) const {
|
||||
std::istringstream stream(line);
|
||||
@@ -434,7 +443,8 @@ void DbcParseContext::ResolveValueDescriptions(const std::string &filePath) {
|
||||
throw std::runtime_error("Duplicate VAL_ value key for signal: " + pending.signalName);
|
||||
}
|
||||
} catch (const std::exception &error) {
|
||||
throw std::runtime_error(filePath + ":" + std::to_string(pending.lineNumber) + ": " + error.what());
|
||||
throw DbcDiagnosticError(DbcDiagnosticCode::InvalidValueDescription,
|
||||
filePath, pending.lineNumber, error.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -479,8 +489,9 @@ namespace {
|
||||
if (signal.multiplexing.role != MultiplexRole::Selector)
|
||||
continue;
|
||||
if (selector != nullptr || signal.isSigned)
|
||||
throw std::runtime_error(filePath + ":" + std::to_string(lines[index]) +
|
||||
": Multiplexing requires one unsigned selector per frame.");
|
||||
throw DbcDiagnosticError(DbcDiagnosticCode::InvalidMultiplexing,
|
||||
filePath, lines[index],
|
||||
"Multiplexing requires one unsigned selector per frame.");
|
||||
selector = &signal;
|
||||
}
|
||||
return selector;
|
||||
@@ -512,7 +523,8 @@ void DbcParseContext::ValidateMultiplexing(const std::string &filePath) const {
|
||||
error = "Signals overlap without mutually exclusive multiplexing conditions.";
|
||||
}
|
||||
if (!error.empty())
|
||||
throw std::runtime_error(filePath + ":" + std::to_string(signalLines[frameIndex][index]) + ": " + error);
|
||||
throw DbcDiagnosticError(DbcDiagnosticCode::InvalidMultiplexing,
|
||||
filePath, signalLines[frameIndex][index], error);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user