11#include " DBCParser.h"
22#include " CANDatabaseException.h"
33#include < string>
4+ #include < sstream>
45#include < iostream>
56#include < algorithm>
67#include < iterator>
1011using namespace DBCParser ;
1112
1213static std::string VERSION_TOKEN = " VERSION" ;
13- static std::string NS_SECTION_TOKEN = " NS_" ;
14+ static std::string NS_SECTION_TOKEN1 = " NS_" ;
15+ static std::string NS_SECTION_TOKEN2 = " _NS" ;
1416static std::string BIT_TIMING_TOKEN = " BS_" ;
1517static std::string NODE_DEF_TOKEN = " BU_" ;
1618static std::string MESSAGE_DEF_TOKEN = " BO_" ;
@@ -32,8 +34,10 @@ static std::set<std::string> SUPPORTED_DBC_TOKENS = {
3234
3335static std::set<std::string> NS_TOKENS = {
3436 " CM_" , " BA_DEF_" , " BA_" , " VAL_" , " CAT_DEF_" , " CAT_" , " FILTER" , " BA_DEF_DEF_" ,
35- " EV_DATA_" , " ENVVAR_DATA" , " SGTYPE_" , " SGTYPE_VAL_" , " BA_DEF_SGTYPE_" , " BA_SGTYPE_" ,
36- " SIG_TYPE_DEF_"
37+ " EV_DATA_" , " ENVVAR_DATA_" , " SGTYPE_" , " SGTYPE_VAL_" , " BA_DEF_SGTYPE_" , " BA_SGTYPE_" ,
38+ " SIG_TYPE_DEF_" , " SIG_TYPE_REF_" , " VAL_TABLE_" , " SIG_GROUP_" , " SIG_VALTYPE_" ,
39+ " SIGTYPE_VALTYPE_" , " BO_TX_BU_" , " BA_DEF_REL_" , " BA_REL_" , " BA_DEF_DEF_REL_" ,
40+ " BU_SG_REL_" , " BU_EV_REL_" , " BU_BO_REL_"
3741};
3842
3943static std::set<std::string> UNSUPPORTED_DBC_TOKENS = {
@@ -63,7 +67,8 @@ std::string parseVersionSection(Tokenizer& tokenizer) {
6367
6468static void
6569parseNSSection (Tokenizer& tokenizer) {
66- if (!peek_token (tokenizer, NS_SECTION_TOKEN))
70+ if (!peek_token (tokenizer, NS_SECTION_TOKEN1) &&
71+ !peek_token (tokenizer, NS_SECTION_TOKEN2)) // Sometimes, one can find both NS_ ans _NS in DBC files
6772 return ;
6873
6974 assert_token (tokenizer, " :" );
0 commit comments