diff options
author | Adrian Thurston <thurston@colm.net> | 2020-04-12 13:08:39 +0000 |
---|---|---|
committer | Adrian Thurston <thurston@colm.net> | 2020-04-12 14:11:31 +0000 |
commit | a39d7909d7b542889481e2b3b7c08df16cc42b61 (patch) | |
tree | aeb2d570aed0ba1f5a07a55c4b9ffab6aa57737a /src | |
parent | 8b1810c9fd897d8d2840a0713ced1dfcfb71d109 (diff) | |
download | colm-a39d7909d7b542889481e2b3b7c08df16cc42b61.tar.gz |
renamed DefList and LelDefList to the more accurate ProdList, LelProdList
Diffstat (limited to 'src')
-rw-r--r-- | src/closure.cc | 4 | ||||
-rw-r--r-- | src/compiler.cc | 24 | ||||
-rw-r--r-- | src/compiler.h | 18 | ||||
-rw-r--r-- | src/consinit.cc | 36 | ||||
-rw-r--r-- | src/declare.cc | 16 | ||||
-rw-r--r-- | src/exports.cc | 4 | ||||
-rw-r--r-- | src/loadfinal.cc | 16 | ||||
-rw-r--r-- | src/loadinit.cc | 8 | ||||
-rw-r--r-- | src/loadinit.h | 2 | ||||
-rw-r--r-- | src/parser.cc | 26 | ||||
-rw-r--r-- | src/parser.h | 4 | ||||
-rw-r--r-- | src/parsetree.h | 10 | ||||
-rw-r--r-- | src/pdabuild.cc | 46 | ||||
-rw-r--r-- | src/resolve.cc | 6 | ||||
-rw-r--r-- | src/synthesis.cc | 4 |
15 files changed, 112 insertions, 112 deletions
diff --git a/src/closure.cc b/src/closure.cc index 066bf12b..61cbfd5d 100644 --- a/src/closure.cc +++ b/src/closure.cc @@ -127,7 +127,7 @@ void Compiler::lr0InvokeClosure( PdaGraph *pdaGraph, PdaState *state ) /* Make graphs for all of the productions that the non * terminal goes to that are not already in the state's dotSet. */ - for ( LelDefList::Iter prod = langEl->defList; prod.lte(); prod++ ) { + for ( LelProdList::Iter prod = langEl->prodList; prod.lte(); prod++ ) { /* Bring in the start state of the production. */ lr0BringInItem( pdaGraph, state, prod->fsm->startState, toClose, prod ); } @@ -364,7 +364,7 @@ void Compiler::linkExpansions( PdaGraph *pdaGraph ) LangEl *langEl = langElIndex[key]; if ( langEl != 0 && langEl->type == LangEl::NonTerm ) { /* For each production that the non terminal expand to ... */ - for ( LelDefList::Iter prod = langEl->defList; prod.lte(); prod++ ) { + for ( LelProdList::Iter prod = langEl->prodList; prod.lte(); prod++ ) { /* Follow the production and add to the trans's expand to set. */ PdaState *followRes = pdaGraph->followFsm( state, prod->fsm ); diff --git a/src/compiler.cc b/src/compiler.cc index 72f87dac..c2ce141f 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -791,9 +791,9 @@ LangEl *Compiler::makeRepeatProd( const InputLoc &loc, Namespace *nspace, Production *newDef1 = Production::cons( InputLoc(), prodName, prodElList1, String(), false, 0, - prodList.length(), prodName->defList.length() ); + prodList.length(), prodName->prodList.length() ); - prodName->defList.append( newDef1 ); + prodName->prodList.append( newDef1 ); prodList.append( newDef1 ); /* Build the second production of the repeat. */ @@ -801,9 +801,9 @@ LangEl *Compiler::makeRepeatProd( const InputLoc &loc, Namespace *nspace, Production *newDef2 = Production::cons( InputLoc(), prodName, prodElList2, String(), false, 0, - prodList.length(), prodName->defList.length() ); + prodList.length(), prodName->prodList.length() ); - prodName->defList.append( newDef2 ); + prodName->prodList.append( newDef2 ); prodList.append( newDef2 ); return prodName; @@ -836,9 +836,9 @@ LangEl *Compiler::makeListProd( const InputLoc &loc, Namespace *nspace, Production *newDef1 = Production::cons( loc, prodName, prodElList1, String(), false, 0, - prodList.length(), prodName->defList.length() ); + prodList.length(), prodName->prodList.length() ); - prodName->defList.append( newDef1 ); + prodName->prodList.append( newDef1 ); prodList.append( newDef1 ); /* Build the second production of the list. */ @@ -850,9 +850,9 @@ LangEl *Compiler::makeListProd( const InputLoc &loc, Namespace *nspace, Production *newDef2 = Production::cons( loc, prodName, prodElList2, String(), false, 0, - prodList.length(), prodName->defList.length() ); + prodList.length(), prodName->prodList.length() ); - prodName->defList.append( newDef2 ); + prodName->prodList.append( newDef2 ); prodList.append( newDef2 ); return prodName; @@ -873,9 +873,9 @@ LangEl *Compiler::makeOptProd( const InputLoc &loc, Namespace *nspace, Production *newDef1 = Production::cons( loc, prodName, prodElList1, String(), false, 0, - prodList.length(), prodName->defList.length() ); + prodList.length(), prodName->prodList.length() ); - prodName->defList.append( newDef1 ); + prodName->prodList.append( newDef1 ); prodList.append( newDef1 ); /* Build the second production of the repeat. */ @@ -883,9 +883,9 @@ LangEl *Compiler::makeOptProd( const InputLoc &loc, Namespace *nspace, Production *newDef2 = Production::cons( loc, prodName, prodElList2, String(), false, 0, - prodList.length(), prodName->defList.length() ); + prodList.length(), prodName->prodList.length() ); - prodName->defList.append( newDef2 ); + prodName->prodList.append( newDef2 ); prodList.append( newDef2 ); return prodName; diff --git a/src/compiler.h b/src/compiler.h index d5732b6e..26403dcb 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -113,8 +113,8 @@ struct bindings : public Vector<parse_tree_t*> {}; -struct DefListEl { Production *prev, *next; }; -struct LelDefListEl { Production *prev, *next; }; +struct ProdListEl { Production *prev, *next; }; +struct LelProdListEl { Production *prev, *next; }; typedef Vector< LangEl* > LangElVect; typedef Vector< ProdEl* > FactorVect; @@ -146,7 +146,7 @@ typedef DList<PredDecl> PredDeclList; /* Graph dictionary. */ struct Production : - public DefListEl, public LelDefListEl + public ProdListEl, public LelProdListEl { Production() : @@ -227,15 +227,15 @@ struct CmpDefById typedef BstMap< int, Production*, CmpOrd<int> > DotItemIndex; typedef BstMapEl< int, Production*> DotItemIndexEl; -struct DefList +struct ProdList : - public DListMel<Production, DefListEl> + public DListMel<Production, ProdListEl> {}; /* A vector of production vectors. Each non terminal can have many productions. */ -struct LelDefList +struct LelProdList : - public DListMel<Production, LelDefListEl> + public DListMel<Production, LelProdListEl> {}; /* A set of machines made during a closure round. */ @@ -296,7 +296,7 @@ struct LangEl : public DListEl<LangEl> LangEl *repeatOf; /* Productions from the language element if it is a non-terminal. */ - LelDefList defList; + LelProdList prodList; TokenDef *tokenDef; Production *rootDef; @@ -885,7 +885,7 @@ struct Compiler LelList langEls; StructElList structEls; - DefList prodList; + ProdList prodList; /* Dumping. */ DotItemIndex dotItemIndex; diff --git a/src/consinit.cc b/src/consinit.cc index 4f59b07c..50775084 100644 --- a/src/consinit.cc +++ b/src/consinit.cc @@ -441,53 +441,53 @@ Production *ConsInit::production( ProdEl *prodEl1, ProdEl *prodEl2, void ConsInit::definition( const String &name, Production *prod1, Production *prod2, Production *prod3, Production *prod4 ) { - LelDefList *defList = new LelDefList; - prodAppend( defList, prod1 ); - prodAppend( defList, prod2 ); - prodAppend( defList, prod3 ); - prodAppend( defList, prod4 ); + LelProdList *prodList = new LelProdList; + prodAppend( prodList, prod1 ); + prodAppend( prodList, prod2 ); + prodAppend( prodList, prod3 ); + prodAppend( prodList, prod4 ); NtDef *ntDef = NtDef::cons( name, curNspace(), curStruct(), false ); ObjectDef *objectDef = ObjectDef::cons( ObjectDef::UserType, name, pd->nextObjectId++ ); - cflDef( ntDef, objectDef, defList ); + cflDef( ntDef, objectDef, prodList ); } void ConsInit::definition( const String &name, Production *prod1, Production *prod2, Production *prod3 ) { - LelDefList *defList = new LelDefList; - prodAppend( defList, prod1 ); - prodAppend( defList, prod2 ); - prodAppend( defList, prod3 ); + LelProdList *prodList = new LelProdList; + prodAppend( prodList, prod1 ); + prodAppend( prodList, prod2 ); + prodAppend( prodList, prod3 ); NtDef *ntDef = NtDef::cons( name, curNspace(), curStruct(), false ); ObjectDef *objectDef = ObjectDef::cons( ObjectDef::UserType, name, pd->nextObjectId++ ); - cflDef( ntDef, objectDef, defList ); + cflDef( ntDef, objectDef, prodList ); } void ConsInit::definition( const String &name, Production *prod1, Production *prod2 ) { - LelDefList *defList = new LelDefList; - prodAppend( defList, prod1 ); - prodAppend( defList, prod2 ); + LelProdList *prodList = new LelProdList; + prodAppend( prodList, prod1 ); + prodAppend( prodList, prod2 ); NtDef *ntDef = NtDef::cons( name, curNspace(), curStruct(), false ); ObjectDef *objectDef = ObjectDef::cons( ObjectDef::UserType, name, pd->nextObjectId++ ); - cflDef( ntDef, objectDef, defList ); + cflDef( ntDef, objectDef, prodList ); } void ConsInit::definition( const String &name, Production *prod ) { - LelDefList *defList = new LelDefList; - prodAppend( defList, prod ); + LelProdList *prodList = new LelProdList; + prodAppend( prodList, prod ); NtDef *ntDef = NtDef::cons( name, curNspace(), curStruct(), false ); ObjectDef *objectDef = ObjectDef::cons( ObjectDef::UserType, name, pd->nextObjectId++ ); - cflDef( ntDef, objectDef, defList ); + cflDef( ntDef, objectDef, prodList ); } void ConsInit::lexFactor() diff --git a/src/declare.cc b/src/declare.cc index 74037666..bc770c9e 100644 --- a/src/declare.cc +++ b/src/declare.cc @@ -484,12 +484,12 @@ void Namespace::declare( Compiler *pd ) * the original language element's productions when we enounter * [...]. Afterwards move the newly combined productions * to the nonterminal-definition and proceed with the declaration. */ - LelDefList combined; - while ( n->defList->length() > 0 ) { - Production *prod = n->defList->detachFirst(); + LelProdList combined; + while ( n->prodList->length() > 0 ) { + Production *prod = n->prodList->detachFirst(); if ( prod->dotDotDot ) { prod->prodNum = combined.length(); - combined.append( langEl->defList ); + combined.append( langEl->prodList ); } else { combined.append( prod ); @@ -497,7 +497,7 @@ void Namespace::declare( Compiler *pd ) } /* Move bak to non-term def and proceed with rest of declaration. */ - n->defList->transfer( combined ); + n->prodList->transfer( combined ); } LangEl *langEl = declareLangEl( pd, this, n->name, LangEl::NonTerm ); @@ -506,9 +506,9 @@ void Namespace::declare( Compiler *pd ) langEl->objectDef = n->objectDef; langEl->reduceFirst = n->reduceFirst; langEl->contextIn = n->contextIn; - langEl->defList.transfer( *n->defList ); + langEl->prodList.transfer( *n->prodList ); - for ( LelDefList::Iter d = langEl->defList; d.lte(); d++ ) { + for ( LelProdList::Iter d = langEl->prodList; d.lte(); d++ ) { d->prodName = langEl; if ( d->redBlock != 0 ) { @@ -659,7 +659,7 @@ void Compiler::declareByteCode() for ( FunctionList::Iter f = functionList; f.lte(); f++ ) declareFunction( f ); - for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { + for ( ProdList::Iter prod = prodList; prod.lte(); prod++ ) { if ( prod->redBlock != 0 ) declareReductionCode( prod ); } diff --git a/src/exports.cc b/src/exports.cc index 988499db..2395a0dd 100644 --- a/src/exports.cc +++ b/src/exports.cc @@ -111,14 +111,14 @@ void Compiler::generateExports() } bool prodNames = false; - for ( LelDefList::Iter prod = lel->defList; prod.lte(); prod++ ) { + for ( LelProdList::Iter prod = lel->prodList; prod.lte(); prod++ ) { if ( prod->_name.length() > 0 ) prodNames = true; } if ( prodNames ) { out << " enum prod_name {\n"; - for ( LelDefList::Iter prod = lel->defList; prod.lte(); prod++ ) { + for ( LelProdList::Iter prod = lel->prodList; prod.lte(); prod++ ) { if ( prod->_name.length() > 0 ) out << "\t\t" << prod->_name << " = " << prod->prodNum << ",\n"; } diff --git a/src/loadfinal.cc b/src/loadfinal.cc index 0f9acaa4..d478a446 100644 --- a/src/loadfinal.cc +++ b/src/loadfinal.cc @@ -1092,7 +1092,7 @@ struct LoadColm } void walkProdudction( const String &defName, - LelDefList *lelDefList, prod Prod, bool inRedef ) + LelProdList *lelDefList, prod Prod, bool inRedef ) { if ( Prod.prodName() == prod::DotDotDot ) { if ( !inRedef ) { @@ -1122,7 +1122,7 @@ struct LoadColm } } - void walkProdList( const String &name, LelDefList *lelDefList, + void walkProdList( const String &name, LelProdList *lelDefList, prod_list ProdList, bool inRedef ) { if ( ProdList.prodName() == prod_list::List ) @@ -1333,15 +1333,15 @@ struct LoadColm ObjectDef *objectDef = walkVarDefList( cflDef.VarDefList() ); objectDef->name = name; - LelDefList *defList = new LelDefList; - walkProdList( name, defList, cflDef.prod_list(), false ); + LelProdList *prodList = new LelProdList; + walkProdList( name, prodList, cflDef.prod_list(), false ); bool reduceFirst = cflDef.opt_reduce_first().REDUCEFIRST() != 0; NtDef *ntDef = NtDef::cons( name, curNspace(), curStruct(), reduceFirst ); - BaseParser::cflDef( ntDef, objectDef, defList ); + BaseParser::cflDef( ntDef, objectDef, prodList ); } void walkCflRedef( cfl_redef cflRedef ) @@ -1350,8 +1350,8 @@ struct LoadColm ObjectDef *objectDef = walkVarDefList( cflRedef.VarDefList() ); objectDef->name = name; - LelDefList *defList = new LelDefList; - walkProdList( name, defList, cflRedef.prod_list(), true ); + LelProdList *prodList = new LelProdList; + walkProdList( name, prodList, cflRedef.prod_list(), true ); bool reduceFirst = cflRedef.opt_reduce_first().REDUCEFIRST() != 0; @@ -1359,7 +1359,7 @@ struct LoadColm curStruct(), reduceFirst ); ntDef->isRedef = true; - BaseParser::cflDef( ntDef, objectDef, defList ); + BaseParser::cflDef( ntDef, objectDef, prodList ); } CallArgVect *walkCallArgSeq( call_arg_seq callArgSeq ) diff --git a/src/loadinit.cc b/src/loadinit.cc index f5281da3..d9a047d3 100644 --- a/src/loadinit.cc +++ b/src/loadinit.cc @@ -73,7 +73,7 @@ void LoadInit::walkProdElList( String defName, ProdElList *list, prod_el_list &p } } -void LoadInit::walkProdList( String defName, LelDefList *outProdList, prod_list &prodList ) +void LoadInit::walkProdList( String defName, LelProdList *outProdList, prod_list &prodList ) { if ( prodList.ProdList() != 0 ) { prod_list RightProdList = prodList.ProdList(); @@ -269,13 +269,13 @@ void LoadInit::walkDefinition( item &define ) String name = define.DefId().text().c_str(); - LelDefList *defList = new LelDefList; - walkProdList( name, defList, ProdList ); + LelProdList *prodList = new LelProdList; + walkProdList( name, prodList, ProdList ); NtDef *ntDef = NtDef::cons( name, curNspace(), curStruct(), false ); ObjectDef *objectDef = ObjectDef::cons( ObjectDef::UserType, name, pd->nextObjectId++ ); - cflDef( ntDef, objectDef, defList ); + cflDef( ntDef, objectDef, prodList ); } void LoadInit::consParseStmt( StmtList *stmtList ) diff --git a/src/loadinit.h b/src/loadinit.h index 93a18444..3a78e669 100644 --- a/src/loadinit.h +++ b/src/loadinit.h @@ -62,7 +62,7 @@ struct LoadInit void walkTokenList( token_list &TokenList ); void walkLexRegion( item &LexRegion ); void walkProdElList( String defName, ProdElList *list, prod_el_list &prodElList ); - void walkProdList( String defName, LelDefList *list, prod_list &prodList ); + void walkProdList( String defName, LelProdList *list, prod_list &prodList ); void walkDefinition( item &define ); /* Constructing statements needed to parse and export the input. */ diff --git a/src/parser.cc b/src/parser.cc index 9a711088..ce598e38 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -38,15 +38,15 @@ void BaseParser::listElDef( String name ) ObjectDef *objectDef = ObjectDef::cons( ObjectDef::UserType, name, pd->nextObjectId++ ); - LelDefList *defList = new LelDefList; + LelProdList *prodList = new LelProdList; Production *prod = BaseParser::production( InputLoc(), new ProdElList, String(), false, 0, 0 ); - prodAppend( defList, prod ); + prodAppend( prodList, prod ); NtDef *ntDef = NtDef::cons( name, curNspace(), curStruct(), false ); - BaseParser::cflDef( ntDef, objectDef, defList ); + BaseParser::cflDef( ntDef, objectDef, prodList ); /* * List element with the same name as containing context. @@ -71,14 +71,14 @@ void BaseParser::mapElDef( String name, TypeRef *keyType ) ObjectDef *objectDef = ObjectDef::cons( ObjectDef::UserType, name, pd->nextObjectId++ ); - LelDefList *defList = new LelDefList; + LelProdList *prodList = new LelProdList; Production *prod = BaseParser::production( InputLoc(), new ProdElList, String(), false, 0, 0 ); - prodAppend( defList, prod ); + prodAppend( prodList, prod ); NtDef *ntDef = NtDef::cons( name, curNspace(), curStruct(), false ); - BaseParser::cflDef( ntDef, objectDef, defList ); + BaseParser::cflDef( ntDef, objectDef, prodList ); /* * Same name as containing context. @@ -563,17 +563,17 @@ LangStmt *BaseParser::exportStmt( ObjectField *objField, } -void BaseParser::cflDef( NtDef *ntDef, ObjectDef *objectDef, LelDefList *defList ) +void BaseParser::cflDef( NtDef *ntDef, ObjectDef *objectDef, LelProdList *prodList ) { Namespace *nspace = curNspace(); ntDef->objectDef = objectDef; - ntDef->defList = defList; + ntDef->prodList = prodList; nspace->ntDefList.append( ntDef ); /* Declare the captures in the object. */ - for ( LelDefList::Iter prod = *defList; prod.lte(); prod++ ) { + for ( LelProdList::Iter prod = *prodList; prod.lte(); prod++ ) { if ( prod->prodElList != 0 ) { for ( ProdElList::Iter pel = *prod->prodElList; pel.lte(); pel++ ) { /* If there is a capture, create the field. */ @@ -937,11 +937,11 @@ void BaseParser::objVarDef( ObjectDef *objectDef, ObjectField *objField ) objectDef->rootScope->insertField( objField->name, objField ); } -LelDefList *BaseParser::prodAppend( LelDefList *defList, Production *definition ) +LelProdList *BaseParser::prodAppend( LelProdList *prodList, Production *definition ) { - definition->prodNum = defList->length(); - defList->append( definition ); - return defList; + definition->prodNum = prodList->length(); + prodList->append( definition ); + return prodList; } LangExpr *BaseParser::construct( const InputLoc &loc, ObjectField *objField, diff --git a/src/parser.h b/src/parser.h index aafa3f2b..98956c0a 100644 --- a/src/parser.h +++ b/src/parser.h @@ -114,7 +114,7 @@ struct BaseParser ParameterList *paramList, const String &name ); LangStmt *globalDef( ObjectField *objField, LangExpr *expr, LangStmt::Type assignType ); - void cflDef( NtDef *ntDef, ObjectDef *objectDef, LelDefList *defList ); + void cflDef( NtDef *ntDef, ObjectDef *objectDef, LelProdList *defList ); ReOrBlock *lexRegularExprData( ReOrBlock *reOrBlock, ReOrItem *reOrItem ); int lexFactorRepNum( const InputLoc &loc, const String &data ); @@ -151,7 +151,7 @@ struct BaseParser Production *production( const InputLoc &loc, ProdElList *prodElList, String name, bool commit, CodeBlock *codeBlock, LangEl *predOf ); void objVarDef( ObjectDef *objectDef, ObjectField *objField ); - LelDefList *prodAppend( LelDefList *defList, Production *definition ); + LelProdList *prodAppend( LelProdList *defList, Production *definition ); LangExpr *construct( const InputLoc &loc, ObjectField *objField, ConsItemList *list, TypeRef *typeRef, FieldInitVect *fieldInitVect ); diff --git a/src/parsetree.h b/src/parsetree.h index 2f0a8660..1890bbae 100644 --- a/src/parsetree.h +++ b/src/parsetree.h @@ -492,19 +492,19 @@ struct TokenInstance TokenInstance *dupOf; }; -struct LelDefList; +struct LelProdList; struct NtDef { static NtDef *cons( const String &name, Namespace *nspace, - LelDefList *defList, ObjectDef *objectDef, + LelProdList *prodList, ObjectDef *objectDef, StructDef *contextIn, bool reduceFirst ) { NtDef *nt = new NtDef; nt->name = name; nt->nspace = nspace; - nt->defList = defList; + nt->prodList = prodList; nt->objectDef = objectDef; nt->contextIn = contextIn; nt->reduceFirst = reduceFirst; @@ -520,7 +520,7 @@ struct NtDef nt->name = name; nt->nspace = nspace; - nt->defList = 0; + nt->prodList = 0; nt->objectDef = 0; nt->contextIn = contextIn; nt->reduceFirst = reduceFirst; @@ -531,7 +531,7 @@ struct NtDef String name; Namespace *nspace; - LelDefList *defList; + LelProdList *prodList; ObjectDef *objectDef; StructDef *contextIn; bool reduceFirst; diff --git a/src/pdabuild.cc b/src/pdabuild.cc index 824db1e6..ae2d4e01 100644 --- a/src/pdabuild.cc +++ b/src/pdabuild.cc @@ -172,7 +172,7 @@ void Compiler::makeDefinitionNames() { for ( LelList::Iter lel = langEls; lel.lte(); lel++ ) { int prodNum = 1; - for ( LelDefList::Iter def = lel->defList; def.lte(); def++ ) { + for ( LelProdList::Iter def = lel->prodList; def.lte(); def++ ) { def->data.setAs( lel->name.length() + 32, "%s-%i", lel->name.data, prodNum++ ); } @@ -303,14 +303,14 @@ void Compiler::makeProdFsms() int dsiLow = 0, indexPos = 0; /* Build FSMs for all production language elements. */ - for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) + for ( ProdList::Iter prod = prodList; prod.lte(); prod++ ) prod->fsm = prod->prodElList->walk( this, prod ); makeNonTermFirstSets(); makeFirstSets(); /* Build FSMs for all production language elements. */ - for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { + for ( ProdList::Iter prod = prodList; prod.lte(); prod++ ) { if ( addUniqueEmptyProductions ) { /* This must be re-implemented. */ assert( false ); @@ -366,7 +366,7 @@ void Compiler::makeProdFsms() /* Make the final state specific prod id to prod id mapping. */ prodIdIndex = new Production*[prodList.length()]; - for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) + for ( ProdList::Iter prod = prodList; prod.lte(); prod++ ) prodIdIndex[prod->prodId] = prod; } @@ -398,7 +398,7 @@ void Compiler::findFollow( AlphSet &result, PdaState *overTab, LangEl *langEl = langElIndex[pastTrans->key]; if ( langEl != 0 && langEl->type == LangEl::NonTerm ) { bool hasEpsilon = false; - for ( LelDefList::Iter def = langEl->defList; def.lte(); def++ ) { + for ( LelProdList::Iter def = langEl->prodList; def.lte(); def++ ) { result.insert( def->firstSet ); if ( def->firstSet.find( -1 ) ) @@ -589,18 +589,18 @@ void Compiler::pdaOrderProd( LangEl *rootEl, PdaState *tabState, /* Use a shortest match ordering for the contents of this * nonterminal. Does follows for all productions first, then * goes down the productions. */ - for ( LelDefList::Iter expDef = langEl->defList; expDef.lte(); expDef++ ) { + for ( LelProdList::Iter expDef = langEl->prodList; expDef.lte(); expDef++ ) { pdaOrderFollow( rootEl, tabState, tabTrans, srcTrans->value, parentDef, expDef, time ); } - for ( LelDefList::Iter expDef = langEl->defList; expDef.lte(); expDef++ ) + for ( LelProdList::Iter expDef = langEl->prodList; expDef.lte(); expDef++ ) pdaOrderProd( rootEl, tabState, expDef->fsm->startState, expDef, time ); } else { /* The default action ordering. For each prod, goes down the * prod then sets the follow before going to the next prod. */ - for ( LelDefList::Iter expDef = langEl->defList; expDef.lte(); expDef++ ) { + for ( LelProdList::Iter expDef = langEl->prodList; expDef.lte(); expDef++ ) { pdaOrderProd( rootEl, tabState, expDef->fsm->startState, expDef, time ); pdaOrderFollow( rootEl, tabState, tabTrans, srcTrans->value, @@ -1034,7 +1034,7 @@ void Compiler::analyzeMachine( PdaGraph *pdaGraph, LangElSet &parserEls ) /* Compute the max prod length. */ pdaGraph->maxProdLen = 0; - for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { + for ( ProdList::Iter prod = prodList; prod.lte(); prod++ ) { if ( (unsigned)prod->fsmLength > pdaGraph->maxProdLen ) pdaGraph->maxProdLen = prod->fsmLength; } @@ -1082,9 +1082,9 @@ void Compiler::wrapNonTerminals() ProdElList *prodElList = makeProdElList( lel ); lel->rootDef = Production::cons( InputLoc(), rootLangEl, prodElList, String(), false, 0, - prodList.length(), rootLangEl->defList.length() ); + prodList.length(), rootLangEl->prodList.length() ); prodList.append( lel->rootDef ); - rootLangEl->defList.append( lel->rootDef ); + rootLangEl->prodList.append( lel->rootDef ); /* First resolve. */ for ( ProdElList::Iter prodEl = *prodElList; prodEl.lte(); prodEl++ ) @@ -1103,7 +1103,7 @@ bool Compiler::makeNonTermFirstSetProd( Production *prod, PdaState *state ) bool hasEpsilon = false; LangEl *lel = langElIndex[trans->key]; - for ( LelDefList::Iter ldef = lel->defList; ldef.lte(); ldef++ ) { + for ( LelProdList::Iter ldef = lel->prodList; ldef.lte(); ldef++ ) { for ( ProdIdSet::Iter pid = ldef->nonTermFirstSet; pid.lte(); pid++ ) { @@ -1139,7 +1139,7 @@ void Compiler::makeNonTermFirstSets() bool modified = true; while ( modified ) { modified = false; - for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { + for ( ProdList::Iter prod = prodList; prod.lte(); prod++ ) { if ( prod->fsm->startState->isFinState() ) { long *inserted = prod->nonTermFirstSet.insert( -1 ); if ( inserted != 0 ) @@ -1152,7 +1152,7 @@ void Compiler::makeNonTermFirstSets() } } - for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { + for ( ProdList::Iter prod = prodList; prod.lte(); prod++ ) { if ( prod->nonTermFirstSet.find( prod->prodName->id ) ) prod->isLeftRec = true; } @@ -1160,7 +1160,7 @@ void Compiler::makeNonTermFirstSets() void Compiler::printNonTermFirstSets() { - for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { + for ( ProdList::Iter prod = prodList; prod.lte(); prod++ ) { cerr << prod->data << ": "; for ( ProdIdSet::Iter pid = prod->nonTermFirstSet; pid.lte(); pid++ ) { @@ -1201,7 +1201,7 @@ bool Compiler::makeFirstSetProd( Production *prod, PdaState *state ) bool hasEpsilon = false; LangEl *lel = langElIndex[trans->key]; - for ( LelDefList::Iter ldef = lel->defList; ldef.lte(); ldef++ ) { + for ( LelProdList::Iter ldef = lel->prodList; ldef.lte(); ldef++ ) { for ( ProdIdSet::Iter pid = ldef->firstSet; pid.lte(); pid++ ) { @@ -1237,7 +1237,7 @@ void Compiler::makeFirstSets() bool modified = true; while ( modified ) { modified = false; - for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { + for ( ProdList::Iter prod = prodList; prod.lte(); prod++ ) { if ( prod->fsm->startState->isFinState() ) { long *inserted = prod->firstSet.insert( -1 ); if ( inserted != 0 ) @@ -1253,7 +1253,7 @@ void Compiler::makeFirstSets() void Compiler::printFirstSets() { - for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { + for ( ProdList::Iter prod = prodList; prod.lte(); prod++ ) { cerr << prod->data << ": "; for ( ProdIdSet::Iter pid = prod->firstSet; pid.lte(); pid++ ) { @@ -1274,7 +1274,7 @@ void Compiler::printFirstSets() void Compiler::insertUniqueEmptyProductions() { int limit = prodList.length(); - for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { + for ( ProdList::Iter prod = prodList; prod.lte(); prod++ ) { if ( prod->prodId == limit ) break; @@ -1283,8 +1283,8 @@ void Compiler::insertUniqueEmptyProductions() sprintf(name, "U%li", prodList.length()); LangEl *prodName = addLangEl( this, rootNamespace, name, LangEl::NonTerm ); Production *newDef = Production::cons( InputLoc(), prodName, - 0, String(), false, 0, prodList.length(), prodName->defList.length() ); - prodName->defList.append( newDef ); + 0, String(), false, 0, prodList.length(), prodName->prodList.length() ); + prodName->prodList.append( newDef ); prodList.append( newDef ); prod->uniqueEmptyLeader = prodName; @@ -1380,7 +1380,7 @@ void Compiler::makeRuntimeData() runtimeData->num_prods = count; count = 0; - for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { + for ( ProdList::Iter prod = prodList; prod.lte(); prod++ ) { runtimeData->prod_info[count].lhs_id = prod->prodName->id; runtimeData->prod_info[count].prod_num = prod->prodNum; runtimeData->prod_info[count].length = prod->fsmLength; @@ -2004,7 +2004,7 @@ struct CmpSpan PdaGraph *Compiler::makePdaGraph( LangElSet &parserEls ) { - //for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) + //for ( ProdList::Iter prod = prodList; prod.lte(); prod++ ) // cerr << prod->prodId << " " << prod->data << endl; PdaGraph *pdaGraph = new PdaGraph(); diff --git a/src/resolve.cc b/src/resolve.cc index c1f2cb3d..ac6d9930 100644 --- a/src/resolve.cc +++ b/src/resolve.cc @@ -774,7 +774,7 @@ void Compiler::resolveParseTree() resolveInHost( f ); /* Compile the reduction code. */ - for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { + for ( ProdList::Iter prod = prodList; prod.lte(); prod++ ) { if ( prod->redBlock != 0 ) resolveReductionCode( prod ); } @@ -822,7 +822,7 @@ void Compiler::resolveParseTree() void Compiler::resolveProductionEls() { /* NOTE: as we process this list it may be growing! */ - for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { + for ( ProdList::Iter prod = prodList; prod.lte(); prod++ ) { /* First resolve. */ for ( ProdElList::Iter prodEl = *prod->prodElList; prodEl.lte(); prodEl++ ) resolveProdEl( prodEl ); @@ -910,7 +910,7 @@ void Compiler::resolveReductionActions() Production *Compiler::findProductionByLabel( LangEl *langEl, String label ) { - for ( LelDefList::Iter ldi = langEl->defList; ldi.lte(); ldi++ ) { + for ( LelProdList::Iter ldi = langEl->prodList; ldi.lte(); ldi++ ) { if ( ldi->_name != 0 && ( strcmp( ldi->_name, label ) == 0 ) ) return ldi; } diff --git a/src/synthesis.cc b/src/synthesis.cc index 17c2440a..d049e40d 100644 --- a/src/synthesis.cc +++ b/src/synthesis.cc @@ -3159,7 +3159,7 @@ void Compiler::placeAllFrameObjects() placeFrameFields( f->localFrame ); /* Reduction code. */ - for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { + for ( ProdList::Iter prod = prodList; prod.lte(); prod++ ) { if ( prod->redBlock != 0 ) placeFrameFields( prod->redBlock->localFrame ); } @@ -3346,7 +3346,7 @@ void Compiler::compileByteCode() } /* Compile the reduction code. */ - for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { + for ( ProdList::Iter prod = prodList; prod.lte(); prod++ ) { makeProdCopies( prod ); if ( prod->redBlock != 0 ) compileReductionCode( prod ); |