BNF:5: SCOPE ::= '::'? (IDENTIFIER '::')* (IDENTIFIER TEMPLTYPELIST? '::')?
| 253 | |
| 254 | // BNF:5: SCOPE ::= '::'? (IDENTIFIER '::')* (IDENTIFIER TEMPLTYPELIST? '::')? |
| 255 | void asCParser::ParseOptionalScope(asCScriptNode *node) |
| 256 | { |
| 257 | asCScriptNode *scope = CreateNode(snScope); |
| 258 | |
| 259 | sToken t1, t2; |
| 260 | GetToken(&t1); |
| 261 | GetToken(&t2); |
| 262 | if( t1.type == ttScope ) |
| 263 | { |
| 264 | RewindTo(&t1); |
| 265 | scope->AddChildLast(ParseToken(ttScope)); |
| 266 | GetToken(&t1); |
| 267 | GetToken(&t2); |
| 268 | } |
| 269 | while( t1.type == ttIdentifier && t2.type == ttScope ) |
| 270 | { |
| 271 | RewindTo(&t1); |
| 272 | scope->AddChildLast(ParseIdentifier()); |
| 273 | scope->AddChildLast(ParseToken(ttScope)); |
| 274 | GetToken(&t1); |
| 275 | GetToken(&t2); |
| 276 | } |
| 277 | |
| 278 | // The innermost scope may be a template type |
| 279 | if( t1.type == ttIdentifier && t2.type == ttLessThan ) |
| 280 | { |
| 281 | tempString.Assign(&script->code[t1.pos], t1.length); |
| 282 | if (engine->IsTemplateType(tempString.AddressOf())) |
| 283 | { |
| 284 | RewindTo(&t1); |
| 285 | asCScriptNode *restore = scope->lastChild; |
| 286 | scope->AddChildLast(ParseIdentifier()); |
| 287 | if (ParseTemplTypeList(scope, false)) |
| 288 | { |
| 289 | GetToken(&t2); |
| 290 | if (t2.type == ttScope) |
| 291 | { |
| 292 | // Template type is part of the scope |
| 293 | // Nothing more needs to be done |
| 294 | node->AddChildLast(scope); |
| 295 | return; |
| 296 | } |
| 297 | else |
| 298 | { |
| 299 | // The template type is not part of the scope |
| 300 | // Rewind to the template type and end the scope |
| 301 | RewindTo(&t1); |
| 302 | |
| 303 | // Restore the previously parsed node |
| 304 | while (scope->lastChild != restore) |
| 305 | { |
| 306 | asCScriptNode *last = scope->lastChild; |
| 307 | last->DisconnectParent(); |
| 308 | last->Destroy(engine); |
| 309 | } |
| 310 | if( scope->lastChild ) |
| 311 | node->AddChildLast(scope); |
| 312 | else |
nothing calls this directly
no test coverage detected