| 570 | } |
| 571 | |
| 572 | string Generator::getOutputName(Symbol *symbol, bool check) |
| 573 | { |
| 574 | string annName; |
| 575 | uint32_t line; |
| 576 | Annotation *ann = findAnnotation(symbol, NAME_ANNOTATION); |
| 577 | if (ann) |
| 578 | { |
| 579 | annName = ann->getValueObject()->toString(); |
| 580 | if (annName.empty()) |
| 581 | { |
| 582 | throw semantic_error(format_string("Missing value for annotation named @%s on line '%d'", NAME_ANNOTATION, |
| 583 | ann->getLocation().m_firstLine)); |
| 584 | } |
| 585 | Log::warning( |
| 586 | "line %d: Be careful when @%s annotation is used. This can cause compile issue. See documentation.\n", |
| 587 | ann->getLocation().m_firstLine, NAME_ANNOTATION); |
| 588 | line = ann->getLocation().m_firstLine; |
| 589 | } |
| 590 | else |
| 591 | { |
| 592 | annName = symbol->getName(); |
| 593 | line = symbol->getFirstLine(); |
| 594 | } |
| 595 | |
| 596 | if (check) |
| 597 | { |
| 598 | auto it = reserverdWords.find(annName); |
| 599 | if (it != reserverdWords.end()) |
| 600 | { |
| 601 | throw semantic_error(format_string( |
| 602 | "line %d: Wrong symbol name '%s'. Cannot use program language reserved words.", line, annName.c_str())); |
| 603 | } |
| 604 | } |
| 605 | |
| 606 | return annName; |
| 607 | } |
| 608 | |
| 609 | Annotation::program_lang_t Generator::getAnnotationLang() |
| 610 | { |
nothing calls this directly
no test coverage detected