1
1
#include " DBCParser.h"
2
2
#include " CANDatabaseException.h"
3
3
#include < string>
4
+ #include < sstream>
4
5
#include < iostream>
5
6
#include < algorithm>
6
7
#include < iterator>
10
11
using namespace DBCParser ;
11
12
12
13
static 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" ;
14
16
static std::string BIT_TIMING_TOKEN = " BS_" ;
15
17
static std::string NODE_DEF_TOKEN = " BU_" ;
16
18
static std::string MESSAGE_DEF_TOKEN = " BO_" ;
@@ -32,8 +34,10 @@ static std::set<std::string> SUPPORTED_DBC_TOKENS = {
32
34
33
35
static std::set<std::string> NS_TOKENS = {
34
36
" 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_"
37
41
};
38
42
39
43
static std::set<std::string> UNSUPPORTED_DBC_TOKENS = {
@@ -63,7 +67,8 @@ std::string parseVersionSection(Tokenizer& tokenizer) {
63
67
64
68
static void
65
69
parseNSSection (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
67
72
return ;
68
73
69
74
assert_token (tokenizer, " :" );
0 commit comments