summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2012-05-28 20:59:42 -0400
committerAdrian Thurston <thurston@complang.org>2012-05-28 20:59:42 -0400
commit96c1648420152ddc6b91220dcca0156ec477587a (patch)
treedb1b15a212b5a08ff0651b418db3997242652dce
parent21fd4c27a9fab0bbd8e71611bae587719b7b1a31 (diff)
downloadcolm-96c1648420152ddc6b91220dcca0156ec477587a.tar.gz
only need regions in the name tree.
-rw-r--r--colm/compiler.cc13
-rw-r--r--colm/parsetree.cc125
2 files changed, 0 insertions, 138 deletions
diff --git a/colm/compiler.cc b/colm/compiler.cc
index bf45e818..c1e775f2 100644
--- a/colm/compiler.cc
+++ b/colm/compiler.cc
@@ -878,19 +878,6 @@ void Compiler::printNameIndex( NameInst **nameIndex )
}
}
-/* Build the name tree and supporting data structures. */
-NameInst *Compiler::makeJoinNameTree( Join *join )
-{
- /* Create the root name. */
- nextNameId = 0;
- NameInst *rootName = new NameInst( InputLoc(), 0, 0, nextNameId++, false );
-
- /* Make the name tree. */
- initNameWalk( rootName );
- join->makeNameTree( this );
-
- return rootName;
-}
/* Build the name tree and supporting data structures. */
NameInst *Compiler::makeNameTree()
diff --git a/colm/parsetree.cc b/colm/parsetree.cc
index b8406565..38f2e503 100644
--- a/colm/parsetree.cc
+++ b/colm/parsetree.cc
@@ -182,9 +182,6 @@ int CmpUniqueParser::compare( const UniqueParser &ut1, const UniqueParser &ut2 )
FsmGraph *VarDef::walk( Compiler *pd )
{
- /* We enter into a new name scope. */
- NameFrame nameFrame = pd->enterNameScope( true, 1 );
-
/* Recurse on the expression. */
FsmGraph *rtnVal = join->walk( pd );
@@ -209,23 +206,9 @@ FsmGraph *VarDef::walk( Compiler *pd )
if ( pd->curNameInst->numRefs > 0 )
rtnVal->setEntry( pd->curNameInst->id, rtnVal->startState );
- /* Pop the name scope. */
- pd->popNameScope( nameFrame );
return rtnVal;
}
-void VarDef::makeNameTree( const InputLoc &loc, Compiler *pd )
-{
- /* The variable definition enters a new scope. */
- NameInst *prevNameInst = pd->curNameInst;
- pd->curNameInst = pd->addNameInst( loc, name, false );
-
- /* Recurse. */
- join->makeNameTree( pd );
-
- /* The name scope ends, pop the name instantiation. */
- pd->curNameInst = prevNameInst;
-}
FsmGraph *RegionDef::walk( Compiler *pd )
{
@@ -374,13 +357,6 @@ void TokenRegion::makeNameTree( Compiler *pd )
assert( regionNameInst == 0 );
regionNameInst = pd->curNameInst;
- /* Recurse into all parts of the longest match operator. */
- for ( TokenDefListReg::Iter td = tokenDefList; td.lte(); td++ ) {
- /* Watch out for patternless tokens. */
- if ( td->join != 0 )
- td->join->makeNameTree( pd );
- }
-
/* The name scope ends, pop the name instantiation. */
pd->curNameInst = prevNameInst;
}
@@ -658,19 +634,6 @@ FsmGraph *Join::walk( Compiler *pd )
return retFsm;
}
-void Join::makeNameTree( Compiler *pd )
-{
- assert( exprList.length() == 1 );
-
- /* Recurse into the single expression. */
- exprList.head->makeNameTree( pd );
-
- /* Maybe the the context. */
- if ( context != 0 )
- context->makeNameTree( pd );
-}
-
-
/* Clean up after an expression node. */
Expression::~Expression()
{
@@ -754,24 +717,6 @@ FsmGraph *Expression::walk( Compiler *pd, bool lastInSeq )
return rtnVal;
}
-void Expression::makeNameTree( Compiler *pd )
-{
- switch ( type ) {
- case OrType:
- case IntersectType:
- case SubtractType:
- case StrongSubtractType:
- expression->makeNameTree( pd );
- term->makeNameTree( pd );
- break;
- case TermType:
- term->makeNameTree( pd );
- break;
- case BuiltinType:
- break;
- }
-}
-
/* Clean up after a term node. */
Term::~Term()
{
@@ -888,22 +833,6 @@ FsmGraph *Term::walk( Compiler *pd, bool lastInSeq )
return rtnVal;
}
-void Term::makeNameTree( Compiler *pd )
-{
- switch ( type ) {
- case ConcatType:
- case RightStartType:
- case RightFinishType:
- case LeftType:
- term->makeNameTree( pd );
- factorWithAug->makeNameTree( pd );
- break;
- case FactorWithAugType:
- factorWithAug->makeNameTree( pd );
- break;
- }
-}
-
/* Clean up after a factor with augmentation node. */
FactorWithAug::~FactorWithAug()
{
@@ -1189,12 +1118,6 @@ FsmGraph *FactorWithAug::walk( Compiler *pd )
return rtnVal;
}
-void FactorWithAug::makeNameTree( Compiler *pd )
-{
- NameInst *prevNameInst = pd->curNameInst;
- factorWithRep->makeNameTree( pd );
- pd->curNameInst = prevNameInst;
-}
/* Clean up after a factor with repetition node. */
FactorWithRep::~FactorWithRep()
@@ -1452,24 +1375,6 @@ FsmGraph *FactorWithRep::walk( Compiler *pd )
return retFsm;
}
-void FactorWithRep::makeNameTree( Compiler *pd )
-{
- switch ( type ) {
- case StarType:
- case StarStarType:
- case OptionalType:
- case PlusType:
- case ExactType:
- case MaxType:
- case MinType:
- case RangeType:
- factorWithRep->makeNameTree( pd );
- break;
- case FactorWithNegType:
- factorWithNeg->makeNameTree( pd );
- break;
- }
-}
/* Clean up after a factor with negation node. */
FactorWithNeg::~FactorWithNeg()
@@ -1519,20 +1424,6 @@ FsmGraph *FactorWithNeg::walk( Compiler *pd )
return retFsm;
}
-void FactorWithNeg::makeNameTree( Compiler *pd )
-{
- switch ( type ) {
- case NegateType:
- case CharNegateType:
- factorWithNeg->makeNameTree( pd );
- break;
- case FactorType:
- factor->makeNameTree( pd );
- break;
- }
-}
-
-
/* Clean up after a factor node. */
Factor::~Factor()
{
@@ -1585,22 +1476,6 @@ FsmGraph *Factor::walk( Compiler *pd )
return rtnVal;
}
-void Factor::makeNameTree( Compiler *pd )
-{
- switch ( type ) {
- case LiteralType:
- case RangeType:
- case OrExprType:
- case RegExprType:
- break;
- case ReferenceType:
- varDef->makeNameTree( loc, pd );
- break;
- case ParenType:
- join->makeNameTree( pd );
- break;
- }
-}
/* Clean up a range object. Must delete the two literals. */
Range::~Range()