summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2013-04-07 09:27:40 -0400
committerAdrian Thurston <thurston@complang.org>2013-04-07 09:27:40 -0400
commitf2c2fe5e637d3c03407ca835bba125784e0af1f1 (patch)
tree06f7f3d795beaa5ca7b5ab56f34590e5fbdfd247
parentf8913779ce2793fc1f9996236e7c8a7ab18e31a1 (diff)
downloadcolm-f2c2fe5e637d3c03407ca835bba125784e0af1f1.tar.gz
collect-ignore property and pointers rephrased to 'zero'
-rw-r--r--colm/declare.cc14
-rw-r--r--colm/exports.cc17
-rw-r--r--colm/parsedata.h2
-rw-r--r--colm/parser.cc1
-rw-r--r--colm/parsetree.h7
-rw-r--r--colm/pdabuild.cc6
-rw-r--r--colm/redbuild.cc2
7 files changed, 17 insertions, 32 deletions
diff --git a/colm/declare.cc b/colm/declare.cc
index cdd279a5..faa4f7dc 100644
--- a/colm/declare.cc
+++ b/colm/declare.cc
@@ -306,8 +306,8 @@ void Namespace::declare( Compiler *pd )
for ( TokenDefListNs::Iter tokenDef = tokenDefList; tokenDef.lte(); tokenDef++ ) {
if ( tokenDef->isLiteral ) {
if ( tokenDef->isZero ) {
- assert( tokenDef->regionSet->collectIgnore->ciLel != 0 );
- tokenDef->tdLangEl = tokenDef->regionSet->collectIgnore->ciLel;
+ assert( tokenDef->regionSet->collectIgnore->zeroLel != 0 );
+ tokenDef->tdLangEl = tokenDef->regionSet->collectIgnore->zeroLel;
}
else {
/* Original. Create a token for the literal. */
@@ -426,12 +426,12 @@ void Compiler::makeIgnoreCollectors()
for ( RegionSetList::Iter regionSet = regionSetList; regionSet.lte(); regionSet++ ) {
if ( regionSet->tokenIgnore != rootRegion && regionSet->tokenIgnore != defaultRegion ) {
String name( 128, "_ign_%p", regionSet->tokenIgnore );
- LangEl *ignLel = new LangEl( rootNamespace, name, LangEl::Term );
- langEls.append( ignLel );
- ignLel->isCI = true;
- ignLel->regionSet = regionSet;
+ LangEl *zeroLel = new LangEl( rootNamespace, name, LangEl::Term );
+ langEls.append( zeroLel );
+ zeroLel->isZero = true;
+ zeroLel->regionSet = regionSet;
- regionSet->collectIgnore->ciLel = ignLel;
+ regionSet->collectIgnore->zeroLel = zeroLel;
}
}
}
diff --git a/colm/exports.cc b/colm/exports.cc
index 071aca85..b15af16b 100644
--- a/colm/exports.cc
+++ b/colm/exports.cc
@@ -94,14 +94,9 @@ void Compiler::generateExports()
/* Declare. */
for ( LelList::Iter lel = langEls; lel.lte(); lel++ ) {
- if ( lel->isEOF ) {
- out << "// isEOF\n";
+ if ( lel->isEOF || lel->isZero )
continue;
- }
- if ( lel->isCI != 0 ) {
- out << "// isCI != 0\n";
- continue;
- }
+
openNameSpace( out, lel->nspace );
out << "struct " << lel->fullName << ";";
closeNameSpace( out, lel->nspace );
@@ -110,14 +105,8 @@ void Compiler::generateExports()
/* Class definitions. */
for ( LelList::Iter lel = langEls; lel.lte(); lel++ ) {
- if ( lel->isEOF ) {
- out << "// isEOF\n";
- continue;
- }
- if ( lel->isCI != 0 ) {
- out << "// isCI != 0\n";
+ if ( lel->isEOF || lel->isZero )
continue;
- }
openNameSpace( out, lel->nspace );
out << "struct " << lel->fullName << "\n";
diff --git a/colm/parsedata.h b/colm/parsedata.h
index 1aae3040..8fd634d5 100644
--- a/colm/parsedata.h
+++ b/colm/parsedata.h
@@ -296,7 +296,7 @@ struct LangEl : public DListEl<LangEl>
Context *contextIn;
bool noPreIgnore;
bool noPostIgnore;
- bool isCI;
+ bool isZero;
RegionSet *regionSet;
};
diff --git a/colm/parser.cc b/colm/parser.cc
index 98cf6c8e..bd3f6abc 100644
--- a/colm/parser.cc
+++ b/colm/parser.cc
@@ -112,7 +112,6 @@ void BaseParser::pushRegionSet( const InputLoc &loc )
RegionSet *regionSet = new RegionSet( tokenIgnore,
tokenOnly, ignoreOnly, collectIgnore );
- collectIgnore->isCiOnly = true;
collectIgnore->ignoreOnly = ignoreOnly;
pd->regionSetList.append( regionSet );
diff --git a/colm/parsetree.h b/colm/parsetree.h
index 6adc09a2..9ecbc790 100644
--- a/colm/parsetree.h
+++ b/colm/parsetree.h
@@ -580,8 +580,7 @@ struct TokenRegion
defaultTokenInstance(0),
preEofBlock(0),
wasEmpty(false),
- isCiOnly(false),
- ciLel(0),
+ zeroLel(0),
ignoreOnly(0)
{ }
@@ -615,9 +614,7 @@ struct TokenRegion
* then wasEmpty is true. */
bool wasEmpty;
- bool isCiOnly;
-
- LangEl *ciLel;
+ LangEl *zeroLel;
TokenRegion *ignoreOnly;
TokenRegion *next, *prev;
diff --git a/colm/pdabuild.cc b/colm/pdabuild.cc
index 5055cbea..526c3b53 100644
--- a/colm/pdabuild.cc
+++ b/colm/pdabuild.cc
@@ -93,7 +93,7 @@ LangEl::LangEl( Namespace *nspace, const String &name, Type type )
contextIn(0),
noPreIgnore(false),
noPostIgnore(false),
- isCI(false)
+ isZero(false)
{
}
@@ -479,7 +479,7 @@ void Compiler::addRegion( PdaState *tabState, PdaTrans *tabTrans,
/* If it is not the eof, then use the region associated
* with the token definition. */
- if ( langEl->isCI ) {
+ if ( langEl->isZero ) {
region = langEl->regionSet->collectIgnore;
regionSet = langEl->regionSet;
}
@@ -1352,7 +1352,7 @@ void Compiler::makeRuntimeData()
runtimeData->regionInfo[regId].defaultToken =
reg->defaultTokenInstance == 0 ? -1 : reg->defaultTokenInstance->tokenDef->tdLangEl->id;
runtimeData->regionInfo[regId].eofFrameId = -1;
- runtimeData->regionInfo[regId].ciLelId = reg->ciLel != 0 ? reg->ciLel->id : 0;
+ runtimeData->regionInfo[regId].ciLelId = reg->zeroLel != 0 ? reg->zeroLel->id : 0;
CodeBlock *block = reg->preEofBlock;
if ( block != 0 ) {
diff --git a/colm/redbuild.cc b/colm/redbuild.cc
index 9fb39043..3372c19e 100644
--- a/colm/redbuild.cc
+++ b/colm/redbuild.cc
@@ -491,7 +491,7 @@ void RedFsmBuild::makeEntryPoints()
TokenRegion *use = reg;
- if ( use->ciLel != 0 )
+ if ( use->zeroLel != 0 )
use = use->ignoreOnly;
NameInst *regionName = use->regionNameInst;