MCPcopy Create free account
hub / github.com/GPUOpen-Tools/GPU-Reshape / ParseMessage

Method ParseMessage

Source/Test/Device/Generator/Source/Parser.cpp:437–488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435}
436
437bool Parser::ParseMessage(Parser::Context &context) {
438 ProgramMessage& message = program.messages.emplace_back();
439 message.line = context.Tok().line;
440
441 // Must be ID
442 Token type = context.Next();
443 if (type.type != TokenType::ID) {
444 context.Error("Expected message name");
445 return false;
446 }
447
448 message.type = type.str;
449
450 if (!context.TryNext("[")) {
451 context.Error("Expected start of count [");
452 return false;
453 }
454
455 if (!ParseLiteralGenerator(context, &message.checkGenerator)) {
456 return false;
457 }
458
459 if (!context.TryNext("]")) {
460 context.Error("Expected start of count ]");
461 return false;
462 }
463
464 while (context) {
465 ProgramMessageAttribute& attr = message.attributes.emplace_back();
466
467 // Must be ID
468 Token attribute = context.Next();
469 if (attribute.type != TokenType::ID) {
470 context.Error("Expected attribute");
471 return false;
472 }
473
474 attr.name = attribute.str;
475
476 // Expecting a:b
477 if (!context.TryNext(":")) {
478 context.Error("Expected : between attribute and value");
479 return false;
480 }
481
482 if (!ParseLiteralGenerator(context, &attr.checkGenerator)) {
483 return false;
484 }
485 }
486
487 return true;
488}
489
490bool Parser::ParseKernelType(Parser::Context &context, KernelType* out) {
491 // Parse type

Callers

nothing calls this directly

Calls 4

TokMethod · 0.80
TryNextMethod · 0.80
NextMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected