summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2012-09-02 22:24:21 -0400
committerAdrian Thurston <thurston@complang.org>2012-09-02 22:24:21 -0400
commitc8bb762a52a9363e9eca92c788878fc82a29ed6d (patch)
tree4089dbbb378babcb4c89d76ee66345108375e19f
parent2ff300d6fb09c7984a4187a996cdd23480e0ef5e (diff)
downloadcolm-c8bb762a52a9363e9eca92c788878fc82a29ed6d.tar.gz
some cleanup
-rw-r--r--colm/compiler.cc2
-rw-r--r--colm/lmparse.kl2
-rw-r--r--colm/parsetree.cc2
-rw-r--r--colm/parsetree.h40
4 files changed, 11 insertions, 35 deletions
diff --git a/colm/compiler.cc b/colm/compiler.cc
index d3d4f7ef..c3887fd0 100644
--- a/colm/compiler.cc
+++ b/colm/compiler.cc
@@ -696,7 +696,7 @@ void Compiler::createBuiltin( const char *name, BuiltinMachine builtin )
{
LexExpression *expression = LexExpression::cons( builtin );
LexJoin *join = new LexJoin( expression );
- VarDef *varDef = new VarDef( name, join );
+ LexDefinition *varDef = new LexDefinition( name, join );
GraphDictEl *graphDictEl = new GraphDictEl( name, varDef );
rootNamespace->rlMap.insert( graphDictEl );
}
diff --git a/colm/lmparse.kl b/colm/lmparse.kl
index 1dd3cf72..c29a59a7 100644
--- a/colm/lmparse.kl
+++ b/colm/lmparse.kl
@@ -2649,7 +2649,7 @@ void ColmParser::addRegularDef( const InputLoc &loc, Namespace *nspace,
GraphDictEl *newEl = nspace->rlMap.insert( name );
if ( newEl != 0 ) {
/* New element in the dict, all good. */
- newEl->value = new VarDef( name, join );
+ newEl->value = new LexDefinition( name, join );
newEl->isInstance = false;
newEl->loc = loc;
}
diff --git a/colm/parsetree.cc b/colm/parsetree.cc
index 0af983ae..313cc6c9 100644
--- a/colm/parsetree.cc
+++ b/colm/parsetree.cc
@@ -180,7 +180,7 @@ int CmpUniqueParser::compare( const UniqueParser &ut1, const UniqueParser &ut2 )
return 0;
}
-FsmGraph *VarDef::walk( Compiler *pd )
+FsmGraph *LexDefinition::walk( Compiler *pd )
{
/* Recurse on the expression. */
FsmGraph *rtnVal = join->walk( pd );
diff --git a/colm/parsetree.h b/colm/parsetree.h
index 46f30b44..7a2adbbe 100644
--- a/colm/parsetree.h
+++ b/colm/parsetree.h
@@ -315,9 +315,9 @@ struct PriorityAug
/*
* A Variable Definition
*/
-struct VarDef
+struct LexDefinition
{
- VarDef( const String &name, LexJoin *join )
+ LexDefinition( const String &name, LexJoin *join )
: name(name), join(join) { }
/* Parse tree traversal. */
@@ -663,13 +663,13 @@ struct GraphDictEl
{
GraphDictEl( const String &key )
: key(key), value(0), isInstance(false) { }
- GraphDictEl( const String &key, VarDef *value )
+ GraphDictEl( const String &key, LexDefinition *value )
: key(key), value(value), isInstance(false) { }
const String &getKey() { return key; }
String key;
- VarDef *value;
+ LexDefinition *value;
bool isInstance;
/* Location info of graph definition. Points to variable name of assignment. */
@@ -776,31 +776,7 @@ typedef DList<Namespace> NamespaceList;
typedef BstSet< Namespace*, CmpOrd<Namespace*> > NamespaceSet;
/* List of Expressions. */
-typedef DList<LexExpression> ExprList;
-
-struct JoinOrLm
-{
- JoinOrLm( LexJoin *join ) :
- join(join) {}
-
- FsmGraph *walk( Compiler *pd );
- void makeNameTree( Compiler *pd );
-
- LexJoin *join;
-};
-
-struct RegionJoinOrLm
-{
- enum Type { LongestMatchType };
-
- RegionJoinOrLm( TokenRegion *tokenRegion ) :
- tokenRegion(tokenRegion) {}
-
- FsmGraph *walk( Compiler *pd );
- void makeNameTree( Compiler *pd );
-
- TokenRegion *tokenRegion;
-};
+typedef DList<LexExpression> LexExprList;
/*
* LexJoin
@@ -815,7 +791,7 @@ struct LexJoin
void makeNameTree( Compiler *pd );
/* Data. */
- ExprList exprList;
+ LexExprList exprList;
LexJoin *context;
Action *mark;
@@ -1149,7 +1125,7 @@ struct LexFactor
}
/* Construct with a reference to a var def. */
- static LexFactor *cons( const InputLoc &loc, VarDef *varDef )
+ static LexFactor *cons( const InputLoc &loc, LexDefinition *varDef )
{
LexFactor *f = new LexFactor;
f->type = ReferenceType;
@@ -1179,7 +1155,7 @@ struct LexFactor
Range *range;
ReItem *reItem;
RegExpr *regExp;
- VarDef *varDef;
+ LexDefinition *varDef;
LexJoin *join;
int lower, upper;
Type type;