summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2011-07-07 02:07:23 +0000
committerAdrian Thurston <thurston@complang.org>2011-07-07 02:07:23 +0000
commit2f46e69d77da459a2857b857b1fbe65b5bd03228 (patch)
tree5d88c0a9c73ebf16cd9ffd9ca57c22281528dcba
parent587232ded3f23b10b87d744d9fd4d5605b1fd2b8 (diff)
downloadcolm-2f46e69d77da459a2857b857b1fbe65b5bd03228.tar.gz
KlangEl -> LangEl
-rw-r--r--colm/closure.cc34
-rw-r--r--colm/compile.cc16
-rw-r--r--colm/ctinput.cc10
-rw-r--r--colm/declare.cc62
-rw-r--r--colm/dotgen.cc2
-rw-r--r--colm/fsmcodegen.cc2
-rw-r--r--colm/fsmcodegen.h2
-rw-r--r--colm/input.h4
-rw-r--r--colm/lmparse.kh2
-rw-r--r--colm/lmparse.kl4
-rw-r--r--colm/parsedata.cc34
-rw-r--r--colm/parsedata.h96
-rw-r--r--colm/parsetree.h28
-rw-r--r--colm/pdabuild.cc74
-rw-r--r--colm/pdagraph.h4
-rw-r--r--colm/resolve.cc6
16 files changed, 190 insertions, 190 deletions
diff --git a/colm/closure.cc b/colm/closure.cc
index ed3c3fa4..47901e32 100644
--- a/colm/closure.cc
+++ b/colm/closure.cc
@@ -72,8 +72,8 @@ void ParseData::lr0BringInItem( PdaGraph *pdaGraph, PdaState *dest, PdaState *pr
dest->transMap.insert( srcTrans->lowKey, newTrans, &destTel );
/* If the item is a non-term, queue it for closure. */
- KlangEl *langEl = langElIndex[srcTrans->lowKey];
- if ( langEl != 0 && langEl->type == KlangEl::NonTerm ) {
+ LangEl *langEl = langElIndex[srcTrans->lowKey];
+ if ( langEl != 0 && langEl->type == LangEl::NonTerm ) {
pdaGraph->transClosureQueue.append( newTrans );
//cerr << "put to trans closure queue" << endl;
}
@@ -123,7 +123,7 @@ void ParseData::lr0InvokeClosure( PdaGraph *pdaGraph, PdaState *state )
//cerr << "have a transition to derive" << endl;
/* Get the langEl. */
- KlangEl *langEl = langElIndex[toClose->lowKey];
+ LangEl *langEl = langElIndex[toClose->lowKey];
/* Make graphs for all of the productions that the non
* terminal goes to that are not already in the state's dotSet. */
@@ -249,14 +249,14 @@ void ParseData::lalr1AddFollow1( PdaGraph *pdaGraph, PdaState *state )
/* Finding non-terminals into the state. */
for ( PdaTransInList::Iter in = state->inRange; in.lte(); in++ ) {
long key = in->lowKey;
- KlangEl *langEl = langElIndex[key];
- if ( langEl != 0 && langEl->type == KlangEl::NonTerm ) {
+ LangEl *langEl = langElIndex[key];
+ if ( langEl != 0 && langEl->type == LangEl::NonTerm ) {
/* Finding the following transitions. */
FollowToAdd followKeys;
for ( TransMap::Iter fout = state->transMap; fout.lte(); fout++ ) {
int fkey = fout->key;
- KlangEl *flel = langElIndex[fkey];
- if ( flel == 0 || flel->type == KlangEl::Term ) {
+ LangEl *flel = langElIndex[fkey];
+ if ( flel == 0 || flel->type == LangEl::Term ) {
long prior = fout->value->maxPrior();
followKeys.insert( fkey, prior );
}
@@ -304,13 +304,13 @@ void ParseData::lalr1AddFollow1( PdaGraph *pdaGraph, PdaTrans *trans )
{
PdaState *state = trans->fromState;
int fkey = trans->lowKey;
- KlangEl *flel = langElIndex[fkey];
- if ( flel == 0 || flel->type == KlangEl::Term ) {
+ LangEl *flel = langElIndex[fkey];
+ if ( flel == 0 || flel->type == LangEl::Term ) {
/* Finding non-terminals into the state. */
for ( PdaTransInList::Iter in = state->inRange; in.lte(); in++ ) {
long key = in->lowKey;
- KlangEl *langEl = langElIndex[key];
- if ( langEl != 0 && langEl->type == KlangEl::NonTerm ) {
+ LangEl *langEl = langElIndex[key];
+ if ( langEl != 0 && langEl->type == LangEl::NonTerm ) {
//cerr << "FOLLOW PRIOR TRANSFER 2: " << prior << endl;
long prior = trans->maxPrior();
lalr1AddFollow2( pdaGraph, in, fkey, prior );
@@ -361,14 +361,14 @@ void ParseData::linkExpansions( PdaGraph *pdaGraph )
/* Find transitions out on non terminals. */
for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) {
long key = trans->key;
- KlangEl *langEl = langElIndex[key];
- if ( langEl != 0 && langEl->type == KlangEl::NonTerm ) {
+ 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++ ) {
/* Follow the production and add to the trans's expand to set. */
PdaState *followRes = pdaGraph->followFsm( state, prod->fsm );
- //KlangEl *lel = langElIndex[key];
+ //LangEl *lel = langElIndex[key];
//cerr << state->stateNum << ", ";
//if ( lel != 0 )
// cerr << lel->data;
@@ -389,8 +389,8 @@ void ParseData::addDupTerms( PdaGraph *pdaGraph )
for ( PdaStateList::Iter state = pdaGraph->stateList; state.lte(); state++ ) {
PdaTransList newTranitions;
for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) {
- KlangEl *lel = langElIndex[trans->value->lowKey];
- if ( lel->type == KlangEl::NonTerm ) {
+ LangEl *lel = langElIndex[trans->value->lowKey];
+ if ( lel->type == LangEl::NonTerm ) {
PdaTrans *dupTrans = new PdaTrans;
dupTrans->lowKey = lel->termDup->id;
dupTrans->isShift = true;
@@ -423,7 +423,7 @@ void ParseData::lalr1GenerateParser( PdaGraph *pdaGraph, KlangElSet &parserEls )
/* Make the intial graph. */
pdaGraph->langElIndex = langElIndex;
- for ( Vector<KlangEl*>::Iter r = parserEls; r.lte(); r++ ) {
+ for ( Vector<LangEl*>::Iter r = parserEls; r.lte(); r++ ) {
/* Create the entry point. */
PdaState *rs = pdaGraph->addState();
pdaGraph->entryStateSet.insert( rs );
diff --git a/colm/compile.cc b/colm/compile.cc
index f9b70b52..96fa88df 100644
--- a/colm/compile.cc
+++ b/colm/compile.cc
@@ -197,7 +197,7 @@ UniqueType *ParseData::findUniqueType( int typeId )
return uniqueType;
}
-UniqueType *ParseData::findUniqueType( int typeId, KlangEl *langEl )
+UniqueType *ParseData::findUniqueType( int typeId, LangEl *langEl )
{
UniqueType searchKey( typeId, langEl );
UniqueType *uniqueType = uniqeTypeMap.find( &searchKey );
@@ -2221,7 +2221,7 @@ void CodeBlock::compile( ParseData *pd, CodeVect &code ) const
stmt->compile( pd, code );
}
-void ParseData::addMatchLength( ObjectDef *frame, KlangEl *lel )
+void ParseData::addMatchLength( ObjectDef *frame, LangEl *lel )
{
/* Make the type ref. */
TypeRef *typeRef = new TypeRef( InputLoc(), uniqueTypeInt );
@@ -2236,7 +2236,7 @@ void ParseData::addMatchLength( ObjectDef *frame, KlangEl *lel )
frame->insertField( el->name, el );
}
-void ParseData::addMatchText( ObjectDef *frame, KlangEl *lel )
+void ParseData::addMatchText( ObjectDef *frame, LangEl *lel )
{
/* Make the type ref. */
TypeRef *typeRef = new TypeRef( InputLoc(), uniqueTypeStr );
@@ -2251,7 +2251,7 @@ void ParseData::addMatchText( ObjectDef *frame, KlangEl *lel )
frame->insertField( el->name, el );
}
-void ParseData::addInput( ObjectDef *frame, KlangEl *lel )
+void ParseData::addInput( ObjectDef *frame, LangEl *lel )
{
/* Make the type ref. */
TypeRef *typeRef = new TypeRef( InputLoc(), uniqueTypeStream );
@@ -2269,7 +2269,7 @@ void ParseData::addInput( ObjectDef *frame, KlangEl *lel )
frame->insertField( el->name, el );
}
-void ParseData::addCtx( ObjectDef *frame, KlangEl *lel )
+void ParseData::addCtx( ObjectDef *frame, LangEl *lel )
{
/* Make the type ref. */
TypeRef *typeRef = new TypeRef( InputLoc(), uniqueTypeStream );
@@ -2504,7 +2504,7 @@ void ParseData::compileReductionCode( Definition *prod )
findLocalTrees( block->trees );
}
-void ParseData::compileTranslateBlock( KlangEl *langEl )
+void ParseData::compileTranslateBlock( LangEl *langEl )
{
CodeBlock *block = langEl->transBlock;
@@ -2728,7 +2728,7 @@ void ParseData::initAccumFunctions( GenericType *gen )
void ParseData::initCtxField( GenericType *gen )
{
- KlangEl *langEl = gen->utArg->langEl;
+ LangEl *langEl = gen->utArg->langEl;
Context *context = langEl->contextIn;
/* Make the type ref and create the field. */
@@ -2751,7 +2751,7 @@ void ParseData::initCtxField( GenericType *gen )
void ParseData::initAccumFields( GenericType *gen )
{
- KlangEl *langEl = gen->utArg->langEl;
+ LangEl *langEl = gen->utArg->langEl;
if ( langEl->contextIn != 0 )
initCtxField( gen );
}
diff --git a/colm/ctinput.cc b/colm/ctinput.cc
index 0da57a2b..108fad6f 100644
--- a/colm/ctinput.cc
+++ b/colm/ctinput.cc
@@ -89,9 +89,9 @@ int inputStreamPatternShouldFlush( InputStream *is )
return is->patItem == 0 || is->patItem->type == PatternItem::FactorType;
}
-KlangEl *inputStreamPatternGetLangEl( InputStream *is, long *bindId, char **data, long *length )
+LangEl *inputStreamPatternGetLangEl( InputStream *is, long *bindId, char **data, long *length )
{
- KlangEl *klangEl = is->patItem->factor->langEl;
+ LangEl *klangEl = is->patItem->factor->langEl;
*bindId = is->patItem->bindId;
*data = 0;
*length = 0;
@@ -217,9 +217,9 @@ int inputStreamReplShouldFlush( InputStream *is )
is->replItem->type == ReplItem::FactorType );
}
-KlangEl *inputStreamReplGetLangEl( InputStream *is, long *bindId, char **data, long *length )
+LangEl *inputStreamReplGetLangEl( InputStream *is, long *bindId, char **data, long *length )
{
- KlangEl *klangEl = is->replItem->type == ReplItem::ExprType ?
+ LangEl *klangEl = is->replItem->type == ReplItem::ExprType ?
is->replItem->langEl : is->replItem->factor->langEl;
*bindId = is->replItem->bindId;
@@ -343,7 +343,7 @@ void sendNamedLangEl( Tree **sp, PdaRun *pdaRun, FsmRun *fsmRun, InputStream *in
char *data;
long length;
- KlangEl *klangEl = inputStream->funcs->getLangEl( inputStream, &bindId, &data, &length );
+ LangEl *klangEl = inputStream->funcs->getLangEl( inputStream, &bindId, &data, &length );
if ( klangEl->termDup != 0 )
klangEl = klangEl->termDup;
diff --git a/colm/declare.cc b/colm/declare.cc
index 311ac86c..31d796ea 100644
--- a/colm/declare.cc
+++ b/colm/declare.cc
@@ -28,35 +28,35 @@
void ParseData::declareBaseKlangEls()
{
/* Make the "stream" language element */
- streamKlangEl = new KlangEl( rootNamespace, strdup("stream"), KlangEl::Term );
+ streamKlangEl = new LangEl( rootNamespace, strdup("stream"), LangEl::Term );
langEls.prepend( streamKlangEl );
SymbolMapEl *streamMapEl = rootNamespace->symbolMap.insert(
streamKlangEl->name, streamKlangEl );
assert( streamMapEl != 0 );
/* Make the "str" language element */
- strKlangEl = new KlangEl( rootNamespace, strdup("str"), KlangEl::Term );
+ strKlangEl = new LangEl( rootNamespace, strdup("str"), LangEl::Term );
langEls.prepend( strKlangEl );
SymbolMapEl *stringMapEl = rootNamespace->symbolMap.insert(
strKlangEl->name, strKlangEl );
assert( stringMapEl != 0 );
/* Make the "int" language element */
- intKlangEl = new KlangEl( rootNamespace, strdup("int"), KlangEl::Term );
+ intKlangEl = new LangEl( rootNamespace, strdup("int"), LangEl::Term );
langEls.prepend( intKlangEl );
SymbolMapEl *integerMapEl = rootNamespace->symbolMap.insert(
intKlangEl->name, intKlangEl );
assert( integerMapEl != 0 );
/* Make the "bool" language element */
- boolKlangEl = new KlangEl( rootNamespace, strdup("bool"), KlangEl::Term );
+ boolKlangEl = new LangEl( rootNamespace, strdup("bool"), LangEl::Term );
langEls.prepend( boolKlangEl );
SymbolMapEl *boolMapEl = rootNamespace->symbolMap.insert(
boolKlangEl->name, boolKlangEl );
assert( boolMapEl != 0 );
/* Make the "ptr" language element */
- ptrKlangEl = new KlangEl( rootNamespace, strdup("ptr"), KlangEl::Term );
+ ptrKlangEl = new LangEl( rootNamespace, strdup("ptr"), LangEl::Term );
langEls.prepend( ptrKlangEl );
SymbolMapEl *ptrMapEl = rootNamespace->symbolMap.insert(
ptrKlangEl->name, ptrKlangEl );
@@ -67,7 +67,7 @@ void ParseData::declareBaseKlangEls()
* that needs to be associated with a language element. This allows us to
* always associate reverse code with the first language element produced
* after a generation action. */
- noTokenKlangEl = new KlangEl( rootNamespace, strdup("_notoken"), KlangEl::Term );
+ noTokenKlangEl = new LangEl( rootNamespace, strdup("_notoken"), LangEl::Term );
noTokenKlangEl->ignore = true;
langEls.prepend( noTokenKlangEl );
SymbolMapEl *noTokenMapEl = rootNamespace->symbolMap.insert(
@@ -76,13 +76,13 @@ void ParseData::declareBaseKlangEls()
/* Make the EOF language element. */
eofKlangEl = 0;
-// eofKlangEl = new KlangEl( rootNamespace, strdup("_eof"), KlangEl::Term );
+// eofKlangEl = new LangEl( rootNamespace, strdup("_eof"), LangEl::Term );
// langEls.prepend( eofKlangEl );
// SymbolMapEl *eofMapEl = rootNamespace->symbolMap.insert( eofKlangEl->name, eofKlangEl );
// assert( eofMapEl != 0 );
/* Make the "any" language element */
- anyKlangEl = new KlangEl( rootNamespace, strdup("any"), KlangEl::NonTerm );
+ anyKlangEl = new LangEl( rootNamespace, strdup("any"), LangEl::NonTerm );
langEls.prepend( anyKlangEl );
SymbolMapEl *anyMapEl = rootNamespace->symbolMap.insert( anyKlangEl->name, anyKlangEl );
assert( anyMapEl != 0 );
@@ -93,9 +93,9 @@ void ParseData::makeTerminalWrappers()
/* Make terminal language elements corresponding to each nonterminal in
* the grammar. */
for ( LelList::Iter lel = langEls; lel.lte(); lel++ ) {
- if ( lel->type == KlangEl::NonTerm ) {
+ if ( lel->type == LangEl::NonTerm ) {
String name( lel->name.length() + 5, "_T_%s", lel->name.data );
- KlangEl *termDup = new KlangEl( lel->nspace, name, KlangEl::Term );
+ LangEl *termDup = new LangEl( lel->nspace, name, LangEl::Term );
/* Give the dup the attributes of the nonterminal. This ensures
* that the attributes are allocated when patterns and
@@ -121,7 +121,7 @@ void ParseData::makeEofElements()
lel != noTokenKlangEl )
{
String name( lel->name.length() + 5, "_eof_%s", lel->name.data );
- KlangEl *eofLel = new KlangEl( lel->nspace, name, KlangEl::Term );
+ LangEl *eofLel = new LangEl( lel->nspace, name, LangEl::Term );
langEls.append( eofLel );
lel->eofLel = eofLel;
@@ -131,7 +131,7 @@ void ParseData::makeEofElements()
}
}
-void ParseData::addProdRedObjectVar( ObjectDef *localFrame, KlangEl *nonTerm )
+void ParseData::addProdRedObjectVar( ObjectDef *localFrame, LangEl *nonTerm )
{
UniqueType *prodNameUT = findUniqueType( TYPE_TREE, nonTerm );
TypeRef *typeRef = new TypeRef( InputLoc(), prodNameUT );
@@ -198,22 +198,22 @@ void Namespace::declare( ParseData *pd )
for ( GenericList::Iter g = genericList; g.lte(); g++ ) {
//std::cout << "generic " << g->name << std::endl;
- KlangEl *langEl = getKlangEl( pd, this, g->name );
+ LangEl *langEl = getKlangEl( pd, this, g->name );
/* Check that the element wasn't previously defined as something else. */
- if ( langEl->type != KlangEl::Unknown ) {
+ if ( langEl->type != LangEl::Unknown ) {
error() << "'" << g->name <<
"' already defined as something else" << endp;
}
- langEl->type = KlangEl::NonTerm;
+ langEl->type = LangEl::NonTerm;
/* Add one empty production. */
ProdElList *emptyList = new ProdElList;
//addProduction( g->loc, langEl, emptyList, false, 0, 0 );
{
- KlangEl *prodName = langEl;
- assert( prodName->type == KlangEl::NonTerm );
+ LangEl *prodName = langEl;
+ assert( prodName->type == LangEl::NonTerm );
Definition *newDef = new Definition( loc, prodName,
emptyList, false, 0,
@@ -230,9 +230,9 @@ void Namespace::declare( ParseData *pd )
for ( LiteralDict::Iter l = literalDict; l.lte(); l++ ) {
/* Create a token for the literal. */
- KlangEl *newLangEl = getKlangEl( pd, this, l->value->name );
- assert( newLangEl->type == KlangEl::Unknown );
- newLangEl->type = KlangEl::Term;
+ LangEl *newLangEl = getKlangEl( pd, this, l->value->name );
+ assert( newLangEl->type == LangEl::Unknown );
+ newLangEl->type = LangEl::Term;
newLangEl->lit = l->value->literal;
newLangEl->isLiteral = true;
newLangEl->tokenDef = l->value;
@@ -241,20 +241,20 @@ void Namespace::declare( ParseData *pd )
}
for ( ContextDefList::Iter c = contextDefList; c.lte(); c++ ) {
- KlangEl *lel = getKlangEl( pd, this, c->name );
+ LangEl *lel = getKlangEl( pd, this, c->name );
/* Check that the element wasn't previously defined as something else. */
- if ( lel->type != KlangEl::Unknown ) {
+ if ( lel->type != LangEl::Unknown ) {
error(c->context->loc) << "'" << c->name <<
"' has already been defined, maybe you want to use redef?" << endp;
}
- lel->type = KlangEl::NonTerm;
+ lel->type = LangEl::NonTerm;
ProdElList *emptyList = new ProdElList;
//addProduction( c->context->loc, c->name, emptyList, false, 0, 0 );
{
- KlangEl *prodName = lel;
- assert( prodName->type == KlangEl::NonTerm );
+ LangEl *prodName = lel;
+ assert( prodName->type == LangEl::NonTerm );
Definition *newDef = new Definition( loc, prodName,
emptyList, false, 0,
@@ -282,11 +282,11 @@ void Namespace::declare( ParseData *pd )
/* Literals already taken care of. */
if ( ! t->isLiteral ) {
/* Create the token. */
- KlangEl *tokEl = getKlangEl( pd, this, t->name );
- if ( tokEl->type != KlangEl::Unknown )
+ LangEl *tokEl = getKlangEl( pd, this, t->name );
+ if ( tokEl->type != LangEl::Unknown )
error(InputLoc()) << "'" << t->name << "' already defined" << endp;
- tokEl->type = KlangEl::Term;
+ tokEl->type = LangEl::Term;
tokEl->ignore = t->ignore;
tokEl->transBlock = t->codeBlock;
tokEl->objectDef = t->objectDef;
@@ -299,15 +299,15 @@ void Namespace::declare( ParseData *pd )
for ( NtDefList::Iter n = ntDefList; n.lte(); n++ ) {
/* Get the language element. */
- KlangEl *langEl = getKlangEl( pd, this, n->name );
+ LangEl *langEl = getKlangEl( pd, this, n->name );
/* Check that the element wasn't previously defined as something else. */
- if ( langEl->type != KlangEl::Unknown ) {
+ if ( langEl->type != LangEl::Unknown ) {
error(InputLoc()) << "'" << n->name <<
"' has already been defined, maybe you want to use redef?" << endp;
}
- langEl->type = KlangEl::NonTerm;
+ langEl->type = LangEl::NonTerm;
//$$->langEl = langEl;
/* Get the language element. */
diff --git a/colm/dotgen.cc b/colm/dotgen.cc
index 723d3c08..e738cfb7 100644
--- a/colm/dotgen.cc
+++ b/colm/dotgen.cc
@@ -35,7 +35,7 @@ void ParseData::writeTransList( PdaState *state )
/* Begin the label. */
out << " [ label = \"";
long key = trans->key;
- KlangEl *lel = langElIndex[key];
+ LangEl *lel = langElIndex[key];
if ( lel != 0 )
out << lel->name;
else
diff --git a/colm/fsmcodegen.cc b/colm/fsmcodegen.cc
index d098b0c3..f09b312c 100644
--- a/colm/fsmcodegen.cc
+++ b/colm/fsmcodegen.cc
@@ -195,7 +195,7 @@ void FsmCodeGen::SET_TOKSTART( ostream &ret, InlineItem *item )
ret << TOKSTART() << " = " << P() << ";";
}
-void FsmCodeGen::EMIT_TOKEN( ostream &ret, KlangEl *token )
+void FsmCodeGen::EMIT_TOKEN( ostream &ret, LangEl *token )
{
// if ( token->transBlock != 0 )
// ret << " execGen( " << token->id << " );\n";
diff --git a/colm/fsmcodegen.h b/colm/fsmcodegen.h
index f0bfb351..8372da94 100644
--- a/colm/fsmcodegen.h
+++ b/colm/fsmcodegen.h
@@ -133,7 +133,7 @@ protected:
void LM_ON_NEXT( ostream &ret, InlineItem *item );
void LM_ON_LAG_BEHIND( ostream &ret, InlineItem *item );
void EXEC_TOKEND( ostream &ret );
- void EMIT_TOKEN( ostream &ret, KlangEl *token );
+ void EMIT_TOKEN( ostream &ret, LangEl *token );
string ERROR_STATE();
string FIRST_FINAL_STATE();
diff --git a/colm/input.h b/colm/input.h
index 0bef2def..fa268979 100644
--- a/colm/input.h
+++ b/colm/input.h
@@ -48,7 +48,7 @@ extern "C" {
* take back unprocessed data from the fsmRun.
*/
-struct KlangEl;
+struct LangEl;
struct Pattern;
struct PatternItem;
struct Replacement;
@@ -87,7 +87,7 @@ struct InputFuncs
int (*getData)( InputStream *is, char *dest, int length );
int (*getDataImpl)( InputStream *is, char *dest, int length );
struct _Tree *(*getTree)( InputStream *is );
- struct KlangEl *(*getLangEl)( InputStream *is, long *bindId, char **data, long *length );
+ struct LangEl *(*getLangEl)( InputStream *is, long *bindId, char **data, long *length );
void (*pushTree)( InputStream *is, struct _Tree *tree, int ignore );
void (*pushText)( InputStream *is, const char *data, long len );
struct _Tree *(*undoPush)( InputStream *is, int length );
diff --git a/colm/lmparse.kh b/colm/lmparse.kh
index f2074309..e4efead1 100644
--- a/colm/lmparse.kh
+++ b/colm/lmparse.kh
@@ -81,7 +81,7 @@ struct Parser
void addRegularDef( const InputLoc &loc, Namespace *nspace,
const String &name, JoinOrLm *joinOrLm, bool isInstance );
void addProduction( const InputLoc &loc, const String &name,
- ProdElList *prodElList, bool commit, CodeBlock *redBlock, KlangEl *predOf );
+ ProdElList *prodElList, bool commit, CodeBlock *redBlock, LangEl *predOf );
void addArgvList();
/* Report an error encountered by the parser. */
diff --git a/colm/lmparse.kl b/colm/lmparse.kl
index 82d37e9e..5f1faa45 100644
--- a/colm/lmparse.kl
+++ b/colm/lmparse.kl
@@ -361,7 +361,7 @@ property:
nonterm opt_prec
{
- KlangEl *predOf;
+ LangEl *predOf;
};
opt_prec:
@@ -387,7 +387,7 @@ define_prod: '[' prod_el_list ']' opt_commit opt_reduce_code opt_prec
ProdElList *prodElList = curProdElList;
bool commit = $4->commit;
CodeBlock *redBlock = $5->codeBlock;
- KlangEl *predOf = $6->predOf;
+ LangEl *predOf = $6->predOf;
//Namespace *nspace = namespaceStack.top();
diff --git a/colm/parsedata.cc b/colm/parsedata.cc
index 58fcb95c..03a97a9f 100644
--- a/colm/parsedata.cc
+++ b/colm/parsedata.cc
@@ -1111,17 +1111,17 @@ void ParseData::createDefaultScanner()
/* Now create the one and only token -> "<chr>" / any / */
name = "___DEFAULT_SCANNER_CHR";
defaultCharKlangEl = getKlangEl( this, defaultNamespace, name );
- assert( defaultCharKlangEl->type == KlangEl::Unknown );
- defaultCharKlangEl->type = KlangEl::Term;
+ assert( defaultCharKlangEl->type == LangEl::Unknown );
+ defaultCharKlangEl->type = LangEl::Term;
tokenDef->token = defaultCharKlangEl;
defaultCharKlangEl->tokenDef = tokenDef;
}
-KlangEl *ParseData::makeRepeatProd( Namespace *nspace, const String &repeatName, NamespaceQual *nspaceQual, const String &name )
+LangEl *ParseData::makeRepeatProd( Namespace *nspace, const String &repeatName, NamespaceQual *nspaceQual, const String &name )
{
- KlangEl *prodName = getKlangEl( this, nspace, repeatName );
- prodName->type = KlangEl::NonTerm;
+ LangEl *prodName = getKlangEl( this, nspace, repeatName );
+ prodName->type = LangEl::NonTerm;
prodName->isRepeat = true;
ProdElList *prodElList1 = new ProdElList;
@@ -1155,10 +1155,10 @@ KlangEl *ParseData::makeRepeatProd( Namespace *nspace, const String &repeatName,
return prodName;
}
-KlangEl *ParseData::makeListProd( Namespace *nspace, const String &listName, NamespaceQual *nspaceQual, const String &name )
+LangEl *ParseData::makeListProd( Namespace *nspace, const String &listName, NamespaceQual *nspaceQual, const String &name )
{
- KlangEl *prodName = getKlangEl( this, nspace, listName );
- prodName->type = KlangEl::NonTerm;
+ LangEl *prodName = getKlangEl( this, nspace, listName );
+ prodName->type = LangEl::NonTerm;
prodName->isList = true;
/* Build the first production of the list. */
@@ -1195,10 +1195,10 @@ KlangEl *ParseData::makeListProd( Namespace *nspace, const String &listName, Nam
return prodName;
}
-KlangEl *ParseData::makeOptProd( Namespace *nspace, const String &optName, NamespaceQual *nspaceQual, const String &name )
+LangEl *ParseData::makeOptProd( Namespace *nspace, const String &optName, NamespaceQual *nspaceQual, const String &name )
{
- KlangEl *prodName = getKlangEl( this, nspace, optName );
- prodName->type = KlangEl::NonTerm;
+ LangEl *prodName = getKlangEl( this, nspace, optName );
+ prodName->type = LangEl::NonTerm;
prodName->isOpt = true;
ProdElList *prodElList1 = new ProdElList;
@@ -1313,9 +1313,9 @@ void ParseData::initEmptyScanners()
/* These do not go in the namespace so so they cannot get declared
* in the declare pass. */
- KlangEl *lel = getKlangEl( this, rootNamespace, name );
- assert( lel->type == KlangEl::Unknown );
- lel->type = KlangEl::Term;
+ LangEl *lel = getKlangEl( this, rootNamespace, name );
+ assert( lel->type == LangEl::Unknown );
+ lel->type = LangEl::Term;
tokenDef->token = lel;
lel->tokenDef = tokenDef;
@@ -1371,13 +1371,13 @@ void ParseData::parsePatterns()
fillInPatterns( &prg );
}
-void ParseData::collectParserEls( BstSet<KlangEl*> &parserEls )
+void ParseData::collectParserEls( BstSet<LangEl*> &parserEls )
{
for ( PatternList::Iter pat = patternList; pat.lte(); pat++ ) {
/* We assume the reduction action compilation phase was run before
* pattern parsing and it decorated the pattern with the target type. */
assert( pat->langEl != 0 );
- if ( pat->langEl->type != KlangEl::NonTerm )
+ if ( pat->langEl->type != LangEl::NonTerm )
error(pat->loc) << "pattern type is not a non-terminal" << endp;
if ( pat->langEl->parserId < 0 ) {
@@ -1469,7 +1469,7 @@ void ParseData::semanticAnalysis()
RedFsmBuild reduce( sectionName, this, fsmGraph );
redFsm = reduce.reduceMachine();
- BstSet<KlangEl*> parserEls;
+ BstSet<LangEl*> parserEls;
collectParserEls( parserEls );
makeParser( parserEls );
diff --git a/colm/parsedata.h b/colm/parsedata.h
index 5370134d..db69f19d 100644
--- a/colm/parsedata.h
+++ b/colm/parsedata.h
@@ -51,7 +51,7 @@ void operator<<( std::ostream &out, exit_object & );
/* Forwards. */
struct RedFsm;
-struct KlangEl;
+struct LangEl;
struct ParseData;
struct PdaCodeGen;
struct FsmCodeGen;
@@ -80,7 +80,7 @@ struct Bindings
struct DefListEl { Definition *prev, *next; };
struct LelDefListEl { Definition *prev, *next; };
-typedef Vector< KlangEl* > KlangElVect;
+typedef Vector< LangEl* > KlangElVect;
typedef Vector< ProdEl* > FactorVect;
typedef AvlMap<String, long, CmpStr> StringMap;
@@ -95,7 +95,7 @@ struct Definition
{
enum Type { Production };
- Definition( const InputLoc &loc, KlangEl *prodName, ProdElList *prodElList,
+ Definition( const InputLoc &loc, LangEl *prodName, ProdElList *prodElList,
bool prodCommit, CodeBlock *redBlock, int prodId, Type type ) :
loc(loc), prodName(prodName), prodElList(prodElList),
prodCommit(prodCommit), redBlock(redBlock), prodId(prodId),
@@ -103,7 +103,7 @@ struct Definition
isLeftRec(false), localFrame(0), lhsField(0), predOf(0) {}
InputLoc loc;
- KlangEl *prodName;
+ LangEl *prodName;
ProdElList *prodElList;
bool prodCommit;
@@ -117,7 +117,7 @@ struct Definition
String data;
LongSet reducesTo;
- KlangEl *uniqueEmptyLeader;
+ LangEl *uniqueEmptyLeader;
ProdIdSet nonTermFirstSet;
AlphSet firstSet;
@@ -126,7 +126,7 @@ struct Definition
ObjectDef *localFrame;
ObjField *lhsField;
- KlangEl *predOf;
+ LangEl *predOf;
};
struct CmpDefById
@@ -162,22 +162,22 @@ struct LelDefList
typedef Vector< PdaGraph* > Machines;
/* List of language elements. */
-typedef DList<KlangEl> LelList;
+typedef DList<LangEl> LelList;
typedef Vector< TokenDef* > TokenDefVect;
struct UniqueType;
-typedef Vector<KlangEl*> KlangElVect;
-typedef BstSet<KlangEl*> KlangElSet;
+typedef Vector<LangEl*> KlangElVect;
+typedef BstSet<LangEl*> KlangElSet;
/* A language element class. Can be a nonTerm or a term. */
-struct KlangEl : public DListEl<KlangEl>
+struct LangEl : public DListEl<LangEl>
{
enum Type { Unknown, Term, NonTerm };
- KlangEl( Namespace *nspace, const String &name, Type type );
- ~KlangEl();
+ LangEl( Namespace *nspace, const String &name, Type type );
+ ~LangEl();
/* The region the language element was defined in. */
Namespace *nspace;
@@ -209,8 +209,8 @@ struct KlangEl : public DListEl<KlangEl>
TokenDef *tokenDef;
Definition *rootDef;
- KlangEl *termDup;
- KlangEl *eofLel;
+ LangEl *termDup;
+ LangEl *eofLel;
PdaGraph *pdaGraph;
PdaTables *pdaTables;
@@ -259,7 +259,7 @@ struct ProdEl
literal(0), langEl(0), priorVal(priorVal), repeatType(repeatType),
nspace(0), type(ReferenceType), objField(0) {}
- ProdEl( const InputLoc &loc, KlangEl *langEl ) :
+ ProdEl( const InputLoc &loc, LangEl *langEl ) :
loc(loc), commit(false), nspaceQual(0), literal(0), langEl(langEl),
priorVal(0), repeatType(RepeatNone), nspace(0),
type(ReferenceType), objField(0) {}
@@ -274,7 +274,7 @@ struct ProdEl
NamespaceQual *nspaceQual;
String refName;
PdaLiteral *literal;
- KlangEl *langEl;
+ LangEl *langEl;
int priorVal;
RepeatType repeatType;
Namespace *nspace;
@@ -544,9 +544,9 @@ struct ParseData
void analyzeAction( Action *action, InlineList *inlineList );
void analyzeGraph( FsmGraph *graph );
void resolvePrecedence( PdaGraph *pdaGraph );
- KlangEl *predOf( PdaTrans *trans, long action );
- bool precedenceSwap( long action1, long action2, KlangEl *l1, KlangEl *l2 );
- bool precedenceRemoveBoth( KlangEl *l1, KlangEl *l2 );
+ LangEl *predOf( PdaTrans *trans, long action );
+ bool precedenceSwap( long action1, long action2, LangEl *l1, LangEl *l2 );
+ bool precedenceRemoveBoth( LangEl *l1, LangEl *l2 );
void initKeyOps();
@@ -704,10 +704,10 @@ struct ParseData
void findFollow( AlphSet &result, PdaState *overTab,
PdaState *overSrc, Definition *parentDef );
void pdaActionOrder( PdaGraph *pdaGraph, KlangElSet &parserEls );
- void pdaOrderFollow( KlangEl *rootEl, PdaState *tabState,
+ void pdaOrderFollow( LangEl *rootEl, PdaState *tabState,
PdaTrans *tabTrans, PdaTrans *srcTrans,
Definition *parentDef, Definition *definition, long &time );
- void pdaOrderProd( KlangEl *rootEl, PdaState *tabState,
+ void pdaOrderProd( LangEl *rootEl, PdaState *tabState,
PdaState *srcState, Definition *parentDef, long &time );
void analyzeMachine( PdaGraph *pdaGraph, KlangElSet &parserEls );
@@ -716,11 +716,11 @@ struct ParseData
void printNonTermFirstSets();
void printFirstSets();
- KlangEl *makeRepeatProd( Namespace *nspace, const String &repeatName,
+ LangEl *makeRepeatProd( Namespace *nspace, const String &repeatName,
NamespaceQual *nspaceQual, const String &name );
- KlangEl *makeListProd( Namespace *nspace, const String &listName,
+ LangEl *makeListProd( Namespace *nspace, const String &listName,
NamespaceQual *nspaceQual, const String &name );
- KlangEl *makeOptProd( Namespace *nspace, const String &optName,
+ LangEl *makeOptProd( Namespace *nspace, const String &optName,
NamespaceQual *nspaceQual, const String &name );
void resolveLiteralFactor( ProdEl *fact );
void resolveReferenceFactor( ProdEl *fact );
@@ -730,13 +730,13 @@ struct ParseData
void resolveReplacementEls();
void resolveAccumEls();
- void addMatchText( ObjectDef *frame, KlangEl *lel );
- void addMatchLength( ObjectDef *frame, KlangEl *lel );
- void addInput( ObjectDef *frame, KlangEl *lel );
- void addCtx( ObjectDef *frame, KlangEl *lel );
- void addTransTokVar( ObjectDef *frame, KlangEl *lel );
+ void addMatchText( ObjectDef *frame, LangEl *lel );
+ void addMatchLength( ObjectDef *frame, LangEl *lel );
+ void addInput( ObjectDef *frame, LangEl *lel );
+ void addCtx( ObjectDef *frame, LangEl *lel );
+ void addTransTokVar( ObjectDef *frame, LangEl *lel );
void addProdRHSVars( ObjectDef *localFrame, ProdElList *prodElList );
- void addProdRedObjectVar( ObjectDef *localFrame, KlangEl *langEl );
+ void addProdRedObjectVar( ObjectDef *localFrame, LangEl *langEl );
void addProdObjects();
void addSaveLHS( Definition *prod, CodeVect &code, long &insertPos );
@@ -747,7 +747,7 @@ struct ParseData
void collectParserEls( KlangElSet &parserEls );
void makeParser( KlangElSet &parserEls );
- PdaGraph *makePdaGraph( BstSet<KlangEl*> &parserEls );
+ PdaGraph *makePdaGraph( BstSet<LangEl*> &parserEls );
PdaTables *makePdaTables( PdaGraph *pdaGraph );
void fillInPatterns( Program *prg );
@@ -756,7 +756,7 @@ struct ParseData
/* Generate and write out the fsm. */
void generateGraphviz();
- void verifyParseStopGrammar( KlangEl *langEl, PdaGraph *pdaGraph );
+ void verifyParseStopGrammar( LangEl *langEl, PdaGraph *pdaGraph );
void initFieldInstructions( ObjField *el );
void initLocalInstructions( ObjField *el );
@@ -790,7 +790,7 @@ struct ParseData
void resolveUserIter( Function *func );
void resolvePreEof( TokenRegion *region );
void resolveRootBlock();
- void resolveTranslateBlock( KlangEl *langEl );
+ void resolveTranslateBlock( LangEl *langEl );
void resolveReductionCode( Definition *prod );
void resolveParseTree();
void resolveGenericTypes();
@@ -801,7 +801,7 @@ struct ParseData
void compileUserIter( Function *func );
void compilePreEof( TokenRegion *region );
void compileRootBlock();
- void compileTranslateBlock( KlangEl *langEl );
+ void compileTranslateBlock( LangEl *langEl );
void findLocalTrees( CharSet &trees );
void compileReductionCode( Definition *prod );
void initGenericTypes();
@@ -850,17 +850,17 @@ struct ParseData
GenericType *anyMap;
GenericType *anyVector;
- KlangEl *ptrKlangEl;
- KlangEl *boolKlangEl;
- KlangEl *intKlangEl;
- KlangEl *strKlangEl;
- KlangEl *streamKlangEl;
- KlangEl *anyKlangEl;
- KlangEl *rootKlangEl;
- KlangEl *noTokenKlangEl;
- KlangEl *eofKlangEl;
- KlangEl *errorKlangEl;
- KlangEl *defaultCharKlangEl;
+ LangEl *ptrKlangEl;
+ LangEl *boolKlangEl;
+ LangEl *intKlangEl;
+ LangEl *strKlangEl;
+ LangEl *streamKlangEl;
+ LangEl *anyKlangEl;
+ LangEl *rootKlangEl;
+ LangEl *noTokenKlangEl;
+ LangEl *eofKlangEl;
+ LangEl *errorKlangEl;
+ LangEl *defaultCharKlangEl;
TokenRegion *rootRegion;
TokenRegion *defaultRegion;
@@ -872,7 +872,7 @@ struct ParseData
int nextSymbolId;
int firstNonTermId;
- KlangEl **langElIndex;
+ LangEl **langElIndex;
PdaState *actionDestState;
DefSetSet prodSetSet;
@@ -889,7 +889,7 @@ struct ParseData
ObjectDef *curLocalFrame;
UniqueType *findUniqueType( int typeId );
- UniqueType *findUniqueType( int typeId, KlangEl *langEl );
+ UniqueType *findUniqueType( int typeId, LangEl *langEl );
UniqueType *findUniqueType( int typeId, IterDef *iterDef );
UniqueType *uniqueTypeNil;
@@ -995,6 +995,6 @@ struct Parser;
typedef AvlMap<String, Parser *, CmpStr> ParserDict;
typedef AvlMapEl<String, Parser *> ParserDictEl;
-KlangEl *getKlangEl( ParseData *pd, Namespace *nspace, const String &data );
+LangEl *getKlangEl( ParseData *pd, Namespace *nspace, const String &data );
#endif /* _PARSEDATA_H */
diff --git a/colm/parsetree.h b/colm/parsetree.h
index 4324fe46..84c73e92 100644
--- a/colm/parsetree.h
+++ b/colm/parsetree.h
@@ -171,7 +171,7 @@ struct TokenDef;
struct TokenDefListReg;
struct TokenDefListNs;
struct Range;
-struct KlangEl;
+struct LangEl;
/* Type of augmentation. Describes locations in the machine. */
enum AugType
@@ -356,14 +356,14 @@ typedef Vector<Context*> ContextVect;
struct Context
{
- Context( InputLoc &loc, KlangEl *lel )
+ Context( InputLoc &loc, LangEl *lel )
:
loc(loc),
lel(lel)
{}
InputLoc loc;
- KlangEl *lel;
+ LangEl *lel;
ObjectDef *contextObjDef;
};
@@ -409,7 +409,7 @@ struct TokenDef
Join *join;
Action *action;
CodeBlock *codeBlock;
- KlangEl *token;
+ LangEl *token;
InputLoc semiLoc;
Action *setActId;
@@ -472,8 +472,8 @@ struct ContextDef
struct ContextDefList : DList<ContextDef> {};
/* Symbol Map. */
-typedef AvlMap< String, KlangEl*, CmpStr > SymbolMap;
-typedef AvlMapEl< String, KlangEl* > SymbolMapEl;
+typedef AvlMap< String, LangEl*, CmpStr > SymbolMap;
+typedef AvlMapEl< String, LangEl* > SymbolMapEl;
typedef Vector<TokenRegion*> RegionVect;
@@ -530,7 +530,7 @@ struct GenericType
: public DListEl<GenericType>
{
GenericType( const String &name, long typeId, long id,
- KlangEl *langEl, TypeRef *typeArg )
+ LangEl *langEl, TypeRef *typeArg )
:
name(name), typeId(typeId), id(id), langEl(langEl),
typeArg(typeArg), keyTypeArg(0),
@@ -544,7 +544,7 @@ struct GenericType
String name;
long typeId;
long id;
- KlangEl *langEl;
+ LangEl *langEl;
TypeRef *typeArg;
TypeRef *keyTypeArg;
UniqueType *utArg;
@@ -1130,7 +1130,7 @@ struct ReplItem
Type type;
String data;
LangExpr *expr;
- KlangEl *langEl;
+ LangEl *langEl;
ProdEl *factor;
long bindId;
@@ -1152,7 +1152,7 @@ struct Pattern
TokenRegion *region;
PatternItemList *list;
long patRepId;
- KlangEl *langEl;
+ LangEl *langEl;
PdaRun *pdaRun;
long nextBindId;
@@ -1173,7 +1173,7 @@ struct Replacement
TokenRegion *region;
ReplItemList *list;
int patRepId;
- KlangEl *langEl;
+ LangEl *langEl;
PdaRun *pdaRun;
long nextBindId;
bool parse;
@@ -1194,7 +1194,7 @@ struct AccumText
Namespace *nspace;
TokenRegion *region;
ReplItemList *list;
- KlangEl *langEl;
+ LangEl *langEl;
PdaRun *pdaRun;
long nextBindId;
bool parse;
@@ -1265,7 +1265,7 @@ struct UniqueType : public AvlTreeEl<UniqueType>
langEl(0),
iterDef(0) {}
- UniqueType( int typeId, KlangEl *langEl ) :
+ UniqueType( int typeId, LangEl *langEl ) :
typeId(typeId),
langEl(langEl),
iterDef(0) {}
@@ -1276,7 +1276,7 @@ struct UniqueType : public AvlTreeEl<UniqueType>
iterDef(iterDef) {}
int typeId;
- KlangEl *langEl;
+ LangEl *langEl;
IterDef *iterDef;
};
diff --git a/colm/pdabuild.cc b/colm/pdabuild.cc
index 600301da..a9709f36 100644
--- a/colm/pdabuild.cc
+++ b/colm/pdabuild.cc
@@ -55,7 +55,7 @@ int countTransitions( PdaGraph *fsm )
return numTrans;
}
-KlangEl::KlangEl( Namespace *nspace, const String &name, Type type )
+LangEl::LangEl( Namespace *nspace, const String &name, Type type )
:
nspace(nspace),
name(name),
@@ -130,21 +130,21 @@ PdaGraph *ProdElList::walk( ParseData *pd )
}
-KlangEl *getKlangEl( ParseData *pd, Namespace *nspace, const String &data )
+LangEl *getKlangEl( ParseData *pd, Namespace *nspace, const String &data )
{
/* If the id is already in the dict, it will be placed in last found. If
* it is not there then it will be inserted and last found will be set to it. */
SymbolMapEl *inDict = nspace->symbolMap.find( data );
if ( inDict == 0 ) {
/* Language element not there. Make the new lang el and insert.. */
- KlangEl *langEl = new KlangEl( nspace, data, KlangEl::Unknown );
+ LangEl *langEl = new LangEl( nspace, data, LangEl::Unknown );
inDict = nspace->symbolMap.insert( langEl->name, langEl );
pd->langEls.append( langEl );
}
return inDict->value;
}
-ProdElList *makeProdElList( KlangEl *langEl )
+ProdElList *makeProdElList( LangEl *langEl )
{
ProdElList *prodElList = new ProdElList();
prodElList->append( new ProdEl( InputLoc(), langEl ) );
@@ -169,7 +169,7 @@ void ParseData::makeDefinitionNames()
void ParseData::noUndefindKlangEls()
{
for ( LelList::Iter lel = langEls; lel.lte(); lel++ ) {
- if ( lel->type == KlangEl::Unknown )
+ if ( lel->type == LangEl::Unknown )
error() << "'" << lel->name << "' was not defined as anything" << endp;
}
}
@@ -184,7 +184,7 @@ void ParseData::makeKlangElIds()
for ( LelList::Iter lel = langEls; lel.lte(); lel++ ) {
/* Must be a term, and not any of the special reserved terminals.
* Remember if the non terminal is a user non terminal. */
- if ( lel->type == KlangEl::Term &&
+ if ( lel->type == LangEl::Term &&
!lel->isEOF &&
lel != errorKlangEl &&
lel != noTokenKlangEl )
@@ -351,8 +351,8 @@ void ParseData::findFollow( AlphSet &result, PdaState *overTab,
assert( overSrc->transMap.length() == 1 );
TransMap::Iter pastTrans = overSrc->transMap;
- KlangEl *langEl = langElIndex[pastTrans->key];
- if ( langEl != 0 && langEl->type == KlangEl::NonTerm ) {
+ LangEl *langEl = langElIndex[pastTrans->key];
+ if ( langEl != 0 && langEl->type == LangEl::NonTerm ) {
bool hasEpsilon = false;
for ( LelDefList::Iter def = langEl->defList; def.lte(); def++ ) {
result.insert( def->firstSet );
@@ -407,7 +407,7 @@ void ParseData::trySetTime( PdaTrans *trans, long code, long &time )
}
/* Go down a defintiion and then handle the follow actions. */
-void ParseData::pdaOrderFollow( KlangEl *rootEl, PdaState *tabState,
+void ParseData::pdaOrderFollow( LangEl *rootEl, PdaState *tabState,
PdaTrans *tabTrans, PdaTrans *srcTrans, Definition *parentDef,
Definition *definition, long &time )
{
@@ -449,8 +449,8 @@ bool regionVectHas( RegionVect &regVect, TokenRegion *region )
void ParseData::addRegion( PdaState *tabState, long pdaKey )
{
- KlangEl *klangEl = langElIndex[pdaKey];
- if ( klangEl != 0 && klangEl->type == KlangEl::Term ) {
+ LangEl *klangEl = langElIndex[pdaKey];
+ if ( klangEl != 0 && klangEl->type == LangEl::Term ) {
TokenRegion *region = 0;
/* If it is not the eof, then use the region associated
@@ -496,7 +496,7 @@ void ParseData::addRegion( PdaState *tabState, long pdaKey )
orderState( parseTable.startState, startProduction.startState, 1 )
#endif
-void ParseData::pdaOrderProd( KlangEl *rootEl, PdaState *tabState,
+void ParseData::pdaOrderProd( LangEl *rootEl, PdaState *tabState,
PdaState *srcState, Definition *parentDef, long &time )
{
assert( srcState->dotSet.length() == 1 );
@@ -513,7 +513,7 @@ void ParseData::pdaOrderProd( KlangEl *rootEl, PdaState *tabState,
PdaTrans *tabTrans = tabState->findTrans( srcTrans->key );
/* Recurse into the transition if it is a non-terminal. */
- KlangEl *langEl = langElIndex[srcTrans->key];
+ LangEl *langEl = langElIndex[srcTrans->key];
if ( langEl != 0 ) {
if ( langEl->reduceFirst ) {
/* Use a shortest match ordering for the contents of this
@@ -589,7 +589,7 @@ void ParseData::pdaActionOrder( PdaGraph *pdaGraph, KlangElSet &parserEls )
/* There are no regions and EOF leaves the state. Add the eof
* token region. */
PdaTrans *trans = tel->value;
- KlangEl *lel = langElIndex[trans->lowKey];
+ LangEl *lel = langElIndex[trans->lowKey];
if ( lel != 0 && lel->isEOF )
state->regions.append( eofTokenRegion );
}
@@ -716,7 +716,7 @@ void ParseData::sortActions( PdaGraph *pdaGraph )
cerr << "info: branch point"
<< " state: " << state->stateNum
<< " trans: ";
- KlangEl *lel = langElIndex[trans->lowKey];
+ LangEl *lel = langElIndex[trans->lowKey];
if ( lel == 0 )
cerr << (char)trans->lowKey << endl;
else
@@ -792,7 +792,7 @@ void ParseData::reduceActions( PdaGraph *pdaGraph )
}
}
-void ParseData::verifyParseStopGrammar( KlangEl *langEl, PdaGraph *pdaGraph )
+void ParseData::verifyParseStopGrammar( LangEl *langEl, PdaGraph *pdaGraph )
{
/* Get the entry into the graph and traverse over the root. The resulting
* state can have eof, nothing else can. */
@@ -815,9 +815,9 @@ void ParseData::verifyParseStopGrammar( KlangEl *langEl, PdaGraph *pdaGraph )
}
}
-KlangEl *ParseData::predOf( PdaTrans *trans, long action )
+LangEl *ParseData::predOf( PdaTrans *trans, long action )
{
- KlangEl *lel;
+ LangEl *lel;
if ( action == SHIFT_CODE )
lel = langElIndex[trans->lowKey];
else
@@ -826,7 +826,7 @@ KlangEl *ParseData::predOf( PdaTrans *trans, long action )
}
-bool ParseData::precedenceSwap( long action1, long action2, KlangEl *l1, KlangEl *l2 )
+bool ParseData::precedenceSwap( long action1, long action2, LangEl *l1, LangEl *l2 )
{
bool swap = false;
if ( l2->predValue > l1->predValue )
@@ -840,7 +840,7 @@ bool ParseData::precedenceSwap( long action1, long action2, KlangEl *l1, KlangEl
return swap;
}
-bool ParseData::precedenceRemoveBoth( KlangEl *l1, KlangEl *l2 )
+bool ParseData::precedenceRemoveBoth( LangEl *l1, LangEl *l2 )
{
if ( l1->predValue == l2->predValue && l1->predType == PredNonassoc )
return true;
@@ -858,12 +858,12 @@ void ParseData::resolvePrecedence( PdaGraph *pdaGraph )
again:
/* Find action with precedence. */
for ( int i = 0; i < trans->actions.length(); i++ ) {
- KlangEl *li = predOf( trans, trans->actions[i] );
+ LangEl *li = predOf( trans, trans->actions[i] );
if ( li != 0 && li->predType != PredNone ) {
/* Find another action with precedence. */
for ( int j = i+1; j < trans->actions.length(); j++ ) {
- KlangEl *lj = predOf( trans, trans->actions[j] );
+ LangEl *lj = predOf( trans, trans->actions[j] );
if ( lj != 0 && lj->predType != PredNone ) {
/* Conflict to check. */
@@ -942,8 +942,8 @@ void ParseData::analyzeMachine( PdaGraph *pdaGraph, KlangElSet &parserEls )
* which is either a shift or a shift-reduce. */
for ( PdaStateList::Iter state = pdaGraph->stateList; state.lte(); state++ ) {
for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) {
- KlangEl *langEl = langElIndex[trans->value->lowKey];
- if ( langEl != 0 && langEl->type == KlangEl::NonTerm ) {
+ LangEl *langEl = langElIndex[trans->value->lowKey];
+ if ( langEl != 0 && langEl->type == LangEl::NonTerm ) {
assert( trans->value->actions.length() == 1 );
assert( trans->value->actions[0] == SHIFT_CODE ||
(trans->value->actions[0] & 0x3) == SHIFT_REDUCE_CODE );
@@ -963,7 +963,7 @@ void ParseData::analyzeMachine( PdaGraph *pdaGraph, KlangElSet &parserEls )
/* Verify that any type we parse_stop can actually be parsed that way. */
for ( KlangElSet::Iter pe = parserEls; pe.lte(); pe++ ) {
- KlangEl *lel = *pe;
+ LangEl *lel = *pe;
if ( lel->parseStop )
verifyParseStopGrammar(lel , pdaGraph);
}
@@ -974,7 +974,7 @@ void ParseData::wrapNonTerminals()
/* Make a language element that will be used to make the root productions.
* These are used for making parsers rooted at any production (including
* the start symbol). */
- rootKlangEl = new KlangEl( rootNamespace, "_root", KlangEl::NonTerm );
+ rootKlangEl = new LangEl( rootNamespace, "_root", LangEl::NonTerm );
langEls.append( rootKlangEl );
SymbolMapEl *rootMapEl = rootNamespace->symbolMap.insert(
rootKlangEl->name, rootKlangEl );
@@ -1001,7 +1001,7 @@ bool ParseData::makeNonTermFirstSetProd( Definition *prod, PdaState *state )
modified = true;
bool hasEpsilon = false;
- KlangEl *lel = langElIndex[trans->key];
+ LangEl *lel = langElIndex[trans->key];
for ( LelDefList::Iter ldef = lel->defList; ldef.lte(); ldef++ ) {
for ( ProdIdSet::Iter pid = ldef->nonTermFirstSet;
pid.lte(); pid++ )
@@ -1066,7 +1066,7 @@ void ParseData::printNonTermFirstSets()
if ( *pid < 0 )
cerr << " <EPSILON>";
else {
- KlangEl *lel = langElIndex[*pid];
+ LangEl *lel = langElIndex[*pid];
cerr << " " << lel->name;
}
}
@@ -1091,7 +1091,7 @@ bool ParseData::makeFirstSetProd( Definition *prod, PdaState *state )
if ( inserted != 0 )
modified = true;
- KlangEl *klangEl = langElIndex[trans->key];
+ LangEl *klangEl = langElIndex[trans->key];
if ( klangEl != 0 && klangEl->termDup != 0 ) {
long *inserted2 = prod->firstSet.insert( klangEl->termDup->id );
if ( inserted2 != 0 )
@@ -1099,7 +1099,7 @@ bool ParseData::makeFirstSetProd( Definition *prod, PdaState *state )
}
bool hasEpsilon = false;
- KlangEl *lel = langElIndex[trans->key];
+ LangEl *lel = langElIndex[trans->key];
for ( LelDefList::Iter ldef = lel->defList; ldef.lte(); ldef++ ) {
for ( ProdIdSet::Iter pid = ldef->firstSet;
pid.lte(); pid++ )
@@ -1159,7 +1159,7 @@ void ParseData::printFirstSets()
if ( *pid < 0 )
cerr << " <EPSILON>";
else {
- KlangEl *lel = langElIndex[*pid];
+ LangEl *lel = langElIndex[*pid];
if ( lel != 0 )
cerr << endl << " " << lel->name;
else
@@ -1180,9 +1180,9 @@ void ParseData::insertUniqueEmptyProductions()
/* Get a language element. */
char name[20];
sprintf(name, "U%li", prodList.length());
- KlangEl *prodName = getKlangEl( this, rootNamespace, name );
- assert( prodName->type == KlangEl::Unknown );
- prodName->type = KlangEl::NonTerm;
+ LangEl *prodName = getKlangEl( this, rootNamespace, name );
+ assert( prodName->type == LangEl::Unknown );
+ prodName->type = LangEl::NonTerm;
Definition *newDef = new Definition( InputLoc(), prodName,
0 /* FIXME new VarDef( name, 0 )*/,
false, 0, prodList.length(), Definition::Production );
@@ -1288,7 +1288,7 @@ void ParseData::makeRuntimeData()
runtimeData->numLangEls = count;
for ( int i = 0; i < nextSymbolId; i++ ) {
- KlangEl *lel = langElIndex[i];
+ LangEl *lel = langElIndex[i];
if ( lel != 0 ) {
runtimeData->lelInfo[i].name = lel->fullLit;
runtimeData->lelInfo[i].repeat = lel->isRepeat;
@@ -1857,8 +1857,8 @@ void ParseData::prepGrammar()
noUndefindKlangEls();
/* Put the language elements in an index by language element id. */
- langElIndex = new KlangEl*[nextSymbolId+1];
- memset( langElIndex, 0, sizeof(KlangEl*)*(nextSymbolId+1) );
+ langElIndex = new LangEl*[nextSymbolId+1];
+ memset( langElIndex, 0, sizeof(LangEl*)*(nextSymbolId+1) );
for ( LelList::Iter lel = langEls; lel.lte(); lel++ )
langElIndex[lel->id] = lel;
diff --git a/colm/pdagraph.h b/colm/pdagraph.h
index 955975a4..40609701 100644
--- a/colm/pdagraph.h
+++ b/colm/pdagraph.h
@@ -49,7 +49,7 @@ struct PdaState;
struct PdaGraph;
struct TokenDef;
struct Definition;
-struct KlangEl;
+struct LangEl;
struct TokenRegion;
typedef Vector<TokenRegion*> RegionVect;
@@ -401,7 +401,7 @@ struct PdaGraph
TransClosureQueue transClosureQueue;
PdaState *stateClosureHead;
- KlangEl **langElIndex;
+ LangEl **langElIndex;
void setStartState( PdaState *state );
void unsetStartState( );
diff --git a/colm/resolve.cc b/colm/resolve.cc
index 2a1c5cc3..097d15ae 100644
--- a/colm/resolve.cc
+++ b/colm/resolve.cc
@@ -343,7 +343,7 @@ void ParseData::resolveRootBlock()
block->resolve( this );
}
-void ParseData::resolveTranslateBlock( KlangEl *langEl )
+void ParseData::resolveTranslateBlock( LangEl *langEl )
{
CodeBlock *block = langEl->transBlock;
block->resolve( this );
@@ -422,7 +422,7 @@ void ParseData::resolveUses()
error() << "do not have namespace for resolving reference" << endp;
/* Look up the language element in the region. */
- KlangEl *langEl = getKlangEl( this, nspace, lel->objectDefUses );
+ LangEl *langEl = getKlangEl( this, nspace, lel->objectDefUses );
lel->objectDef = langEl->objectDef;
}
}
@@ -463,7 +463,7 @@ void ParseData::resolveReferenceFactor( ProdEl *fact )
fact->nspace = nspace;
/* Look up the language element in the region. */
- KlangEl *langEl = getKlangEl( this, nspace, fact->refName );
+ LangEl *langEl = getKlangEl( this, nspace, fact->refName );
if ( fact->repeatType == RepeatRepeat ) {
/* If the factor is a repeat, create the repeat element and link the