diff options
author | Adrian Thurston <thurston@complang.org> | 2012-05-25 01:16:58 +0000 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2012-05-25 01:16:58 +0000 |
commit | 7002b23612df9071f417f0da99bf0b7cf4a0fd24 (patch) | |
tree | 98c60af7aae10b02b343c5a300d585de67885861 /colm | |
parent | 270fd57e97eeda35b09fd2c5669ab9fdaeee290e (diff) | |
download | colm-7002b23612df9071f417f0da99bf0b7cf4a0fd24.tar.gz |
cleanup of collect-ignore
Suppress code generation of types that are duplicates into the ignore/token/ci
regions. Removed some print statements used for debugging.
Diffstat (limited to 'colm')
-rw-r--r-- | colm/codegen.cc | 33 | ||||
-rw-r--r-- | colm/lmparse.kl | 2 | ||||
-rw-r--r-- | colm/parsetree.cc | 4 | ||||
-rw-r--r-- | colm/pdabuild.cc | 6 | ||||
-rw-r--r-- | colm/redfsm.cc | 1 | ||||
-rw-r--r-- | colm/resolve.cc | 2 |
6 files changed, 38 insertions, 10 deletions
diff --git a/colm/codegen.cc b/colm/codegen.cc index b6adc935..c2eab634 100644 --- a/colm/codegen.cc +++ b/colm/codegen.cc @@ -86,6 +86,22 @@ void ParseData::generateExports() /* Declare. */ for ( LelList::Iter lel = langEls; lel.lte(); lel++ ) { + if ( lel->tokenDef != 0 && lel->tokenDef->tokenRegion != 0 && lel->tokenDef->tokenRegion->isTokenOnly ) { + out << "// isTokenOnly\n"; + continue; + } + if ( lel->tokenDef != 0 && lel->tokenDef->tokenRegion != 0 && lel->tokenDef->tokenRegion->isIgnoreOnly ) { + out << "// isIgnoreOnly\n"; + continue; + } + if ( lel->tokenDef != 0 && lel->tokenDef->tokenRegion != 0 && lel->tokenDef->tokenRegion->isCiOnly ) { + out << "// isCiOnly\n"; + continue; + } + if ( lel->ciRegion != 0 ) { + out << "// ciRegion != 0\n"; + continue; + } openNameSpace( out, lel->nspace ); out << "struct " << lel->fullName << ";"; closeNameSpace( out, lel->nspace ); @@ -94,6 +110,23 @@ void ParseData::generateExports() /* Class definitions. */ for ( LelList::Iter lel = langEls; lel.lte(); lel++ ) { + if ( lel->tokenDef != 0 && lel->tokenDef->tokenRegion != 0 && lel->tokenDef->tokenRegion->isTokenOnly ) { + out << "// isTokenOnly\n"; + continue; + } + if ( lel->tokenDef != 0 && lel->tokenDef->tokenRegion != 0 && lel->tokenDef->tokenRegion->isIgnoreOnly ) { + out << "// isIgnoreOnly\n"; + continue; + } + if ( lel->tokenDef != 0 && lel->tokenDef->tokenRegion != 0 && lel->tokenDef->tokenRegion->isCiOnly ) { + out << "// isCiOnly\n"; + continue; + } + if ( lel->ciRegion != 0 ) { + out << "// ciRegion != 0\n"; + continue; + } + openNameSpace( out, lel->nspace ); out << "struct " << lel->fullName << "\n"; out << "{\n"; diff --git a/colm/lmparse.kl b/colm/lmparse.kl index b93c1da0..2d5677b8 100644 --- a/colm/lmparse.kl +++ b/colm/lmparse.kl @@ -392,7 +392,7 @@ define_prod: opt_collect_ignore '[' prod_el_list ']' opt_commit opt_reduce_code if ( $1->value ) { for ( RegionList::Iter r = pd->regionList; r.lte(); r++ ) { if ( strcmp( r->name.data, $1->region.data ) == 0 ) { - cerr << "assigning collect ignore " << r->name << endl; + //cerr << "assigning collect ignore " << r->name << endl; newDef->collectIgnoreRegion = r; } } diff --git a/colm/parsetree.cc b/colm/parsetree.cc index aca5b179..f613ff3b 100644 --- a/colm/parsetree.cc +++ b/colm/parsetree.cc @@ -206,10 +206,8 @@ FsmGraph *VarDef::walk( ParseData *pd ) /* If the name of the variable is referenced then add the entry point to * the graph. */ - if ( pd->curNameInst->numRefs > 0 ) { - std::cerr << "entry: " << pd->curNameInst->name << " " << pd->curNameInst->id << endl; + if ( pd->curNameInst->numRefs > 0 ) rtnVal->setEntry( pd->curNameInst->id, rtnVal->startState ); - } /* Pop the name scope. */ pd->popNameScope( nameFrame ); diff --git a/colm/pdabuild.cc b/colm/pdabuild.cc index c22369b3..b72eee28 100644 --- a/colm/pdabuild.cc +++ b/colm/pdabuild.cc @@ -104,8 +104,8 @@ PdaGraph *ProdElList::walk( ParseData *pd, Definition *prod ) prodFsm->setStartState( last ); if ( prod->collectIgnoreRegion != 0 ) { - cerr << "production " << prod->data << " has collect ignore region " << - prod->collectIgnoreRegion->name << endl; +// cerr << "production " << prod->data << " has collect ignore region " << +// prod->collectIgnoreRegion->name << endl; /* Use the IGNORE TOKEN lang el for the region. */ long value = prod->collectIgnoreRegion->ciLel->id; @@ -495,7 +495,7 @@ void ParseData::addRegion( PdaState *tabState, PdaTrans *tabTrans, /* If it is not the eof, then use the region associated * with the token definition. */ if ( langEl->isCI ) { - cerr << "isCI" << endl; + //cerr << "isCI" << endl; region = langEl->ciRegion->ciRegion; } else if ( !langEl->isEOF && langEl->tokenDef != 0 ) { diff --git a/colm/redfsm.cc b/colm/redfsm.cc index 911488ad..d3a65b7c 100644 --- a/colm/redfsm.cc +++ b/colm/redfsm.cc @@ -1098,7 +1098,6 @@ FsmTables *RedFsm::makeFsmTables() pos = 1; for ( RegionToEntry::Iter en = regionToEntry; en.lte(); en++ ) { - std::cerr << "en: " << *en << std::endl; /* Find the entry state from the entry id. */ RedEntryMapEl *entryMapEl = redEntryMap.find( *en ); diff --git a/colm/resolve.cc b/colm/resolve.cc index 0cc59dcd..ed6ed671 100644 --- a/colm/resolve.cc +++ b/colm/resolve.cc @@ -765,8 +765,6 @@ void ParseData::makeIgnoreCollectors() { for ( RegionList::Iter region = regionList; region.lte(); region++ ) { if ( region->isFullRegion ) { - cout << "region: " << region->name << endl; - String name( region->name.length() + 5, "_ign_%s", region->name.data ); LangEl *ignLel = new LangEl( rootNamespace, name, LangEl::Term ); langEls.append( ignLel ); |