MCPcopy Create free account
hub / github.com/assimp/assimp / ProcessDataToken

Function ProcessDataToken

code/AssetLib/FBX/FBXTokenizer.cpp:96–129  ·  view source on GitHub ↗

process a potential data token up to 'cur', adding it to 'output_tokens'. ------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

94// process a potential data token up to 'cur', adding it to 'output_tokens'.
95// ------------------------------------------------------------------------------------------------
96void ProcessDataToken(TokenList &output_tokens, StackAllocator &token_allocator,
97 const char*& start, const char*& end,
98 unsigned int line,
99 unsigned int column,
100 TokenType type = TokenType_DATA,
101 bool must_have_token = false)
102{
103 if (start && end) {
104 // sanity check:
105 // tokens should have no whitespace outside quoted text and [start,end] should
106 // properly delimit the valid range.
107 bool in_double_quotes = false;
108 for (const char* c = start; c != end + 1; ++c) {
109 if (*c == '\"') {
110 in_double_quotes = !in_double_quotes;
111 }
112
113 if (!in_double_quotes && IsSpaceOrNewLine(*c)) {
114 TokenizeError("unexpected whitespace in token", line, column);
115 }
116 }
117
118 if (in_double_quotes) {
119 TokenizeError("non-terminated double quotes", line, column);
120 }
121
122 output_tokens.push_back(new_Token(start,end + 1,type,line,column));
123 }
124 else if (must_have_token) {
125 TokenizeError("unexpected character, expected data token", line, column);
126 }
127
128 start = end = nullptr;
129}
130
131}
132

Callers 1

TokenizeFunction · 0.85

Calls 3

IsSpaceOrNewLineFunction · 0.85
TokenizeErrorFunction · 0.70
push_backMethod · 0.45

Tested by

no test coverage detected