summaryrefslogtreecommitdiff
path: root/colm
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2013-02-26 01:02:38 +0000
committerAdrian Thurston <thurston@complang.org>2013-02-26 01:02:38 +0000
commit0898e21a8121a85e97523cedc77a71766785a349 (patch)
tree304c7446882231320e3d458545295ed3db8409f6 /colm
parentc9d7a2bf4db3c2f87c81d8e8a408167b09420b67 (diff)
downloadcolm-0898e21a8121a85e97523cedc77a71766785a349.tar.gz
iterate through token def list when declaring language elements
Diffstat (limited to 'colm')
-rw-r--r--colm/declare.cc78
1 files changed, 37 insertions, 41 deletions
diff --git a/colm/declare.cc b/colm/declare.cc
index 0c1e948b..17139b69 100644
--- a/colm/declare.cc
+++ b/colm/declare.cc
@@ -282,28 +282,26 @@ void Namespace::declare( Compiler *pd )
for ( GenericList::Iter g = genericList; g.lte(); g++ )
g->declare( pd, this );
- for ( TokenInstanceListNs::Iter l = tokenInstanceList; l.lte(); l++ ) {
- if ( l->dupOf == 0 ) {
- if ( l->tokenDef->isLiteral ) {
- if ( l->tokenDef->isZero ) {
- assert( l->tokenDef->tokenRegion->ciLel != 0 );
- l->tokenDef->tdLangEl = l->tokenDef->tokenRegion->ciLel;
- }
- else {
- /* Original. Create a token for the literal. */
- LangEl *newLangEl = declareLangEl( pd, this, l->tokenDef->name, LangEl::Term );
-
- newLangEl->lit = l->tokenDef->literal;
- newLangEl->isLiteral = true;
- newLangEl->tokenDef = l->tokenDef;
-
- l->tokenDef->tdLangEl = newLangEl;
-
- if ( l->tokenDef->noPreIgnore )
- newLangEl->noPreIgnore = true;
- if ( l->tokenDef->noPostIgnore )
- newLangEl->noPostIgnore = true;
- }
+ for ( TokenDefListNs::Iter tokenDef = tokenDefList; tokenDef.lte(); tokenDef++ ) {
+ if ( tokenDef->isLiteral ) {
+ if ( tokenDef->isZero ) {
+ assert( tokenDef->tokenRegion->ciLel != 0 );
+ tokenDef->tdLangEl = tokenDef->tokenRegion->ciLel;
+ }
+ else {
+ /* Original. Create a token for the literal. */
+ LangEl *newLangEl = declareLangEl( pd, this, tokenDef->name, LangEl::Term );
+
+ newLangEl->lit = tokenDef->literal;
+ newLangEl->isLiteral = true;
+ newLangEl->tokenDef = tokenDef;
+
+ tokenDef->tdLangEl = newLangEl;
+
+ if ( tokenDef->noPreIgnore )
+ newLangEl->noPreIgnore = true;
+ if ( tokenDef->noPostIgnore )
+ newLangEl->noPostIgnore = true;
}
}
}
@@ -340,25 +338,23 @@ void Namespace::declare( Compiler *pd )
lel->objectDef = c->context->contextObjDef;
}
- for ( TokenInstanceListNs::Iter t = tokenInstanceList; t.lte(); t++ ) {
- if ( t->dupOf == 0 ) {
- /* Literals already taken care of. */
- if ( ! t->tokenDef->isLiteral ) {
- /* Create the token. */
- LangEl *tokEl = declareLangEl( pd, this, t->tokenDef->name, LangEl::Term );
- tokEl->isIgnore = t->tokenDef->isIgnore;
- tokEl->transBlock = t->tokenDef->codeBlock;
- tokEl->objectDef = t->tokenDef->objectDef;
- tokEl->contextIn = t->tokenDef->contextIn;
- tokEl->tokenDef = t->tokenDef;
-
- if ( t->tokenDef->noPreIgnore )
- tokEl->noPreIgnore = true;
- if ( t->tokenDef->noPostIgnore )
- tokEl->noPostIgnore = true;
-
- t->tokenDef->tdLangEl = tokEl;
- }
+ for ( TokenDefListNs::Iter tokenDef = tokenDefList; tokenDef.lte(); tokenDef++ ) {
+ /* Literals already taken care of. */
+ if ( ! tokenDef->isLiteral ) {
+ /* Create the token. */
+ LangEl *tokEl = declareLangEl( pd, this, tokenDef->name, LangEl::Term );
+ tokEl->isIgnore = tokenDef->isIgnore;
+ tokEl->transBlock = tokenDef->codeBlock;
+ tokEl->objectDef = tokenDef->objectDef;
+ tokEl->contextIn = tokenDef->contextIn;
+ tokEl->tokenDef = tokenDef;
+
+ if ( tokenDef->noPreIgnore )
+ tokEl->noPreIgnore = true;
+ if ( tokenDef->noPostIgnore )
+ tokEl->noPostIgnore = true;
+
+ tokenDef->tdLangEl = tokEl;
}
}