1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842
|
/* $Id$
*
* NodeFactory: helper scripts for the Parser to create AST nodes, mainly
* useful to keep lots of c++ code out of the parser.
*
* Copyright (C) 2007-2009 FAUmachine Team <info@faumachine.org>.
* This program is free software. You can redistribute it and/or modify it
* under the terms of the GNU General Public License, either version 2 of
* the License, or (at your option) any later version. See COPYING.
*/
#include <cassert>
#include <iostream>
#include "frontend/ast/NodeFactory.hpp"
#include "frontend/ast/SignalDeclaration.hpp"
#include "frontend/ast/ConstantDeclaration.hpp"
#include "frontend/ast/VarDeclaration.hpp"
#include "frontend/ast/ConstInteger.hpp"
#include "frontend/ast/WhileLoopStat.hpp"
#include "frontend/ast/SigAssignStat.hpp"
#include "frontend/ast/FunctionCall.hpp"
#include "frontend/reporting/ErrorRegistry.hpp"
#include "frontend/reporting/CompileError.hpp"
#include "frontend/reporting/UndefinedSymbol.hpp"
#include "frontend/misc/SymbolTable.hpp"
#include "frontend/misc/NameLookup.hpp"
#include "frontend/misc/BuiltinFunction.hpp"
#include "frontend/ast/EnumerationType.hpp"
#include "frontend/ast/FunctionDeclaration.hpp"
#include "frontend/visitor/ResolveTypes.hpp"
#include "frontend/ast/UnconstrainedArrayType.hpp"
#include "frontend/misc/Compiler.hpp"
namespace ast {
struct NodeFactory::IfHelperS&
NodeFactory::createNestedElseIfs(
struct NodeFactory::IfHelperS* remainder,
Expression* condition,
std::list<SeqStat*>* thenStats,
Location loc
)
{
struct NodeFactory::IfHelperS* ret = NULL;
/* no parent elsif statements... create one */
if (remainder == NULL) {
ret = new NodeFactory::IfHelperS();
ret->topstat = new IfStat(condition, thenStats, NULL, loc);
ret->bottomElse = &(ret->topstat->elseStats);
return *ret;
}
/* parent present. attach to bottom else */
IfStat *bottomIf = new IfStat(condition, thenStats, NULL, loc);
std::list<SeqStat*>* l = new std::list<SeqStat*>();
l->push_back(bottomIf);
*(remainder->bottomElse) = l;
/* set old bottom else to new one */
remainder->bottomElse = &(bottomIf->elseStats);
return *remainder;
}
IfStat& NodeFactory::createIfStat(
Expression* condition,
std::list<SeqStat*>* thenStats,
struct NodeFactory::IfHelperS* elsIfs,
std::list<SeqStat*>* elseStats,
ast::Location loc
)
{
IfStat* ret = NULL;
/* trivial case: no eslIfs */
if (elsIfs == NULL) {
ret = new IfStat(condition, thenStats, elseStats, loc);
return *ret;
}
/* remap elsIfs to nested if-else (part already done via elseIfs */
/* sanity checks for parser */
assert(elsIfs->topstat != NULL);
assert(*(elsIfs->bottomElse) == NULL);
/* elseif stats... should go to else part */
std::list<SeqStat*>* ep = new std::list<SeqStat*>();
ep->push_back(elsIfs->topstat);
/* create real ifstat */
ret = new IfStat(condition, thenStats, ep, loc);
/* attach else-part to bottom most else-list */
*(elsIfs->bottomElse) = elseStats;
/* cleanup */
delete elsIfs;
return *ret;
}
std::list<SignalDeclaration*>&
NodeFactory::makeSignalDecls(
std::list<std::string*>& ids,
enum ValDeclaration::Mode mode,
bool isBus,
Expression* varInit,
SubtypeIndication* subtypeIndic,
Location loc
)
{
std::list<SignalDeclaration*> *v =
new std::list<SignalDeclaration*>();
for (std::list<std::string*>::iterator i = ids.begin();
i != ids.end(); i++) {
SignalDeclaration *s =
new SignalDeclaration(*i, mode, isBus, varInit,
subtypeIndic, loc);
v->push_back(s);
assert(subtypeIndic);
}
util::MiscUtil::terminate(varInit);
util::MiscUtil::terminate(subtypeIndic);
return *v;
}
std::list<ConstantDeclaration*>&
NodeFactory::makeConstantDecls(
std::list<std::string*>& ids,
Expression* varInit,
SubtypeIndication* subtypeIndic,
Location loc
)
{
std::list<ConstantDeclaration*> *v =
new std::list<ConstantDeclaration*>();
for (std::list<std::string*>::iterator i = ids.begin();
i != ids.end(); i++) {
ConstantDeclaration *s =
new ConstantDeclaration(*i, varInit, subtypeIndic,
true, loc);
v->push_back(s);
assert(subtypeIndic);
}
util::MiscUtil::terminate(varInit);
util::MiscUtil::terminate(subtypeIndic);
return *v;
}
std::list<SymbolDeclaration*>&
NodeFactory::makeVarDecls(
std::list<std::string*>& ids,
Expression* varInit,
SubtypeIndication* subtypeIndic,
Location loc
)
{
std::list<SymbolDeclaration*> *v =
new std::list<SymbolDeclaration*>();
for (std::list<std::string*>::iterator i = ids.begin();
i != ids.end(); i++) {
VarDeclaration *s = new VarDeclaration(
ValDeclaration::MODE_INOUT,
*i,
varInit,
subtypeIndic,
loc
);
v->push_back(s);
assert(subtypeIndic);
}
util::MiscUtil::terminate(varInit);
util::MiscUtil::terminate(subtypeIndic);
return *v;
}
std::list<ValDeclaration*>&
NodeFactory::makeFuncInterfaceDecls(
std::list<std::string*>& ids,
Expression* varInit,
enum ValDeclaration::Mode mode,
enum ValDeclaration::ObjClass cls,
SubtypeIndication* subtypeIndic,
Location loc
)
{
std::list<ValDeclaration*> *v = new std::list<ValDeclaration*>();
if (mode != ValDeclaration::MODE_IN) {
assert(! ids.empty());
// only in is allowed for functions.
CompileError *ce = new CompileError(loc,
"Wrong parameter mode for argument <"
+ *ids.front() + ">, setting to IN.");
ErrorRegistry::addError(ce);
}
for (std::list<std::string*>::iterator i = ids.begin();
i != ids.end(); i++) {
ValDeclaration *s = NULL;
/* no class -> constant
mode always in
*/
switch (cls) {
case ValDeclaration::OBJ_CLASS_VARIABLE: {
CompileError* ce = new CompileError(loc,
"Object class VARIABLE not allowed "
"for Function argument <"
+ **i + ">, using CONSTANT.");
ErrorRegistry::addError(ce);
/* fall through */
ATTRIBUTE_FALLTHROUGH
}
case ValDeclaration::OBJ_CLASS_UNSPECIFIED:
ATTRIBUTE_FALLTHROUGH
case ValDeclaration::OBJ_CLASS_CONSTANT:
s = new ConstantDeclaration(*i, varInit,
subtypeIndic,
false, loc);
break;
case ValDeclaration::OBJ_CLASS_SIGNAL:
s = new SignalDeclaration(*i,
ValDeclaration::MODE_IN,
false,
varInit,
subtypeIndic,
loc
);
break;
}
v->push_back(s);
assert(subtypeIndic);
}
util::MiscUtil::terminate(varInit);
util::MiscUtil::terminate(subtypeIndic);
return *v;
}
std::list<ValDeclaration*>&
NodeFactory::makeProcInterfaceDecls(
std::list<std::string*>& ids,
Expression* varInit,
enum ValDeclaration::Mode mode,
enum ValDeclaration::ObjClass cls,
SubtypeIndication* subtypeIndic,
Location loc
)
{
std::list<ValDeclaration*> *v = new std::list<ValDeclaration*>();
for (std::list<std::string*>::iterator i = ids.begin();
i != ids.end(); i++) {
ValDeclaration *s = NULL;
/* no class -> in -> constant
others -> variable
NOTE: it's unclear what the default mode of an interface
element of a procedure is, in case no class is given.
FAUhdlc will choose MODE_IN here.
cf. IEEE Standard VHDL Language Reference Manual
(ISBN 1-55397-376-8), p. 20
*/
switch (cls) {
case ValDeclaration::OBJ_CLASS_UNSPECIFIED:
if (mode == ValDeclaration::MODE_IN) {
s = new ConstantDeclaration(*i, varInit,
subtypeIndic, false, loc);
/* TODO issue warning if mode != MODE_IN */
} else {
s = new VarDeclaration(mode, *i, varInit,
subtypeIndic, loc);
}
break;
case ValDeclaration::OBJ_CLASS_VARIABLE:
s = new VarDeclaration(mode, *i, varInit,
subtypeIndic, loc);
break;
case ValDeclaration::OBJ_CLASS_SIGNAL:
s = new SignalDeclaration(*i, mode, false, varInit,
subtypeIndic, loc);
break;
case ValDeclaration::OBJ_CLASS_CONSTANT:
s = new ConstantDeclaration(*i, varInit,
subtypeIndic, false, loc);
switch (mode) {
case ValDeclaration::MODE_IN:
break;
default: {
CompileError *ce = new CompileError(loc,
"Object class constant for <"
+ **i + "> must "
"be of mode IN.");
ErrorRegistry::addError(ce);
}
}
break;
}
assert(subtypeIndic);
v->push_back(s);
}
util::MiscUtil::terminate(varInit);
util::MiscUtil::terminate(subtypeIndic);
return *v;
}
struct NodeFactory::ContextItemS&
NodeFactory::mergeContextItems(
struct NodeFactory::ContextItemS& first,
struct NodeFactory::ContextItemS& second
)
{
if (first.libClauses && second.libClauses) {
listCombine(first.libClauses, second.libClauses);
delete second.libClauses;
}
if (first.libClauses == NULL) {
first.libClauses = second.libClauses;
}
if (first.useClauses && second.useClauses) {
listCombine(first.useClauses, second.useClauses);
delete second.useClauses;
}
if (first.useClauses == NULL) {
first.useClauses = second.useClauses;
}
delete &second;
return first;
}
CondalSigAssign&
NodeFactory::makeCondalSigAssign(Name& trg, SeqStat& conds, Location loc)
{
CondalSigAssign& ret = *(new CondalSigAssign(&trg, &conds, loc));
NodeFactory::CondalSigAssignSetter setter =
NodeFactory::CondalSigAssignSetter(trg);
ret.accept(setter);
return ret;
}
void
NodeFactory::CondalSigAssignSetter::visit(SigAssignStat &node)
{
assert(node.target == NULL); // parser is wrong otherwise.
node.target = &(this->target);
/* _don't_ traverse here. (as it's not of our concern below.) */
}
std::list<RecordTypeElement*>&
NodeFactory::makeRecordTypeElements(
std::list<std::string*> &idlist,
SubtypeIndication &subtype,
Location loc
)
{
std::list<RecordTypeElement*> *result =
new std::list<RecordTypeElement*>();
for (std::list<std::string*>::iterator i = idlist.begin();
i != idlist.end(); i++) {
result->push_back(
new RecordTypeElement(*i, &subtype, loc));
}
SubtypeIndication* si = &subtype;
util::MiscUtil::terminate(si);
return *result;
}
Aggregate*
NodeFactory::makeAggregateFromString(
const std::string &stringLit,
Location loc,
const NameLookup &nl
)
{
std::list<ElementAssociation*> *elements =
new std::list<ElementAssociation*>();
for (std::string::const_iterator i = stringLit.begin();
i != stringLit.end(); i++) {
std::string *s = new std::string("'");
s->append(std::string(1, *i));
s->append("'");
std::list<Symbol*> cands = nl.lookup(*s);
if (cands.empty()) {
UndefinedSymbol *us = new UndefinedSymbol(*s, loc);
ErrorRegistry::addError(us);
}
FunctionCall *fc =
new FunctionCall(
new SimpleName(
s,
cands,
loc),
new std::list<AssociationElement*>(),
loc);
ElementAssociation* assoc =
new ElementAssociation(NULL, fc, loc);
elements->push_back(assoc);
}
return new Aggregate(elements, loc);
}
void
NodeFactory::registerEnumElems(
const EnumerationType *e,
SymbolTable &symbolTable,
Symbol *typeSym
)
{
assert(e);
assert(e->elements);
unsigned int cnt = 0;
for (std::list<FunctionDeclaration*>::const_iterator i =
e->elements->begin();
i != e->elements->end();
i++) {
//register the corresponding function for enumeration
//elements.
SimpleName *sn = new SimpleName(new std::string(*e->name),
e->location);
sn->candidates.push_back(typeSym);
SubtypeIndication *si = new SubtypeIndication(sn,
(*i)->location);
(*i)->returnType = si;
(*i)->isBuiltin = true;
(*i)->builtin = new ReturnValue(cnt, e);
symbolTable.registerSymbol(SYMBOL_FUNCTION, **i);
cnt++;
}
}
NodeFactory::TypeDeclHelper::TypeDeclHelper(
std::list<DiscreteRange*> *indexConstraint,
SubtypeIndication *elementType,
Location loc,
SymbolTable &s
) : enumType(NULL),
typeDecl(NULL),
conArrayBase(NULL),
wasRecordType(false)
{
std::list<TypeDeclaration*> *l =
new std::list<TypeDeclaration*>();
for (std::list<DiscreteRange*>::const_iterator i =
indexConstraint->begin(); i != indexConstraint->end(); i++) {
// FIXME this is not 100% correct:
// in case the result is a universal type, it should get
// converted to integer.
// For now, just assume that it's a universal type,
// and require integer as a result.
//
// One problem is, that the type resolution is non-const in
// itself. Maybe it should be rewritten in a const part,
// and in a non-const part.
ResolveTypes r = ResolveTypes(s);
TypeDeclaration *stdInt = s.getStdStandardType("integer");
assert(stdInt != NULL);
r.typeCandidates.insert(stdInt);
(*i)->accept(r);
if ((*i)->type == NULL) {
// type error occured, bail out early
util::MiscUtil::lterminate(l);
return;
}
l->push_back((*i)->type);
}
// create base type: anonymous unconstrained array.
std::string n = s.getMangledPathName() + "__constraint_base__";
this->conArrayBase = new UnconstrainedArrayType(
new std::string(n),
l,
elementType,
loc);
SubtypeIndication *t = new SubtypeIndication(this->conArrayBase, loc);
t->indexConstraint = indexConstraint;
this->typeDecl = t;
}
void
NodeFactory::TypeDeclHelper::registerType(
SymbolTable &symTab,
NodeFactory::Identifier *id
) const
{
assert(id);
assert(id->identifier);
if (this->enumType) {
assert(this->typeDecl == NULL);
this->enumType->name = id->identifier;
Symbol *sym = symTab.registerSymbol(SYMBOL_TYPE,
*this->enumType);
NodeFactory::registerEnumElems(this->enumType, symTab, sym);
delete id;
return;
}
// no enumeration type
assert(this->enumType == NULL);
if (this->typeDecl == NULL) {
// type error must have been registered
assert(false); // FIXME for debugging.
return;
}
this->typeDecl->name = id->identifier;
delete id;
if (this->wasRecordType) {
symTab.lateRegisterAttach(SYMBOL_TYPE, *this->typeDecl);
// leave scope of record type
symTab.popRegion();
return;
}
// base type for constrained array present?
if (this->conArrayBase != NULL) {
symTab.registerSymbol(SYMBOL_TYPE, *this->conArrayBase);
}
// fall through: neither a record type, nor an enumeration type
symTab.registerSymbol(SYMBOL_TYPE, *this->typeDecl);
}
std::list<SymbolDeclaration*>*
NodeFactory::TypeDeclHelper::flatten(void) const
{
std::list<SymbolDeclaration*> *ret =
new std::list<SymbolDeclaration*>();
if (this->enumType) {
ret->push_back(this->enumType);
return ret;
}
if (this->conArrayBase != NULL) {
ret->push_back(this->conArrayBase);
}
if (this->typeDecl == NULL) {
// type error must have been registered.
return ret;
}
ret->push_back(this->typeDecl);
return ret;
}
AttributeSpecification *
NodeFactory::handleAttributeSpecs(
SimpleName *designator,
std::list<SimpleName *> entityList,
enum entityClassE classFilter,
Expression *init,
const SymbolTable &symTab
)
{
// find out attribute by designator.
for (std::list<Symbol *>::iterator i = designator->candidates.begin();
i != designator->candidates.end(); /* nothing */) {
switch ((*i)->type) {
case SYMBOL_ATTRIBUTE:
i++;
break;
default:
i = designator->candidates.erase(i);
}
}
if (designator->candidates.size() != 1) {
std::string s = "<" + *designator->name + "> does not refer"
" to an Attribute.";
CompileError *ce = new CompileError(*designator, s);
ErrorRegistry::addError(ce);
return NULL;
}
AttributeDeclaration *decl =
dynamic_cast<AttributeDeclaration *>(
&designator->candidates.front()->declaration);
assert(decl != NULL);
AttributeSpecification *spec =
new AttributeSpecification(init, decl, designator->location);
// attribute every referred to symbol that matches classFilter
for (std::list<SimpleName*>::const_iterator i = entityList.begin();
i != entityList.end(); i++) {
assert((*i)->candidates.empty());
assert((*i)->name != NULL);
std::list<Symbol*> syms = symTab.lookup(*(*i)->name);
if (syms.empty()) {
UndefinedSymbol *us =
new UndefinedSymbol(*(*i)->name,
(*i)->location);
ErrorRegistry::addError(us);
continue;
}
for (std::list<Symbol *>::const_iterator j = syms.begin();
j != syms.end(); j++) {
if (NodeFactory::isOfEntityClass(**j, classFilter)) {
AttributableDeclaration *ad =
dynamic_cast<AttributableDeclaration*>(
&(*j)->declaration);
assert(ad != NULL);
// FIXME check if attribute already present
// and report error if so.
ad->attributes[*decl->name] = spec;
} else {
// FIXME if no "others"/"all" is present,
// report an error (LRM 5.1)
}
}
}
return spec;
}
bool
NodeFactory::isOfEntityClass(const Symbol &sym, enum entityClassE ec)
{
switch (ec) {
case EC_ENTITY:
switch (sym.type) {
case SYMBOL_ENTITY:
return true;
default:
return false;
}
/* not reached */
case EC_ARCHITECTURE:
switch (sym.type) {
case SYMBOL_ARCHITECTURE:
return true;
default:
return false;
}
/* not reached */
case EC_CONFIGURATION:
assert(false);
/* not reached */
case EC_PROCEDURE:
switch (sym.type) {
case SYMBOL_PROCEDURE:
return true;
default:
return false;
}
/* not reached */
case EC_FUNCTION:
switch (sym.type) {
case SYMBOL_FUNCTION:
return true;
default:
return false;
}
/* not reached */
case EC_PACKAGE:
switch (sym.type) {
case SYMBOL_PACKAGE:
return true;
default:
return false;
}
/* not reached */
case EC_TYPE:
switch (sym.type) {
case SYMBOL_TYPE: {
/* must not be a subtype */
SubtypeIndication *si =
dynamic_cast<SubtypeIndication*>(
&sym.declaration);
return si == NULL;
}
default:
return false;
}
/* not reached */
case EC_SUBTYPE:
switch (sym.type) {
case SYMBOL_TYPE: {
/* must be a subtype */
SubtypeIndication *si =
dynamic_cast<SubtypeIndication*>(
&sym.declaration);
return si != NULL;
}
default:
return false;
}
/* not reached */
case EC_CONSTANT:
switch (sym.type) {
case SYMBOL_PARAMETER:
case SYMBOL_VARIABLE: {
ValDeclaration *vd =
dynamic_cast<ValDeclaration*>(
&sym.declaration);
assert(vd != NULL);
switch (vd->storageClass) {
case ValDeclaration::OBJ_CLASS_CONSTANT:
return true;
default:
return false;
}
/* not reached */
}
default:
return false;
}
/* not reached */
case EC_SIGNAL:
switch (sym.type) {
case SYMBOL_PORT:
case SYMBOL_PARAMETER:
case SYMBOL_SIGNAL: {
ValDeclaration *vd =
dynamic_cast<ValDeclaration*>(
&sym.declaration);
assert(vd != NULL);
switch (vd->storageClass) {
case ValDeclaration::OBJ_CLASS_SIGNAL:
return true;
default:
return false;
}
/* not reached */
}
default:
return false;
}
/* not reached */
case EC_VARIABLE:
switch (sym.type) {
case SYMBOL_PARAMETER:
case SYMBOL_VARIABLE: {
ValDeclaration *vd =
dynamic_cast<ValDeclaration*>(
&sym.declaration);
assert(vd != NULL);
switch (vd->storageClass) {
case ValDeclaration::OBJ_CLASS_VARIABLE:
return true;
default:
return false;
}
/* not reached */
}
default:
return false;
}
/* not reached */
case EC_COMPONENT:
case EC_LABEL:
case EC_LITERAL:
case EC_UNITS:
case EC_GROUP:
case EC_FILE:
assert(false);
/* not reached */
}
/* not reached */
return false;
}
}; /* namespace ast */
|